1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 13:19:37 -05:00
forgejo/modules/setting/ui.go

152 lines
4.2 KiB
Go
Raw Normal View History

// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package setting
import (
"time"
"code.gitea.io/gitea/modules/container"
)
// UI settings
var UI = struct {
ExplorePagingNum int
SitemapPagingNum int
IssuePagingNum int
RepoSearchPagingNum int
MembersPagingNum int
FeedMaxCommitNum int
FeedPagingNum int
PackagesPagingNum int
GraphMaxCommitNum int
CodeCommentLines int
ReactionMaxUserNum int
MaxDisplayFileSize int64
ShowUserEmail bool
DefaultShowFullName bool
DefaultTheme string
Themes []string
Reactions []string
ReactionsLookup container.Set[string] `ini:"-"`
CustomEmojis []string
CustomEmojisMap map[string]string `ini:"-"`
SearchRepoDescription bool
OnlyShowRelevantRepos bool
Notification struct {
MinTimeout time.Duration
TimeoutStep time.Duration
MaxTimeout time.Duration
EventSourceUpdateTime time.Duration
} `ini:"ui.notification"`
SVG struct {
Enabled bool `ini:"ENABLE_RENDER"`
} `ini:"ui.svg"`
CSV struct {
MaxFileSize int64
} `ini:"ui.csv"`
Admin struct {
UserPagingNum int
RepoPagingNum int
NoticePagingNum int
OrgPagingNum int
} `ini:"ui.admin"`
User struct {
RepoPagingNum int
} `ini:"ui.user"`
Meta struct {
Author string
Description string
Keywords string
} `ini:"ui.meta"`
}{
ExplorePagingNum: 20,
SitemapPagingNum: 20,
IssuePagingNum: 20,
RepoSearchPagingNum: 20,
MembersPagingNum: 20,
FeedMaxCommitNum: 5,
FeedPagingNum: 20,
PackagesPagingNum: 20,
GraphMaxCommitNum: 100,
CodeCommentLines: 4,
ReactionMaxUserNum: 10,
MaxDisplayFileSize: 8388608,
[BRANDING] Add Forgejo light, dark, and auto themes (cherry picked from commit faab0c670e22588bc643d71b650560c2ccca2c8e) (cherry picked from commit b6d59493c7fa0bfa62095abb99c5c5a29bcf1659) (cherry picked from commit 837da0c1f41b40853eb4aebc40af16433cf7a9c2) (cherry picked from commit 71ad245e1d6f7f5b002c1c5e9831e872d157f906) (cherry picked from commit 85a7032f1b1c0d80e3d3960e9d902e9e66e687a5) Conflicts: web_src/css/themes/theme-forgejo-auto.less web_src/css/themes/theme-forgejo-dark.less web_src/css/themes/theme-forgejo-light.less web_src/less/_home.less see https://codeberg.org/forgejo/forgejo/pulls/552 (cherry picked from commit 0c2c131bb06024fca7d5c8ef6a2696d5f6aa4a1b) [BRANDING] Add Forgejo light, dark, and auto themes: fix import Closes: https://codeberg.org/forgejo/forgejo/issues/562 (cherry picked from commit 2b0dc1f80ff18d1c94df74c77a80e3651e7cb2ed) (cherry picked from commit 494ad6a3b7cd3328c835e6c7c76a55a77d47a60d) (cherry picked from commit 6940fc22c4917e86b25cf3c6c2ead9057ae726d4) (cherry picked from commit bd6f00656c457339ef3d08612911594358a15f14) (cherry picked from commit ebb506a1247751b1182348b281089dc00a65c741) (cherry picked from commit 43d72d37811c8b9d00b1d046341401643f66b289) (cherry picked from commit 1a87adca018545f6d2db0dad9e5d7cb59f6a97b8) (cherry picked from commit 0704c410b4e8a0b610e82f6ebe9209fb485ee722) (cherry picked from commit 9039b47c160e7fce2bd75167a0358eb7e7458e2d) (cherry picked from commit e32bb7892481a80156163dbf5063da0c8ead27d4) (cherry picked from commit 053ad84f91f994f96f4d9d037ff37e25b468c424) (cherry picked from commit a35f1b6da7a061a3d0717548d8f4e0972e7bb0ec) (cherry picked from commit 8cb94c01d5bcd453938924ce6c6a6804ce9ec255) [BRANDING] fix invisible label in branch protection settings (cherry picked from commit 23e5d457219a68f49938395b5532231ce4ac0022) (cherry picked from commit f02e4582e51a6a2eba93ddd599b7ea3679388e55) [BRANDING] Fix commit label for Forgejo Dark theme (#843) - Define the `--color-label-text` variable with a light color, which is currently used for commit's SHA Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/843 (cherry picked from commit 74c186a3806e37fcca8087ad79ba7c1f8e0d559e) (cherry picked from commit 7e185c5ca5298fad12fcc78b504d96163e71ad71) [BRANDING] Add Forgejo light, dark, and auto themes (squash) variables Adapt to b6bcb79987ae3c9095fe2b2c7c0a3e4b42cdebba Improve notification icon and navbar Refs: https://codeberg.org/forgejo/forgejo/issues/893 [BRANDING] Add Forgejo light variables Updates the Forgejo light theme with the changes in b6bcb7998 These are the same changes as made in 2574dbcff to the dark theme Refs: forgejo/forgejo#893 (cherry picked from commit 9e99fe4f9ec79aebbf34490e12b0acf3097dd5c7) (cherry picked from commit acbb98bd912fc3a28d464eaef1d756f54fd87e8e) (cherry picked from commit c80245ed87d09067d880d6f91c3edaa35e4346de) [BRANDING] fix code highlight color in Forgejo themes (cherry picked from commit ffc49a4e992162a480d5056e1211fc7496e4aa06) (cherry picked from commit c5f45a941e3dd8882164a88b2653407fedf6dea0) (cherry picked from commit eee5427c9d581b8e2cd254d4a15508200622aef0) (cherry picked from commit 89be50ca27a7ad33f109bbc3549220b37875206a) (cherry picked from commit 74e4776ef504870d9831818ee141b12afd5f46ab) (cherry picked from commit 6c4e07a6a718c375ee2d3975ea7bb01d382d1d90) [BRANDING] more accessible text selection color in Forgejo themes (cherry picked from commit 7407605ffdedef8fa320477a3bd7efa06df263e2) (cherry picked from commit 5aab3872cc5bd267bc16bfbcedef66fd03616488) (cherry picked from commit 1ec77d8bd00bc6914d0926d98d503debe41cc6fd) (cherry picked from commit 964c89fce7bb5b4be06d4cd1cac247426061ec2e) (cherry picked from commit 8a8023a4414e27d28f4503e2d2fb12afc4b7aac6) (cherry picked from commit 1c9ffeadf5ce419d576afc89faff9fdd6c1b5478) [BRANDING] Fix navigation hover color (squash) - For items in the navigation bar, use different background colours for hover. - Regression since https://github.com/go-gitea/gitea/pull/25343 (cherry picked from commit 8f3f4b219c449011a810c6a9f946fe216d841778) (cherry picked from commit edfb0eef06e798009389b12b2c0a417c4c845887) (cherry picked from commit a6367fa48a2d10465b5d00aa6fb3db886f3c238f) (cherry picked from commit d5697abe4257390a687102d0964fee15f9214b73) (cherry picked from commit eaf537091997650d9370457b7eb53205a552d267) (cherry picked from commit 58f11e7310dfec6fc6f195aa36e465c846a431c5) (cherry picked from commit 732e1b35d58e1ac5307b80819bd788ac8dc9b71f) (cherry picked from commit 0d794ae1c91fa926d1ddac5eb7b1bc27a9271793) (cherry picked from commit ccc8aed308253aaf7aa81f49d3a8025cf759cfce) (cherry picked from commit f3be4a75ebf2f2641931bde29207e2714c02491d) (cherry picked from commit e7fdff35997434bdc159b4050bd2c0306ee7fede) (cherry picked from commit bb2f3c9664beae02590cbcb47dfa4bcc9f4b4b80) (cherry picked from commit edb8b4d8a6678d4d6793d69681f78583aec74fd5) (cherry picked from commit 3bfeaec5fc28cb0706b336d46524daefd958bcb4) (cherry picked from commit b1bb9627888632c1b1ebc65dde8ad715ea8cd1ff)
2022-12-25 06:44:04 -05:00
DefaultTheme: `forgejo-auto`,
Themes: []string{`forgejo-auto`, `forgejo-light`, `forgejo-dark`, `auto`, `gitea`, `arc-green`},
Reactions: []string{`+1`, `-1`, `laugh`, `hooray`, `confused`, `heart`, `rocket`, `eyes`},
[BRANDING] Add `forgejo` emoji (cherry picked from commit ade55ad308ea0ac6bb36903e3a69b02d18228adb) (cherry picked from commit 107f7266183584b51299351961b73ab2b185f24b) (cherry picked from commit f29cf9cfc107692cd79a4ba4062a66f90813bc4e) (cherry picked from commit 0761a41eee30a32c822834ca2b989ad6343ed1e0) (cherry picked from commit 2b1fd9565f615dde8bdd07d86ff3a5ca3815af67) (cherry picked from commit 6a7c82f13b17df1fa647130d086fbcdbeb086571) (cherry picked from commit 4a56d404942562e3f5a45abd45518bc8679109b6) (cherry picked from commit b48e3e896d0d3942362b5a1c18f847ffd64609cb) (cherry picked from commit bde83340cbcce8370d524da9c909731c78544c49) (cherry picked from commit 74e0603d6be22d8d74d38f9c99c8bcf26dd83482) (cherry picked from commit 84bd1ddc082aa55a7d7c03eeac55478f0e15e019) (cherry picked from commit 62d9acde2a0692f46257dc3db329e0196b74837a) (cherry picked from commit 5b84a909135a4d71c778a2d0719a20ff01abef64) (cherry picked from commit 5362f7d053f4e8bd6a91d93ddbcb6d291a250efe) (cherry picked from commit 65ad7d1bd9875b6dd00f3ef31bc1d5ef2b9e84f5) (cherry picked from commit 6e42d545a97ef7d470b57f6ae43ae15fa1581a37) (cherry picked from commit 24d3bb33e2031a44c535602a7a083194acacbff1) (cherry picked from commit 704935cadd997dcc1dea5e51a089ed25ec1ccab1) (cherry picked from commit 5d9fc59e17c9be563432376c3b7d1851300ccdac) (cherry picked from commit 4c95df3f86f9e778a9d1267cdca22c4ce15ffb94) (cherry picked from commit 1ac704762ac78ba2a86a787f02de45779d765673) (cherry picked from commit 0da9fb13189b0bff21a734c0f635ec196731a91f) (cherry picked from commit bc2de51eeffea7fb4c5b53e7a72cab315af8215a) (cherry picked from commit ea897a20b91e89be48570ca923dcbea1b4baf81e) (cherry picked from commit 66f3f9c6effd19ca6762437e7756bd3ac564a6f3) (cherry picked from commit edc5c3c3043867ea01b93f50ca83014592ef89b6) (cherry picked from commit 11dd4f31a49b5448d4207c928df6be647adf5ce0) (cherry picked from commit bf0fb77afb91dfff7ba81a59bbf5506a6b0a6462) (cherry picked from commit 3a823b1001817b906c31453ff86d43ebe6bf9719) (cherry picked from commit e1f6cb4ed607f17da4bedf36fe60af9d4a492089) (cherry picked from commit 0b3f45972ff338a00ca084b1c3371714fc1b7011) (cherry picked from commit a9579c967946436338e44d323db2303f108dbf69) (cherry picked from commit 0dea1aadf25e120ee1f19ffa6f15caa285ad3c7b) (cherry picked from commit aeed23b96ee384054068633cb3bae71893d9382c) (cherry picked from commit 31aa43a8bc14b47963ff1e3f7b1ca8da54ca17c3) (cherry picked from commit 676cd339af1072b3c7b58a035e9f18762211957f) (cherry picked from commit beff769f0ae952897f8164cfa2689d073ff5b35e) (cherry picked from commit 366b3301ae624daaab1579d8af9d6b07eb0ff6bb) (cherry picked from commit 641dd94cbc3cc02407bb6b7b91a01448addd90e6)
2022-12-19 05:05:51 -05:00
CustomEmojis: []string{`git`, `gitea`, `codeberg`, `gitlab`, `github`, `gogs`, `forgejo`},
CustomEmojisMap: map[string]string{"git": ":git:", "gitea": ":gitea:", "codeberg": ":codeberg:", "gitlab": ":gitlab:", "github": ":github:", "gogs": ":gogs:", "forgejo": ":forgejo:"},
Notification: struct {
MinTimeout time.Duration
TimeoutStep time.Duration
MaxTimeout time.Duration
EventSourceUpdateTime time.Duration
}{
MinTimeout: 10 * time.Second,
TimeoutStep: 10 * time.Second,
MaxTimeout: 60 * time.Second,
EventSourceUpdateTime: 10 * time.Second,
},
SVG: struct {
Enabled bool `ini:"ENABLE_RENDER"`
}{
Enabled: true,
},
CSV: struct {
MaxFileSize int64
}{
MaxFileSize: 524288,
},
Admin: struct {
UserPagingNum int
RepoPagingNum int
NoticePagingNum int
OrgPagingNum int
}{
UserPagingNum: 50,
RepoPagingNum: 50,
NoticePagingNum: 25,
OrgPagingNum: 50,
},
User: struct {
RepoPagingNum int
}{
RepoPagingNum: 15,
},
Meta: struct {
Author string
Description string
Keywords string
}{
[BRANDING] Rebrand default meta tags (cherry picked from commit b1a792b63547df1471a125c2384a9623ffae409e) (cherry picked from commit ba71acccdb8eb4d1c87b50708fe3b03a3324dd9c) (cherry picked from commit ef58efb8e0c48a782e01aac8d754e70b7611a2c8) (cherry picked from commit 6a1b08241ebb862bdd39c708852e3e23c4d96c9d) (cherry picked from commit 132c7a3a07d5a11b9b165295ef12111ce74aea70) (cherry picked from commit a1f07975d67ceccedc808ddaf657f8e7e0da74b1) (cherry picked from commit f3793598b24d00ca3ae80dbde4ef9909b298ca03) (cherry picked from commit 60f38116afc60b055c6b40be8a1e94f646252bf6) (cherry picked from commit 88884cf2833429749b9a6ec6110b4c4727304903) (cherry picked from commit 520de41aefa6c1f5c939b2345878697094962812) (cherry picked from commit cfd5e5b95ab081d10d4f5d6022d09db4877f51fc) (cherry picked from commit 5cf1738f0a08d99aba2016100f3f0083b51efcf4) (cherry picked from commit b95f9b3142089d90df93708638b2ae6c857dbc87) (cherry picked from commit 0118fba9703a1e3f9da6c7b5c479b8b919a5f5e2) (cherry picked from commit ef213ec79d8d0ae006bfda0b9e49d2da2be47ca3) (cherry picked from commit f6794f694b9fb262c66f8d3958dd5145c7ef0dbb) (cherry picked from commit 639110c03bc2d2f91fb6a5c619f1138a0522f836) (cherry picked from commit 2be6eca1e1c8488bdc9e6ce164dbd9f3d79771ce) (cherry picked from commit eb929d0d566b3dff8454e62ff9f2384a896fb549) (cherry picked from commit c49dd4ed7f771e8fa1573add6cbadc193a473ead) (cherry picked from commit 8ea074c4ddaa737c4faa83c1b4746dbd7cb84440) (cherry picked from commit 3145df43d60593700b60409a8d5ac12e4fbbc197) (cherry picked from commit d0df3e306a4f0a4f773c7cbc1409922fe69973aa) (cherry picked from commit 8f4850705eb4e016ebebc738f629bcc9ce87ca61) (cherry picked from commit 5a24d4319cf7ac2e56b9e43e4181b066d76d6d8d) (cherry picked from commit 756c04c6c46a55852089711f7859f533b85fd042) (cherry picked from commit ea627e79e36d0bc7514b28e6b7d5847b5bdf5922) (cherry picked from commit c52b141902ef0be06c100f4a1285f28419e6f497) (cherry picked from commit 49ab0c55597dc12a50be39a2bd35cb870ba8e361) (cherry picked from commit f14f26c940abd341ae6bd8e20e93bd736e907b52) (cherry picked from commit 4caebbb6becb26732f4d72d3e73a71ea821edf8f) (cherry picked from commit 7c3d0bca9e8868529e4496b6b17fbe1c0736c425) (cherry picked from commit 171a207006f82d5dfed4abb9c957a837a8aa53ba) (cherry picked from commit 2a4a7d05fbcc67f603f81c5a4adab016dccf7460) (cherry picked from commit bf19c35f846d2004aca20c837e47a688a228091b) (cherry picked from commit bff760c91aed97d60bd4f939b1e657c06aecdce7) (cherry picked from commit ab648f7b678f492597b21eceecd1504d3f1bc900) (cherry picked from commit 0e3bd4b4ab4215a02202840450fc75fae822e0a6) (cherry picked from commit f75b95c2f6ecc2e269edf1ff2878ccd9d7308ccc)
2022-12-28 05:28:39 -05:00
Author: "Forgejo Beyond coding. We forge.",
Description: "Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.",
Keywords: "git,forge,forgejo",
},
}
func loadUIFrom(rootCfg ConfigProvider) {
mustMapSetting(rootCfg, "ui", &UI)
sec := rootCfg.Section("ui")
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)
// 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.
UI.OnlyShowRelevantRepos = sec.Key("ONLY_SHOW_RELEVANT_REPOS").MustBool(false)
UI.ReactionsLookup = make(container.Set[string])
for _, reaction := range UI.Reactions {
UI.ReactionsLookup.Add(reaction)
}
UI.CustomEmojisMap = make(map[string]string)
for _, emoji := range UI.CustomEmojis {
UI.CustomEmojisMap[emoji] = ":" + emoji + ":"
}
}