jsxc: Fix issue with serving static files

During the re-organization of data files into individual apps, a regression for
JSXC preventing the symbolic links in the source code from being copied to
destination folder during 'setup.py install'. Fix this by removing symbolic
links and serving the file using CherryPy mappings with the help of StaticFiles
component.

Closes: #1180.

Tests performed:

- Access the following URLs successfully:
  https://localhost:4430/plinth/static/jsxc/img/menu_black.svg
  https://localhost:4430/plinth/static/jsxc/libjs-jsxc/jsxc.css
  https://localhost:4430/plinth/static/jsxc/libjs-jsxc/sound/Ping1.mp3
  https://localhost:4430/plinth/static/jsxc/libjs-jsxc/lib/otr/lib/dsa-webworker.js

- Login to JSXC, see the roster properly on the right side.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2020-03-24 13:29:29 -07:00 committed by Veiko Aasa
parent 7a0ea38fb1
commit b80083cfce
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
5 changed files with 11 additions and 4 deletions

View File

@ -11,6 +11,7 @@ from django.utils.translation import ugettext_lazy as _
from plinth import app as app_module
from plinth import frontpage, menu
from plinth.modules.firewall.components import Firewall
from plinth.web_server import StaticFiles
from .manifest import backup, clients # noqa, pylint: disable=unused-import
@ -58,6 +59,16 @@ class JSXCApp(app_module.App):
ports=['http', 'https'], is_external=True)
self.add(firewall)
directory_map = {
'/static/jsxc/img': '/usr/share/libjs-jsxc/img/',
'/static/jsxc/libjs-jsxc/lib': '/usr/share/javascript/jsxc/lib/',
'/static/jsxc/libjs-jsxc/sound': '/usr/share/libjs-jsxc/sound/',
'/static/jsxc/libjs-jsxc/': '/usr/share/libjs-jsxc/css/',
}
static_files = StaticFiles('static-files-jsxc',
directory_map=directory_map)
self.add(static_files)
def init():
"""Initialize the JSXC module"""

View File

@ -1 +0,0 @@
/usr/share/libjs-jsxc/img/

View File

@ -1 +0,0 @@
/usr/share/libjs-jsxc/css/jsxc.css

View File

@ -1 +0,0 @@
/usr/share/javascript/jsxc/lib

View File

@ -1 +0,0 @@
/usr/share/libjs-jsxc/sound/