File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,14 +162,15 @@ function onTokenLoginCompleted() {
162162}
163163
164164export async function loadApp ( ) {
165- if ( window . vector_indexeddb_worker_script === undefined ) {
165+ const vectorIndexeddbWorkerScript = document . body . dataset . vectorIndexeddbWorkerScript ;
166+ if ( ! vectorIndexeddbWorkerScript ) {
166167 // If this is missing, something has probably gone wrong with
167168 // the bundling. The js-sdk will just fall back to accessing
168169 // indexeddb directly with no worker script, but we want to
169170 // make sure the indexeddb script is present, so fail hard.
170171 throw new Error ( "Missing indexeddb worker script!" ) ;
171172 }
172- MatrixClientPeg . setIndexedDbWorkerScript ( window . vector_indexeddb_worker_script ) ;
173+ MatrixClientPeg . setIndexedDbWorkerScript ( vectorIndexeddbWorkerScript ) ;
173174 CallHandler . setConferenceHandler ( VectorConferenceHandler ) ;
174175
175176 window . addEventListener ( 'hashchange' , onHashChange ) ;
Original file line number Diff line number Diff line change 2222 < meta name ="msapplication-config " content ="<%= require('../../res/vector-icons/browserconfig.xml') %> ">
2323 < meta name ="theme-color " content ="#ffffff ">
2424 < meta property ="og:image " content ="<%= htmlWebpackPlugin.options.vars.og_image_url %> " />
25+ < meta http-equiv ="Content-Security-Policy " content ="default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval' https://www.recaptcha.net https://www.gstatic.com; img-src * blob: data:; connect-src *; font-src 'self'; media-src * blob: data:; worker-src 'self'; frame-src * blob: data:; form-action 'self'; object-src 'self'; manifest-src 'self' ">
2526 < % for (var i=0; i < htmlWebpackPlugin .files.css.length; i++) {
2627 var file = htmlWebpackPlugin.files.css[i];
2728 var match = file.match(/^bundles\/.*?\/theme-(.*)\.css$/);
3435 < % }
3536 } %>
3637 </ head >
37- < body style ="height: 100%; ">
38+ < body style ="height: 100%; " data-vector-indexeddb-worker-script = ' <%= htmlWebpackPlugin.files.chunks["indexeddb-worker"].entry %> ' >
3839 < section id ="matrixchat " style ="height: 100%; overflow: auto; "> </ section >
3940 < noscript > Sorry, Riot requires JavaScript to be enabled.</ noscript > <!-- TODO: Translate this? -->
40- < script >
41- window . vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.chunks[' indexeddb - worker '].entry %>' ;
42- </ script >
4341 < script src ="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %> "> </ script >
44- < script >
45- if ( 'serviceWorker' in navigator ) {
46- navigator . serviceWorker . register ( 'sw.js' ) ;
47- }
48- </ script >
4942 < img src ="<%= require('matrix-react-sdk/res/img/warning.svg') %> " width ="24 " height ="23 " style ="visibility: hidden; position: absolute; top: 0px; left: 0px; "/>
5043 < img src ="<%= require('matrix-react-sdk/res/img/e2e/warning.svg') %> " width ="24 " height ="23 " style ="visibility: hidden; position: absolute; top: 0px; left: 0px; "/>
5144 < img src ="<%= require('matrix-react-sdk/res/img/feather-customised/warning-triangle.svg') %> " width ="24 " height ="23 " style ="visibility: hidden; position: absolute; top: 0px; left: 0px; "/>
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ require('highlight.js/styles/github.css');
2929import './rageshakesetup' ;
3030import './modernizr' ;
3131
32+ // load service worker if available on this platform
33+ if ( 'serviceWorker' in navigator ) {
34+ navigator . serviceWorker . register ( 'sw.js' ) ;
35+ }
36+
3237// Ensure the skin is the very first thing to load for the react-sdk. We don't even want to reference
3338// the SDK until we have to in imports.
3439console . log ( "Loading skin..." ) ;
You can’t perform that action at this time.
0 commit comments