aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/site/main.go5
-rwxr-xr-xstatic/js/sw.js (renamed from static/js/pwabuilder-sw.js)0
-rw-r--r--templates/base.html4
3 files changed, 5 insertions, 4 deletions
diff --git a/cmd/site/main.go b/cmd/site/main.go
index 4295e8a..e9b4d21 100644
--- a/cmd/site/main.go
+++ b/cmd/site/main.go
@@ -17,7 +17,7 @@ import (
"github.com/gorilla/feeds"
blackfriday "github.com/russross/blackfriday"
"github.com/tj/front"
- "gopkg.in/segmentio/analytics-go.v3"
+ analytics "gopkg.in/segmentio/analytics-go.v3"
)
var port = os.Getenv("PORT")
@@ -191,6 +191,9 @@ func Build() (*Site, error) {
s.mux.HandleFunc("/blog/", s.showPost)
s.mux.Handle("/css/", http.FileServer(http.Dir(".")))
s.mux.Handle("/static/", http.FileServer(http.Dir(".")))
+ s.mux.HandleFunc("/sw.js", func(w http.ResponseWriter, r *http.Request) {
+ http.ServeFile(w, r, "./static/js/sw.js")
+ })
return s, nil
}
diff --git a/static/js/pwabuilder-sw.js b/static/js/sw.js
index 4b3b1e2..4b3b1e2 100755
--- a/static/js/pwabuilder-sw.js
+++ b/static/js/sw.js
diff --git a/templates/base.html b/templates/base.html
index 4bdea31..c00bc1e 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -66,9 +66,7 @@
if (navigator.serviceWorker.controller) {
console.log("Active service worker found, no need to register");
} else {
- navigator.serviceWorker.register("/static/js/pwabuilder-sw.js", {
- scope: "https://christine.website/"
- }).then(function(reg) {
+ navigator.serviceWorker.register("/sw.js").then(function(reg) {
console.log("Service worker has been registered for scope:" + reg.scope);
});
}