diff --git a/.dockerignore b/.dockerignore index 1ce2a87611e..2a414208890 100644 --- a/.dockerignore +++ b/.dockerignore @@ -76,7 +76,6 @@ cpu.out /yarn-error.log /npm-debug.log* /public/js -/public/serviceworker.js /public/css /public/fonts /public/img/webpack diff --git a/.gitignore b/.gitignore index ad141c30cd9..7ae3455d469 100644 --- a/.gitignore +++ b/.gitignore @@ -77,7 +77,6 @@ cpu.out /yarn-error.log /npm-debug.log* /public/js -/public/serviceworker.js /public/css /public/fonts /public/img/webpack diff --git a/.ignore b/.ignore index a315e5b5b94..cd869d51cb9 100644 --- a/.ignore +++ b/.ignore @@ -1,5 +1,6 @@ *.min.css *.min.js +/assets/*.json /modules/options/bindata.go /modules/public/bindata.go /modules/templates/bindata.go diff --git a/Makefile b/Makefile index 16841796b78..664839273b5 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ FOMANTIC_WORK_DIR := web_src/fomantic WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f) WEBPACK_CONFIGS := webpack.config.js WEBPACK_DEST := public/js/index.js public/css/index.css -WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack public/serviceworker.js +WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST)) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 01abb15c1d3..23dfefa0131 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1208,9 +1208,6 @@ LEVEL = Info ;; Whether to search within description at repository search on explore page. ;SEARCH_REPO_DESCRIPTION = true ;; -;; Whether to enable a Service Worker to cache frontend assets -;USE_SERVICE_WORKER = false -;; ;; Whether to only show relevant repos on the explore page when no keyword is specified and default sorting is used. ;; A repo is considered irrelevant if it's a fork or if it has no metadata (no description, no icon, no topic). ;ONLY_SHOW_RELEVANT_REPOS = false diff --git a/docs/content/doc/administration/config-cheat-sheet.en-us.md b/docs/content/doc/administration/config-cheat-sheet.en-us.md index 514719a99a7..e3612f37598 100644 --- a/docs/content/doc/administration/config-cheat-sheet.en-us.md +++ b/docs/content/doc/administration/config-cheat-sheet.en-us.md @@ -230,7 +230,6 @@ The following configuration set `Content-Type: application/vnd.android.package-a add it to this config. - `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used. - `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page. -- `USE_SERVICE_WORKER`: **false**: Whether to enable a Service Worker to cache frontend assets. - `ONLY_SHOW_RELEVANT_REPOS`: **false** Whether to only show relevant repos on the explore page when no keyword is specified and default sorting is used. A repo is considered irrelevant if it's a fork or if it has no metadata (no description, no icon, no topic). diff --git a/modules/setting/ui.go b/modules/setting/ui.go index aa2c64019bf..41438db40d5 100644 --- a/modules/setting/ui.go +++ b/modules/setting/ui.go @@ -32,7 +32,6 @@ var UI = struct { CustomEmojis []string CustomEmojisMap map[string]string `ini:"-"` SearchRepoDescription bool - UseServiceWorker bool OnlyShowRelevantRepos bool Notification struct { @@ -136,7 +135,6 @@ func loadUIFrom(rootCfg ConfigProvider) { UI.ShowUserEmail = sec.Key("SHOW_USER_EMAIL").MustBool(true) UI.DefaultShowFullName = sec.Key("DEFAULT_SHOW_FULL_NAME").MustBool(false) UI.SearchRepoDescription = sec.Key("SEARCH_REPO_DESCRIPTION").MustBool(true) - UI.UseServiceWorker = sec.Key("USE_SERVICE_WORKER").MustBool(false) // OnlyShowRelevantRepos=false is important for many private/enterprise instances, // because many private repositories do not have "description/topic", users just want to search by their names. diff --git a/modules/templates/helper.go b/modules/templates/helper.go index cae7452306e..2f2ef440497 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -127,9 +127,6 @@ func NewFuncMap() template.FuncMap { "MetaKeywords": func() string { return setting.UI.Meta.Keywords }, - "UseServiceWorker": func() bool { - return setting.UI.UseServiceWorker - }, "EnableTimetracking": func() bool { return setting.Service.EnableTimetracking }, diff --git a/package-lock.json b/package-lock.json index 16202670305..5e077b8a98a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,8 +51,6 @@ "vue3-calendar-heatmap": "2.0.5", "webpack": "5.84.1", "webpack-cli": "5.1.1", - "workbox-routing": "6.6.0", - "workbox-strategies": "6.6.0", "wrap-ansi": "8.1.0" }, "devDependencies": { @@ -11045,27 +11043,6 @@ "node": ">=0.10.0" } }, - "node_modules/workbox-core": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/workbox-core/-/workbox-core-6.6.0.tgz", - "integrity": "sha512-GDtFRF7Yg3DD859PMbPAYPeJyg5gJYXuBQAC+wyrWuuXgpfoOrIQIvFRZnQ7+czTIQjIr1DhLEGFzZanAT/3bQ==" - }, - "node_modules/workbox-routing": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/workbox-routing/-/workbox-routing-6.6.0.tgz", - "integrity": "sha512-x8gdN7VDBiLC03izAZRfU+WKUXJnbqt6PG9Uh0XuPRzJPpZGLKce/FkOX95dWHRpOHWLEq8RXzjW0O+POSkKvw==", - "dependencies": { - "workbox-core": "6.6.0" - } - }, - "node_modules/workbox-strategies": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/workbox-strategies/-/workbox-strategies-6.6.0.tgz", - "integrity": "sha512-eC07XGuINAKUWDnZeIPdRdVja4JQtTuc35TZ8SwMb1ztjp7Ddq2CJ4yqLvWzFWGlYI7CG/YGqaETntTxBGdKgQ==", - "dependencies": { - "workbox-core": "6.6.0" - } - }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", diff --git a/package.json b/package.json index 72563f8bf79..73ce86f333f 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,6 @@ "vue3-calendar-heatmap": "2.0.5", "webpack": "5.84.1", "webpack-cli": "5.1.1", - "workbox-routing": "6.6.0", - "workbox-strategies": "6.6.0", "wrap-ansi": "8.1.0" }, "devDependencies": { diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 670d146b56a..4e1dffa474a 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -12,7 +12,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. assetUrlPrefix: '{{AssetUrlPrefix}}', runModeIsProd: {{.RunModeIsProd}}, customEmojis: {{CustomEmojis}}, - useServiceWorker: {{UseServiceWorker}}, csrfToken: '{{.CsrfToken}}', pageData: {{.PageData}}, notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}} diff --git a/web_src/js/features/serviceworker.js b/web_src/js/features/serviceworker.js deleted file mode 100644 index 32d2e04cd67..00000000000 --- a/web_src/js/features/serviceworker.js +++ /dev/null @@ -1,57 +0,0 @@ -import {joinPaths, parseUrl} from '../utils.js'; - -const {useServiceWorker, assetUrlPrefix, assetVersionEncoded} = window.config; -const cachePrefix = 'static-cache-v'; // actual version is set in the service worker script -const workerUrl = `${joinPaths(assetUrlPrefix, 'serviceworker.js')}?v=${assetVersionEncoded}`; - -async function u