diff --git a/.eslintrc b/.eslintrc index 8f337baec597..3a731cbf6b02 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 6153e8d02733..bd1c4d06c586 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 5bc4e33e1c93..a3aff5e567bd 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 71183fed4335..2f1c58073607 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14852,6 +14852,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 7fb8246af299..ce14631d704e 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,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 7f409eb576f4..d739f0b6ca5d 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 eae238923820..0234d2e297a6 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -6,30 +6,6 @@ {{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} - {{if UseServiceWorker}} - - {{else}} - - {{end}} @@ -84,8 +60,10 @@