Skip to content

Commit 23fbe1b

Browse files
committed
move serviceworker.js
1 parent bfaef10 commit 23fbe1b

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

models/user.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,6 @@ var (
815815
"template",
816816
"user",
817817
"favicon.ico",
818-
"serviceworker.js",
819818
}
820819

821820
reservedUserPatterns = []string{"*.keys", "*.gpg"}

routers/user/profile.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,12 @@ func GetUserByParams(ctx *context.Context) *models.User {
4545
func Profile(ctx *context.Context) {
4646
uname := ctx.Params(":username")
4747

48-
// Special handle for requests `favicon.ico` and `serviceworker.js`.
48+
// Special handle for FireFox requests favicon.ico.
4949
if uname == "favicon.ico" {
5050
ctx.ServeFile(path.Join(setting.StaticRootPath, "public/img/favicon.png"))
5151
return
5252
}
5353

54-
if uname == "serviceworker.js" {
55-
ctx.ServeFile(path.Join(setting.StaticRootPath, "public/serviceworker.js"))
56-
return
57-
}
58-
5954
if strings.HasSuffix(uname, ".png") {
6055
ctx.Error(404)
6156
return

web_src/js/features/serviceworker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default async function initServiceWorker() {
3535
// the spec strictly requires it to be same-origin so it has to be AppSubUrl to work
3636
await Promise.all([
3737
checkCacheValidity(),
38-
navigator.serviceWorker.register(`${AppSubUrl}/serviceworker.js`),
38+
navigator.serviceWorker.register(`${AppSubUrl}/assets/serviceworker.js`),
3939
]);
4040
} catch (err) {
4141
console.error(err);

0 commit comments

Comments
 (0)