mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Changed .gitignore, and started using service-worker again
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
server/views/assets/images/thumbnails/
|
||||
server/public/assets/images/thumbnails/
|
||||
server/node_modules/
|
||||
node_modules/
|
||||
scripts/
|
||||
|
||||
3
server/public/assets/dist/embed.min.js
vendored
3
server/public/assets/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
5
server/public/assets/dist/main.min.js
vendored
5
server/public/assets/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -89,7 +89,6 @@ var fromFront = false;
|
||||
var fromChannel = false;
|
||||
|
||||
try{
|
||||
/*
|
||||
if (navigator.serviceWorker && window.location.host != "zoff.dev") {
|
||||
navigator.serviceWorker.register('/service-worker.js', {scope: '/'})
|
||||
.then(function (registration) {
|
||||
@@ -100,10 +99,10 @@ try{
|
||||
});
|
||||
} else {
|
||||
Helper.log('Service Worker is not supported in this browser.');
|
||||
}*/
|
||||
}/*
|
||||
navigator.serviceWorker.getRegistration('/').then(function(registration) {
|
||||
registration.unregister();
|
||||
});
|
||||
});*/
|
||||
} catch(e) {}
|
||||
|
||||
$().ready(function(){
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var version = 'v3.4';
|
||||
var CACHE_FILES = [
|
||||
'/public/html/offline.html',
|
||||
'/manifest.json',
|
||||
'/public/images/favicon.png'
|
||||
'/assets/html/offline.html',
|
||||
'/assets/manifest.json',
|
||||
'/assets/images/favicon.png'
|
||||
];
|
||||
|
||||
self.addEventListener("install", function(event) {
|
||||
@@ -43,11 +43,11 @@ self.addEventListener('fetch', event => {
|
||||
fetch(event.request.url).catch(error => {
|
||||
if(event.request.url.includes('manifest.json')){
|
||||
return caches.open(version + "::zoff").then(function(cache) {
|
||||
return cache.match("/manifest.json");
|
||||
return cache.match("/assets/manifest.json");
|
||||
});
|
||||
} else if (event.request.url.includes('favicon')) {
|
||||
return caches.open(version + "::zoff").then(function(cache) {
|
||||
return cache.match("/public/images/favicon.png");
|
||||
return cache.match("/assets/images/favicon.png");
|
||||
});
|
||||
} else if (event.request.url.includes('service-worker')) {
|
||||
return caches.open(version + "::zoff").then(function(cache) {
|
||||
@@ -55,7 +55,7 @@ self.addEventListener('fetch', event => {
|
||||
});
|
||||
} else {
|
||||
return caches.open(version + "::zoff").then(function(cache) {
|
||||
return cache.match("/public/html/offline.html");
|
||||
return cache.match("/assets/html/offline.html");
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -104,11 +104,14 @@ app.use(function (req, res, next) {
|
||||
next();
|
||||
});
|
||||
|
||||
|
||||
app.use('/service-worker.js', function(req, res) {
|
||||
res.sendFile(publicPath + '/service-worker.js');
|
||||
});
|
||||
app.use('/', router);
|
||||
app.use('/assets', express.static(publicPath + '/assets'));
|
||||
|
||||
|
||||
|
||||
/*process.on('uncaughtException', function(e){
|
||||
console.log("\n" + new Date().toString() + "\n", e.stack || e);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user