diff --git a/.eslintrc b/.eslintrc index 8f337baec5..3a731cbf6b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -48,6 +48,7 @@ rules: no-cond-assign: [2, except-parens] no-console: [1, {allow: [info, warn, error]}] no-continue: [0] + no-empty: [2, {allowEmptyCatch: true}] no-eq-null: [2] no-mixed-operators: [0] no-multi-assign: [0] diff --git a/modules/templates/dynamic.go b/modules/templates/dynamic.go index 6153e8d027..bd1c4d06c5 100644 --- a/modules/templates/dynamic.go +++ b/modules/templates/dynamic.go @@ -48,18 +48,6 @@ func JSONRenderer() macaron.Handler { }) } -// JSRenderer implements the macaron handler for serving JS templates. -func JSRenderer() macaron.Handler { - return macaron.Renderer(macaron.RenderOptions{ - Funcs: NewFuncMap(), - Directory: path.Join(setting.StaticRootPath, "templates"), - AppendDirectories: []string{ - path.Join(setting.CustomPath, "templates"), - }, - HTMLContentType: "application/javascript", - }) -} - // Mailer provides the templates required for sending notification mails. func Mailer() (*texttmpl.Template, *template.Template) { for _, funcs := range NewTextFuncMap() { diff --git a/modules/templates/static.go b/modules/templates/static.go index 5bc4e33e1c..a3aff5e567 100644 --- a/modules/templates/static.go +++ b/modules/templates/static.go @@ -132,15 +132,6 @@ func JSONRenderer() macaron.Handler { }) } -// JSRenderer implements the macaron handler for serving JS templates. -func JSRenderer() macaron.Handler { - return macaron.Renderer(macaron.RenderOptions{ - Funcs: NewFuncMap(), - TemplateFileSystem: NewTemplateFileSystem(), - HTMLContentType: "application/javascript", - }) -} - // Mailer provides the templates required for sending notification mails. func Mailer() (*texttmpl.Template, *template.Template) { for _, funcs := range NewTextFuncMap() { diff --git a/package-lock.json b/package-lock.json index 89c41721c7..6206025e08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14857,6 +14857,28 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" }, + "workbox-core": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/workbox-core/-/workbox-core-5.1.3.tgz", + "integrity": "sha512-TFSIPxxciX9sFaj0FDiohBeIKpwMcCyNduydi9i3LChItcndDS6TJpErxybv8aBWeCMraXt33TWtF6kKuIObNw==" + }, + "workbox-routing": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/workbox-routing/-/workbox-routing-5.1.3.tgz", + "integrity": "sha512-F+sAp9Iy3lVl3BEG+pzXWVq4AftzjiFpHDaZ4Kf4vLoBoKQE0hIHet4zE5DpHqYdyw+Udhp4wrfHamX6PN6z1Q==", + "requires": { + "workbox-core": "^5.1.3" + } + }, + "workbox-strategies": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/workbox-strategies/-/workbox-strategies-5.1.3.tgz", + "integrity": "sha512-wiXHfmOKnWABeIVW+/ye0e00+2CcS5y7SIj2f9zcdy2ZLEbcOf7B+yOl5OrWpBGlTUwRjIYhV++ZqiKm3Dc+8w==", + "requires": { + "workbox-core": "^5.1.3", + "workbox-routing": "^5.1.3" + } + }, "worker-farm": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", diff --git a/package.json b/package.json index 1e81ea1448..e818e7d7c3 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,8 @@ "webpack": "4.43.0", "webpack-cli": "3.3.11", "webpack-fix-style-only-entries": "0.4.0", + "workbox-routing": "5.1.3", + "workbox-strategies": "5.1.3", "worker-loader": "2.0.0" }, "devDependencies": { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 7f409eb576..d739f0b6ca 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1048,10 +1048,6 @@ func RegisterRoutes(m *macaron.Macaron) { ctx.HTML(200, "pwa/manifest_json") }) - m.Get("/serviceworker.js", templates.JSRenderer(), func(ctx *context.Context) { - ctx.HTML(200, "pwa/serviceworker_js") - }) - // prometheus metrics endpoint if setting.Metrics.Enabled { c := metrics.NewCollector() diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 8e58c07d23..a6a715531d 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -6,30 +6,6 @@