-
diff --git a/plinth/modules/janus/views.py b/plinth/modules/janus/views.py
index a86d1f636..b0b8e73dd 100644
--- a/plinth/modules/janus/views.py
+++ b/plinth/modules/janus/views.py
@@ -3,14 +3,26 @@
Views for the Janus app.
"""
+import copy
+
from django.views.generic import TemplateView
from plinth import app as app_module
+from plinth.middleware import CONTENT_SECURITY_POLICY
class JanusRoomView(TemplateView):
"""A simple page to host Janus video room."""
template_name = 'janus_video_room.html'
+ headers: dict[str, str] = {}
+
+ def __init__(self, **kwargs):
+ """Initialize the view and set CSP."""
+ super().__init__(**kwargs)
+ csp = copy.copy(CONTENT_SECURITY_POLICY)
+ csp['script-src'] = "'self' 'unsafe-inline'"
+ csp['style-src'] = "'self' 'unsafe-inline'"
+ self.headers['Content-Security-Policy'] = csp.get_header_value()
def get_context_data(self, *args, **kwargs):
"""Add user's TURN server information to view context."""
@@ -19,3 +31,8 @@ class JanusRoomView(TemplateView):
context = super().get_context_data(*args, **kwargs)
context['user_turn_config'] = config.to_json()
return context
+
+ def get(self, request, *args, **kwargs):
+ """Handle GET request and return a response object."""
+ context = self.get_context_data(**kwargs)
+ return self.render_to_response(context, headers=self.headers)
diff --git a/plinth/modules/jsxc/__init__.py b/plinth/modules/jsxc/__init__.py
index b51e3cd93..74f7c03ff 100644
--- a/plinth/modules/jsxc/__init__.py
+++ b/plinth/modules/jsxc/__init__.py
@@ -53,7 +53,11 @@ class JSXCApp(app_module.App):
clients=info.clients, tags=info.tags)
self.add(shortcut)
- packages = Packages('packages-jsxc', ['libjs-jsxc'])
+ packages = Packages('packages-jsxc', [
+ 'libjs-jsxc', 'libjs-bootstrap4', 'libjs-jquery',
+ 'libjs-jquery-ui', 'node-jquery-slimscroll',
+ 'libjs-jquery-fullscreen'
+ ])
self.add(packages)
firewall = Firewall('firewall-jsxc', info.name,
diff --git a/plinth/modules/jsxc/templates/jsxc_launch.html b/plinth/modules/jsxc/templates/jsxc_launch.html
index 140254c03..342b682e4 100644
--- a/plinth/modules/jsxc/templates/jsxc_launch.html
+++ b/plinth/modules/jsxc/templates/jsxc_launch.html
@@ -48,7 +48,7 @@
-
+
diff --git a/plinth/modules/jsxc/views.py b/plinth/modules/jsxc/views.py
index 1e51bb416..9cda09bec 100644
--- a/plinth/modules/jsxc/views.py
+++ b/plinth/modules/jsxc/views.py
@@ -1,10 +1,13 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Views for the JSXC module."""
+import copy
+
from django.http import Http404
from django.views.generic import TemplateView
import plinth.app as app_module
+from plinth.middleware import CONTENT_SECURITY_POLICY
from plinth.modules.names.components import DomainName
@@ -12,6 +15,14 @@ class JsxcView(TemplateView):
"""A simple page to embed Javascript XMPP Client library."""
template_name = 'jsxc_launch.html'
+ headers: dict[str, str] = {}
+
+ def __init__(self, **kwargs):
+ """Initialize the view and set CSP."""
+ super().__init__(**kwargs)
+ csp = copy.copy(CONTENT_SECURITY_POLICY)
+ csp['style-src'] = "'self' 'unsafe-inline'"
+ self.headers['Content-Security-Policy'] = csp.get_header_value()
def dispatch(self, request, *args, **kwargs):
"""Don't serve the view when app is disabled."""
@@ -26,3 +37,8 @@ class JsxcView(TemplateView):
context = super().get_context_data(*args, **kwargs)
context['domain_name'] = DomainName.list_names()[0]
return context
+
+ def get(self, request, *args, **kwargs):
+ """Handle GET request and return a response object."""
+ context = self.get_context_data(**kwargs)
+ return self.render_to_response(context, headers=self.headers)
diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py
index a412e022e..84511477d 100644
--- a/plinth/modules/upgrades/__init__.py
+++ b/plinth/modules/upgrades/__init__.py
@@ -55,7 +55,7 @@ class UpgradesApp(app_module.App):
app_id = 'upgrades'
- _version = 20
+ _version = 21
can_be_disabled = False
diff --git a/plinth/modules/upgrades/privileged.py b/plinth/modules/upgrades/privileged.py
index bec033389..f0cf1a753 100644
--- a/plinth/modules/upgrades/privileged.py
+++ b/plinth/modules/upgrades/privileged.py
@@ -74,6 +74,17 @@ Explanation: matrix-synapse recommends python3-pympler
Package: python3-pympler
Pin: release n=sid
Pin-Priority: 200
+
+Explanation: Make janus package and its dependencies installable from Debian
+Explanation: 'unstable' distribution.
+Package: janus
+Pin: release n=sid
+Pin-Priority: 200
+
+Explanation: Janus app in FreedomBox needs the package for web UI.
+Package: libjs-janus-gateway
+Pin: release n=sid
+Pin-Priority: 200
'''
APT_PREFERENCES_UNSTABLE = \
diff --git a/plinth/package.py b/plinth/package.py
index 14efcecf2..ab2edcc9b 100644
--- a/plinth/package.py
+++ b/plinth/package.py
@@ -308,9 +308,9 @@ class Packages(app_module.FollowerComponent):
"""
packages_set: set[str] = set(packages)
- # Get list of packages needed by other installed apps (packages to
- # keep).
- keep_packages: set[str] = set()
+ # Get list of packages needed by other installed apps and by freedombox
+ # itself (packages to keep).
+ keep_packages: set[str] = {'freedombox'}
for app in app_module.App.list():
# uninstall() will be called on Packages of this app separately
# for uninstalling this app.
diff --git a/plinth/settings.py b/plinth/settings.py
index 8a192425a..b15b2190c 100644
--- a/plinth/settings.py
+++ b/plinth/settings.py
@@ -149,6 +149,7 @@ LOGIN_REDIRECT_URL = 'index'
MESSAGE_TAGS: dict = {}
MIDDLEWARE = (
+ 'plinth.middleware.CommonHeadersMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
diff --git a/plinth/tests/test_package.py b/plinth/tests/test_package.py
index c5153479d..40baad205 100644
--- a/plinth/tests/test_package.py
+++ b/plinth/tests/test_package.py
@@ -178,11 +178,11 @@ def test_packages_uninstall(uninstall, _refresh_package_lists):
"""Test app"""
app_id = 'test-app'
- component = Packages('test-component', ['python3', 'bash'])
+ component = Packages('test-component', ['bash', 'dash'])
app = TestApp()
app.add(component)
app.uninstall()
- uninstall.assert_has_calls([call(['python3', 'bash'], purge=True)])
+ uninstall.assert_has_calls([call(['bash', 'dash'], purge=True)])
@patch('plinth.package.refresh_package_lists')