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/
|
server/node_modules/
|
||||||
node_modules/
|
node_modules/
|
||||||
scripts/
|
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;
|
var fromChannel = false;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
/*
|
|
||||||
if (navigator.serviceWorker && window.location.host != "zoff.dev") {
|
if (navigator.serviceWorker && window.location.host != "zoff.dev") {
|
||||||
navigator.serviceWorker.register('/service-worker.js', {scope: '/'})
|
navigator.serviceWorker.register('/service-worker.js', {scope: '/'})
|
||||||
.then(function (registration) {
|
.then(function (registration) {
|
||||||
@@ -100,10 +99,10 @@ try{
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Helper.log('Service Worker is not supported in this browser.');
|
Helper.log('Service Worker is not supported in this browser.');
|
||||||
}*/
|
}/*
|
||||||
navigator.serviceWorker.getRegistration('/').then(function(registration) {
|
navigator.serviceWorker.getRegistration('/').then(function(registration) {
|
||||||
registration.unregister();
|
registration.unregister();
|
||||||
});
|
});*/
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
$().ready(function(){
|
$().ready(function(){
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
var version = 'v3.4';
|
var version = 'v3.4';
|
||||||
var CACHE_FILES = [
|
var CACHE_FILES = [
|
||||||
'/public/html/offline.html',
|
'/assets/html/offline.html',
|
||||||
'/manifest.json',
|
'/assets/manifest.json',
|
||||||
'/public/images/favicon.png'
|
'/assets/images/favicon.png'
|
||||||
];
|
];
|
||||||
|
|
||||||
self.addEventListener("install", function(event) {
|
self.addEventListener("install", function(event) {
|
||||||
@@ -43,11 +43,11 @@ self.addEventListener('fetch', event => {
|
|||||||
fetch(event.request.url).catch(error => {
|
fetch(event.request.url).catch(error => {
|
||||||
if(event.request.url.includes('manifest.json')){
|
if(event.request.url.includes('manifest.json')){
|
||||||
return caches.open(version + "::zoff").then(function(cache) {
|
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')) {
|
} else if (event.request.url.includes('favicon')) {
|
||||||
return caches.open(version + "::zoff").then(function(cache) {
|
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')) {
|
} else if (event.request.url.includes('service-worker')) {
|
||||||
return caches.open(version + "::zoff").then(function(cache) {
|
return caches.open(version + "::zoff").then(function(cache) {
|
||||||
@@ -55,7 +55,7 @@ self.addEventListener('fetch', event => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return caches.open(version + "::zoff").then(function(cache) {
|
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();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use('/service-worker.js', function(req, res) {
|
||||||
|
res.sendFile(publicPath + '/service-worker.js');
|
||||||
|
});
|
||||||
app.use('/', router);
|
app.use('/', router);
|
||||||
app.use('/assets', express.static(publicPath + '/assets'));
|
app.use('/assets', express.static(publicPath + '/assets'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*process.on('uncaughtException', function(e){
|
/*process.on('uncaughtException', function(e){
|
||||||
console.log("\n" + new Date().toString() + "\n", e.stack || e);
|
console.log("\n" + new Date().toString() + "\n", e.stack || e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user