forked from go-shiori/shiori
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporate go-shiori#325 changes, copy assets to static res dir, add json mime type for manifest.json
- Loading branch information
1 parent
dde1b44
commit 36f3d0f
Showing
11 changed files
with
219 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// SOURCE: @geekgonecrazy https://github.com/go-shiori/shiori/pull/325 | ||
// This is the service worker with the Advanced caching | ||
|
||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'); | ||
|
||
const API_CACHE = "api"; | ||
const BOOKMARK_CACHE = "bookmarks"; | ||
const HTML_CACHE = "html"; | ||
const JS_CACHE = "javascript"; | ||
const STYLE_CACHE = "stylesheets"; | ||
const IMAGE_CACHE = "images"; | ||
const FONT_CACHE = "fonts"; | ||
|
||
self.addEventListener("message", (event) => { | ||
if (event.data && event.data.type === "SKIP_WAITING") { | ||
self.skipWaiting(); | ||
} | ||
}); | ||
|
||
workbox.routing.registerRoute( | ||
({ url, request, event }) => url.pathname === '/api/bookmarks', | ||
new workbox.strategies.NetworkFirst({ | ||
cacheName: API_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 50, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
workbox.routing.registerRoute( | ||
({ url, event }) => event.request.destination === 'document' && url.pathname.startsWith('/bookmark'), | ||
new workbox.strategies.NetworkFirst({ | ||
cacheName: BOOKMARK_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 500, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
workbox.routing.registerRoute( | ||
({ url, event }) => event.request.destination === 'document' && !url.pathname.startsWith('/bookmark'), | ||
new workbox.strategies.NetworkFirst({ | ||
cacheName: HTML_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 10, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
|
||
workbox.routing.registerRoute( | ||
({ event }) => event.request.destination === 'script', | ||
new workbox.strategies.StaleWhileRevalidate({ | ||
cacheName: JS_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 15, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
workbox.routing.registerRoute( | ||
({ event }) => event.request.destination === 'style', | ||
new workbox.strategies.StaleWhileRevalidate({ | ||
cacheName: STYLE_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 15, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
workbox.routing.registerRoute( | ||
({ event }) => event.request.destination === 'image', | ||
new workbox.strategies.StaleWhileRevalidate({ | ||
cacheName: IMAGE_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 15, | ||
}), | ||
], | ||
}) | ||
); | ||
|
||
workbox.routing.registerRoute( | ||
({ event }) => event.request.destination === 'font', | ||
new workbox.strategies.StaleWhileRevalidate({ | ||
cacheName: FONT_CACHE, | ||
plugins: [ | ||
new workbox.expiration.ExpirationPlugin({ | ||
maxEntries: 15, | ||
}), | ||
], | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"name": "Shiori", | ||
"short_name": "Shiori", | ||
"start_url": "/", | ||
"display": "standalone", | ||
"description": "Shiori is a simple bookmarks manager written in the Go language. Intended as a simple clone of Pocket. You can use it as a command line application or as a web application. This application is distributed as a single binary, which means it can be installed and used easily.", | ||
"lang": "English", | ||
"dir": "auto", | ||
"theme_color": "#000000", | ||
"background_color": "#000000", | ||
"orientation": "any", | ||
"share_target": { | ||
"action": "/share-target/", | ||
"method": "GET", | ||
"params": { | ||
"title": "title", | ||
"text": "text", | ||
"url": "url" | ||
} | ||
}, | ||
"categories": [ | ||
"productivity" | ||
], | ||
"icons": [ | ||
{ | ||
"src": "/res/apple-touch-icon-144x144.png", | ||
"type": "image/png", | ||
"sizes": "144x144" | ||
}, | ||
{ | ||
"src": "/res/apple-touch-icon-152x152.png", | ||
"type": "image/png", | ||
"sizes": "152x152" | ||
} | ||
], | ||
"screenshots": [ | ||
{ | ||
"src": "/res/09-mobile-login.png", | ||
"sizes": "1440×2960", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/res/10-mobile-home.png", | ||
"sizes": "1440×2960", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/res/11-mobile-home-list.png", | ||
"sizes": "1440×2960", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/res/12-mobile-home-options.png", | ||
"sizes": "1440×2960", | ||
"type": "image/png" | ||
} | ||
], | ||
"related_applications": [ | ||
{ | ||
"platform": "itunes", | ||
"url": "https://apps.apple.com/us/app/pocket-stay-informed/id309601447", | ||
"id": "id309601447" | ||
} | ||
], | ||
"prefer_related_applications": false, | ||
"shortcuts": [ | ||
{ | ||
"name": "Home", | ||
"url": "https://shiori.io/#home", | ||
"description": "Landing page" | ||
}, | ||
{ | ||
"name": "Login", | ||
"url": "https://shiori.io/login", | ||
"description": "Login page" | ||
}, | ||
{ | ||
"name": "Settings", | ||
"url": "https://shiori.io/#setting", | ||
"description": "Settings" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters