fix: move service worker back to relative_path/service-worker.js

v1.18.x
Barış Soner Uşaklı 4 years ago
parent ab0ef44289
commit fca17cb713

@ -788,7 +788,7 @@ app.cacheBuster = null;
function registerServiceWorker() { function registerServiceWorker() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.register(config.relative_path + '/assets/src/service-worker.js', { scope: config.relative_path + '/' }) navigator.serviceWorker.register(config.relative_path + '/service-worker.js', { scope: config.relative_path + '/' })
.then(function () { .then(function () {
console.info('ServiceWorker registration succeeded.'); console.info('ServiceWorker registration succeeded.');
}).catch(function (err) { }).catch(function (err) {

@ -12,7 +12,7 @@ module.exports = function (app, middleware, controllers) {
app.get('/manifest.webmanifest', controllers.manifest); app.get('/manifest.webmanifest', controllers.manifest);
app.get('/css/previews/:theme', controllers.admin.themes.get); app.get('/css/previews/:theme', controllers.admin.themes.get);
app.get('/osd.xml', controllers.osd.handle); app.get('/osd.xml', controllers.osd.handle);
app.get('/assets/src/service-worker.js', function (req, res) { app.get('/service-worker.js', function (req, res) {
res.status(200).type('application/javascript').set('Service-Worker-Allowed', nconf.get('relative_path') + '/').sendFile(path.join(__dirname, '../../public/src/service-worker.js')); res.status(200).type('application/javascript').set('Service-Worker-Allowed', nconf.get('relative_path') + '/').sendFile(path.join(__dirname, '../../public/src/service-worker.js'));
}); });
}; };

Loading…
Cancel
Save