Skip to content

Commit

Permalink
maskable pwa icon
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Feb 22, 2025
1 parent 0cc2379 commit 39e880a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Binary file added html/files/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions html/files/manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
"display": "standalone",
"icons": [
{
"src": "/reminder.png",
"src": "/icon-192.png",
"type": "image/png",
"sizes": "300x300",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "/reminder.png",
"type": "image/png",
"sizes": "300x300"
}
]
}
9 changes: 4 additions & 5 deletions html/files/reminder.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
var GHPATH = '/';
var APP_PREFIX = 'reminder_';
var VERSION = 'version_001';
var URLS = [
`${GHPATH}/`,
`${GHPATH}/index.html`,
`${GHPATH}/reminder.png`,
`${GHPATH}/reminder.js`
`/`,
`/index.html`,
`/reminder.png`,
`/reminder.js`
]

var CACHE_NAME = APP_PREFIX + VERSION
Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func main() {
njson := files.Get("names.json")
hjson := files.Get("hadith.json")

ico := files.Get("icon-192.png")
png := files.Get("reminder.png")
js := files.Get("reminder.js")
mfs := files.Get("manifest.webmanifest")
Expand All @@ -233,11 +234,16 @@ func main() {
w.Write([]byte(mfs))
})

http.HandleFunc("/icon-192.png", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(ico))
})

http.HandleFunc("/reminder.png", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(png))
})

http.HandleFunc("/reminder.js", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/javascript")
w.Write([]byte(js))
})

Expand Down

0 comments on commit 39e880a

Please sign in to comment.