This commit is contained in:
42
app/views/pwa/manifest.json.erb
Normal file
42
app/views/pwa/manifest.json.erb
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "Writebook",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/app-icon-192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "/app-icon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
},
|
||||
{
|
||||
"src": "/app-icon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"scope": "/",
|
||||
"description": "Writebook is remarkably simple software that allows you to publish text and pictures in a simple, browsable online book format.",
|
||||
"categories": ["books", "business", "productivity"],
|
||||
"shortcuts": [
|
||||
{
|
||||
"name": "Create a new book",
|
||||
"description": "Open Writebook and start writing",
|
||||
"url": "/books/new",
|
||||
"icons": [{ "src": "<%= image_url("add.svg") %>", "sizes": "any" }]
|
||||
},
|
||||
{
|
||||
"name": "Open library",
|
||||
"description": "Open Writebook and see all your books",
|
||||
"url": "/books",
|
||||
"icons": [{ "src": "<%= image_url("books.svg") %>", "sizes": "any" }]
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
26
app/views/pwa/service-worker.js
Normal file
26
app/views/pwa/service-worker.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// Add a service worker for processing Web Push notifications:
|
||||
//
|
||||
// self.addEventListener("push", async (event) => {
|
||||
// const { title, options } = await event.data.json()
|
||||
// event.waitUntil(self.registration.showNotification(title, options))
|
||||
// })
|
||||
//
|
||||
// self.addEventListener("notificationclick", function(event) {
|
||||
// event.notification.close()
|
||||
// event.waitUntil(
|
||||
// clients.matchAll({ type: "window" }).then((clientList) => {
|
||||
// for (let i = 0; i < clientList.length; i++) {
|
||||
// let client = clientList[i]
|
||||
// let clientPath = (new URL(client.url)).pathname
|
||||
//
|
||||
// if (clientPath == event.notification.data.path && "focus" in client) {
|
||||
// return client.focus()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (clients.openWindow) {
|
||||
// return clients.openWindow(event.notification.data.path)
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
// })
|
||||
Reference in New Issue
Block a user