2024-01-09 18:58:09 +00:00
|
|
|
"""Class representing Jitsi Meet service"""
|
2022-08-25 17:03:56 +00:00
|
|
|
import base64
|
|
|
|
import subprocess
|
2024-03-01 00:21:31 +00:00
|
|
|
from typing import Optional, List
|
2022-08-25 17:03:56 +00:00
|
|
|
|
2023-07-27 23:31:28 +00:00
|
|
|
from selfprivacy_api.jobs import Job
|
2024-03-05 08:55:52 +00:00
|
|
|
from selfprivacy_api.utils.systemd import (
|
2022-08-25 17:03:56 +00:00
|
|
|
get_service_status_from_several_units,
|
|
|
|
)
|
2024-03-01 00:21:31 +00:00
|
|
|
from selfprivacy_api.services.service import Service, ServiceStatus
|
2024-06-26 11:21:26 +00:00
|
|
|
from selfprivacy_api.utils import get_domain
|
2023-08-02 05:54:18 +00:00
|
|
|
from selfprivacy_api.utils.block_devices import BlockDevice
|
2024-01-09 18:58:09 +00:00
|
|
|
from selfprivacy_api.services.jitsimeet.icon import JITSI_ICON
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
|
2024-01-09 18:58:09 +00:00
|
|
|
class JitsiMeet(Service):
|
2022-08-25 17:03:56 +00:00
|
|
|
"""Class representing Jitsi service"""
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_id() -> str:
|
|
|
|
"""Return service id."""
|
2024-01-09 18:58:09 +00:00
|
|
|
return "jitsi-meet"
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_display_name() -> str:
|
|
|
|
"""Return service display name."""
|
2024-01-09 18:58:09 +00:00
|
|
|
return "JitsiMeet"
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_description() -> str:
|
|
|
|
"""Return service description."""
|
2024-01-09 18:58:09 +00:00
|
|
|
return "Jitsi Meet is a free and open-source video conferencing solution."
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_svg_icon() -> str:
|
|
|
|
"""Read SVG icon from file and return it as base64 encoded string."""
|
|
|
|
return base64.b64encode(JITSI_ICON.encode("utf-8")).decode("utf-8")
|
|
|
|
|
2024-06-26 12:00:51 +00:00
|
|
|
@classmethod
|
|
|
|
def get_url(cls) -> Optional[str]:
|
2024-06-26 11:21:26 +00:00
|
|
|
"""Return service url."""
|
|
|
|
domain = get_domain()
|
|
|
|
return f"https://meet.{domain}"
|
|
|
|
|
2024-06-26 12:00:51 +00:00
|
|
|
@classmethod
|
|
|
|
def get_subdomain(cls) -> Optional[str]:
|
2024-06-26 11:21:49 +00:00
|
|
|
return "meet"
|
|
|
|
|
2022-08-25 17:03:56 +00:00
|
|
|
@staticmethod
|
|
|
|
def is_movable() -> bool:
|
|
|
|
return False
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def is_required() -> bool:
|
|
|
|
return False
|
|
|
|
|
2023-06-29 11:27:08 +00:00
|
|
|
@staticmethod
|
|
|
|
def get_backup_description() -> str:
|
|
|
|
return "Secrets that are used to encrypt the communication."
|
|
|
|
|
2022-08-25 17:03:56 +00:00
|
|
|
@staticmethod
|
|
|
|
def get_status() -> ServiceStatus:
|
|
|
|
return get_service_status_from_several_units(
|
|
|
|
["jitsi-videobridge.service", "jicofo.service"]
|
|
|
|
)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def stop():
|
2023-07-27 23:31:28 +00:00
|
|
|
subprocess.run(
|
|
|
|
["systemctl", "stop", "jitsi-videobridge.service"],
|
|
|
|
check=False,
|
|
|
|
)
|
|
|
|
subprocess.run(["systemctl", "stop", "jicofo.service"], check=False)
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def start():
|
2023-07-27 23:31:28 +00:00
|
|
|
subprocess.run(
|
|
|
|
["systemctl", "start", "jitsi-videobridge.service"],
|
|
|
|
check=False,
|
|
|
|
)
|
|
|
|
subprocess.run(["systemctl", "start", "jicofo.service"], check=False)
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def restart():
|
2023-07-27 23:31:28 +00:00
|
|
|
subprocess.run(
|
|
|
|
["systemctl", "restart", "jitsi-videobridge.service"],
|
|
|
|
check=False,
|
|
|
|
)
|
|
|
|
subprocess.run(["systemctl", "restart", "jicofo.service"], check=False)
|
2022-08-25 17:03:56 +00:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_configuration():
|
|
|
|
return {}
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def set_configuration(config_items):
|
|
|
|
return super().set_configuration(config_items)
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_logs():
|
|
|
|
return ""
|
|
|
|
|
2023-04-17 13:47:49 +00:00
|
|
|
@staticmethod
|
2024-03-01 00:21:31 +00:00
|
|
|
def get_folders() -> List[str]:
|
2023-04-17 13:47:49 +00:00
|
|
|
return ["/var/lib/jitsi-meet"]
|
|
|
|
|
2022-08-25 17:03:56 +00:00
|
|
|
def move_to_volume(self, volume: BlockDevice) -> Job:
|
2024-01-09 18:58:09 +00:00
|
|
|
raise NotImplementedError("jitsi-meet service is not movable")
|