diff options
author | a1012112796 <1012112796@qq.com> | 2021-04-28 20:35:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 12:35:06 +0000 |
commit | 1e877613bf941ae9bed17e5b6c5b118bd3107777 (patch) | |
tree | e6b34d3244a869dbde02e5194deab29d3d511328 /models | |
parent | cc7d118b126cf451b1f3f9df72eb2f2e091d7ebc (diff) | |
download | gitea-1e877613bf941ae9bed17e5b6c5b118bd3107777.tar.gz gitea-1e877613bf941ae9bed17e5b6c5b118bd3107777.zip |
add `/assets` as root dir of public files (#15219)
* add `/assets` as root dir of public files
Signed-off-by: a1012112796 <1012112796@qq.com>
* move serviceworker.js
* make fmt
* fix some link
* fix test
* Apply suggestions from code review
Co-authored-by: silverwind <me@silverwind.io>
* Apply suggestions from code review
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r-- | models/avatar.go | 2 | ||||
-rw-r--r-- | models/avatar_test.go | 2 | ||||
-rw-r--r-- | models/oauth2.go | 26 | ||||
-rw-r--r-- | models/user.go | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/models/avatar.go b/models/avatar.go index de416a1dba..4f02fe5089 100644 --- a/models/avatar.go +++ b/models/avatar.go @@ -32,7 +32,7 @@ func DefaultAvatarLink() string { return "" } - u.Path = path.Join(u.Path, "/img/avatar_default.png") + u.Path = path.Join(u.Path, "/assets/img/avatar_default.png") return u.String() } diff --git a/models/avatar_test.go b/models/avatar_test.go index 89540705a0..bf99897d88 100644 --- a/models/avatar_test.go +++ b/models/avatar_test.go @@ -41,7 +41,7 @@ func TestHashEmail(t *testing.T) { func TestSizedAvatarLink(t *testing.T) { disableGravatar() - assert.Equal(t, "/suburl/img/avatar_default.png", + assert.Equal(t, "/suburl/assets/img/avatar_default.png", SizedAvatarLink("gitea@example.com", 100)) enableGravatar(t) diff --git a/models/oauth2.go b/models/oauth2.go index 83e2e8c43f..cc9de74f84 100644 --- a/models/oauth2.go +++ b/models/oauth2.go @@ -23,11 +23,11 @@ type OAuth2Provider struct { // key is used to map the OAuth2Provider with the goth provider type (also in LoginSource.OAuth2Config.Provider) // value is used to store display data var OAuth2Providers = map[string]OAuth2Provider{ - "bitbucket": {Name: "bitbucket", DisplayName: "Bitbucket", Image: "/img/auth/bitbucket.png"}, - "dropbox": {Name: "dropbox", DisplayName: "Dropbox", Image: "/img/auth/dropbox.png"}, - "facebook": {Name: "facebook", DisplayName: "Facebook", Image: "/img/auth/facebook.png"}, + "bitbucket": {Name: "bitbucket", DisplayName: "Bitbucket", Image: "/assets/img/auth/bitbucket.png"}, + "dropbox": {Name: "dropbox", DisplayName: "Dropbox", Image: "/assets/img/auth/dropbox.png"}, + "facebook": {Name: "facebook", DisplayName: "Facebook", Image: "/assets/img/auth/facebook.png"}, "github": { - Name: "github", DisplayName: "GitHub", Image: "/img/auth/github.png", + Name: "github", DisplayName: "GitHub", Image: "/assets/img/auth/github.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("github"), AuthURL: oauth2.GetDefaultAuthURL("github"), @@ -36,19 +36,19 @@ var OAuth2Providers = map[string]OAuth2Provider{ }, }, "gitlab": { - Name: "gitlab", DisplayName: "GitLab", Image: "/img/auth/gitlab.png", + Name: "gitlab", DisplayName: "GitLab", Image: "/assets/img/auth/gitlab.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("gitlab"), AuthURL: oauth2.GetDefaultAuthURL("gitlab"), ProfileURL: oauth2.GetDefaultProfileURL("gitlab"), }, }, - "gplus": {Name: "gplus", DisplayName: "Google", Image: "/img/auth/google.png"}, - "openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.svg"}, - "twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"}, - "discord": {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"}, + "gplus": {Name: "gplus", DisplayName: "Google", Image: "/assets/img/auth/google.png"}, + "openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/assets/img/auth/openid_connect.svg"}, + "twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/assets/img/auth/twitter.png"}, + "discord": {Name: "discord", DisplayName: "Discord", Image: "/assets/img/auth/discord.png"}, "gitea": { - Name: "gitea", DisplayName: "Gitea", Image: "/img/auth/gitea.png", + Name: "gitea", DisplayName: "Gitea", Image: "/assets/img/auth/gitea.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("gitea"), AuthURL: oauth2.GetDefaultAuthURL("gitea"), @@ -56,16 +56,16 @@ var OAuth2Providers = map[string]OAuth2Provider{ }, }, "nextcloud": { - Name: "nextcloud", DisplayName: "Nextcloud", Image: "/img/auth/nextcloud.png", + Name: "nextcloud", DisplayName: "Nextcloud", Image: "/assets/img/auth/nextcloud.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("nextcloud"), AuthURL: oauth2.GetDefaultAuthURL("nextcloud"), ProfileURL: oauth2.GetDefaultProfileURL("nextcloud"), }, }, - "yandex": {Name: "yandex", DisplayName: "Yandex", Image: "/img/auth/yandex.png"}, + "yandex": {Name: "yandex", DisplayName: "Yandex", Image: "/assets/img/auth/yandex.png"}, "mastodon": { - Name: "mastodon", DisplayName: "Mastodon", Image: "/img/auth/mastodon.png", + Name: "mastodon", DisplayName: "Mastodon", Image: "/assets/img/auth/mastodon.png", CustomURLMapping: &oauth2.CustomURLMapping{ AuthURL: oauth2.GetDefaultAuthURL("mastodon"), }, diff --git a/models/user.go b/models/user.go index 53a8ac3486..6665782d35 100644 --- a/models/user.go +++ b/models/user.go @@ -25,7 +25,6 @@ import ( "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/public" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/structs" @@ -772,7 +771,7 @@ func (u *User) IsGhost() bool { } var ( - reservedUsernames = append([]string{ + reservedUsernames = []string{ ".", "..", ".well-known", @@ -807,7 +806,8 @@ var ( "stars", "template", "user", - }, public.KnownPublicEntries...) + "favicon.ico", + } reservedUserPatterns = []string{"*.keys", "*.gpg"} ) |