Skip to content

Commit

Permalink
[template/head] fix the escaping of the service worker url
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
  • Loading branch information
das7pad committed Aug 19, 2019
1 parent 67fb97c commit 9b47cb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func NewFuncMap() []template.FuncMap {
"StaticUrlPrefix": func() string {
return setting.StaticURLPrefix
},
"ServiceworkerURL": func() string {
return setting.StaticURLPrefix + "/serviceworker.js"
},
"AppUrl": func() string {
return setting.AppURL
},
Expand Down
2 changes: 1 addition & 1 deletion templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('{{StaticUrlPrefix}}/serviceworker.js').then(function(registration) {
navigator.serviceWorker.register({{ServiceworkerURL}}).then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
Expand Down

0 comments on commit 9b47cb7

Please sign in to comment.