Sunil Mohan Adapa b6bade7d06
janus: Update the video room code from latest upstream
- Bootswatch is a theme library for bootstrap. In Debian, only 3.x version of
the package is available. It is compatible with bootstrap 3.x but not bootstrap
5. Drop the theming altogether and use the basic bootstrap style (which is
already very close to the theme).

- Updated copyright year, mention the video room files in debian/copyright.

- Drop libjs-spin.js which is no longer used by the updated code.

- Change bootstrap version to 5.x from the earlier 4.x. Also add node-popper2
library (needed by bootstrap5 and video room code) as explicit dependency.

- Add missing style for btn-default class dropped in bootstrap 5.

- .simulcast-button CSS style is not longer needed as updated code used flex box
with .d-flex bootstrap class.

Tests:

- Compare the files in janus source code around Mar 2022 with the files in
FreedomBox source code before this patch. Compare latest janus source code with
the files after this patch. Both sets of changes are very similar.

- Connect to video room using two browser windows. Connection is successful and
2 video streams are shown in each of the browser windows.

- Styling looks close to the demo on janus website and is acceptable.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-11-17 13:03:02 -05:00

117 lines
4.1 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
FreedomBox app for janus.
"""
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.config import DropinConfigs
from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver
from plinth.modules.backups.components import BackupRestore
from plinth.modules.coturn.components import TurnTimeLimitedConsumer
from plinth.modules.firewall.components import Firewall
from plinth.package import Packages, install
from plinth.utils import Version, format_lazy
from . import manifest, privileged
_description = [
_('Janus is a lightweight WebRTC server.'),
_('A simple video conference room is included.'),
format_lazy(
_('<a href="{coturn_url}">Coturn</a> is required to '
'use Janus.'), coturn_url=reverse_lazy('coturn:index')),
format_lazy(
_('<strong>Note:</strong> This app receives frequent feature updates. '
'It can only be installed if frequent feature updates is enabled in '
'the <a href="{upgrades_url}">Software Update</a> app.'),
upgrades_url=reverse_lazy('upgrades:index')),
]
class JanusApp(app_module.App):
"""FreedomBox app for janus."""
app_id = 'janus'
_version = 2
def __init__(self) -> None:
"""Create components for the app."""
super().__init__()
info = app_module.Info(self.app_id, self._version, name=_('Janus'),
icon_filename='janus', description=_description,
manual_page='Janus', clients=manifest.clients,
tags=manifest.tags)
self.add(info)
menu_item = menu.Menu('menu-janus', info.name, info.icon_filename,
info.tags, 'janus:index', parent_url_name='apps')
self.add(menu_item)
shortcut = frontpage.Shortcut('shortcut-janus', info.name,
info.icon_filename,
reverse_lazy('janus:room'),
clients=manifest.clients, tags=info.tags)
self.add(shortcut)
packages = Packages('packages-janus', [
'janus', 'libjs-jquery', 'libjs-bootbox', 'libjs-bootstrap5',
'libjs-janus-gateway', 'libjs-jquery-blockui', 'libjs-toastr',
'libjs-webrtc-adapter', 'node-popper2'
])
self.add(packages)
dropin_configs = DropinConfigs('dropin-configs-janus', [
'/etc/apache2/conf-available/janus-freedombox.conf',
])
self.add(dropin_configs)
firewall = Firewall('firewall-janus', info.name,
ports=['http', 'https',
'janus-freedombox'], is_external=True)
self.add(firewall)
webserver = Webserver('webserver-janus', 'janus-freedombox')
self.add(webserver)
daemon = Daemon(
'daemon-janus', 'janus', listen_ports=[(8088, 'tcp4'),
(8088, 'tcp6'),
(8188, 'tcp4'),
(8188, 'tcp6')])
self.add(daemon)
turn = TurnTimeLimitedConsumer('turn-janus')
self.add(turn)
backup_restore = BackupRestore('backup-restore-janus',
**manifest.backup)
self.add(backup_restore)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
privileged.setup()
if not old_version:
self.enable()
def force_upgrade(self, packages):
"""Force upgrade janus to resolve conffile prompts."""
if 'janus' not in packages:
return False
# Allow upgrades within 1.0.* and 1.1.*
package = packages['janus']
if Version(package['new_version']) > Version('1.2~'):
return False
install(['janus'], force_configuration='new')
privileged.setup()
return True