|
@@ -13,10 +13,19 @@
|
13
|
13
|
<link rel="manifest" id="manifest-placeholder">
|
14
|
14
|
|
15
|
15
|
<script>
|
|
16
|
+ function contextRoot(pathname) {
|
|
17
|
+ const contextRootEndIndex = pathname.lastIndexOf('/');
|
|
18
|
+
|
|
19
|
+ return (
|
|
20
|
+ contextRootEndIndex === -1
|
|
21
|
+ ? '/'
|
|
22
|
+ : pathname.substring(0, contextRootEndIndex + 1)
|
|
23
|
+ );
|
|
24
|
+ }
|
16
|
25
|
window.EXCALIDRAW_ASSET_PATH = 'libs/';
|
17
|
26
|
// Dynamically generate the manifest location URL. It must be served from the document origin, and we may have
|
18
|
27
|
// the base pointing to the CDN. This way we can generate a full URL which will bypass the base.
|
19
|
|
- document.querySelector('#manifest-placeholder').setAttribute('href', window.location.origin + '/manifest.json');
|
|
28
|
+ document.querySelector('#manifest-placeholder').setAttribute('href', window.location.origin + contextRoot(window.location.pathname) + 'manifest.json');
|
20
|
29
|
|
21
|
30
|
document.addEventListener('DOMContentLoaded', () => {
|
22
|
31
|
if (!JitsiMeetJS.app) {
|
|
@@ -40,7 +49,7 @@
|
40
|
49
|
|
41
|
50
|
if (shouldRegisterWorker) {
|
42
|
51
|
navigator.serviceWorker
|
43
|
|
- .register(window.location.origin + '/pwa-worker.js')
|
|
52
|
+ .register(window.location.origin + contextRoot(window.location.pathname) + '/pwa-worker.js')
|
44
|
53
|
.then(reg => {
|
45
|
54
|
console.log('Service worker registered.', reg);
|
46
|
55
|
})
|