1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 12:59:11 -05:00
forgejo/modules/setting/ui.go

167 lines
5 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"
"code.gitea.io/gitea/modules/log"
)
// 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
ExploreDefaultSort string `ini:"EXPLORE_PAGING_DEFAULT_SORT"`
PreferredTimestampTense string
AmbiguousUnicodeDetection bool
SkipEscapeContexts []string
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) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/1582 (cherry picked from commit 209059fbaf6d034b1bb34ae7add0be0269de7042) (cherry picked from commit 80ba2df4a733d84fe0c9ad60d3638e465ccfedac) (cherry picked from commit 17b325da23b1896b6acd95c0b149a9ec20813cc1) (cherry picked from commit 3518b87c8de21590700060e5222feccc7c54cb58) (cherry picked from commit 4042143f968cd86a9fd9d84565013fd9f8bd160f) (cherry picked from commit 07f976f9d78a817371c3f72244428e49a167be8b) (cherry picked from commit 1bbc6b93e966b13f077e58b3447605eea60cb67e) (cherry picked from commit 8aa0bba307c45994b69a4790f977e3cdaeb32d70) (cherry picked from commit 94c4a14ac30fe92c13e672538ccfb56d409d2f2f) Update Forgejo theme (squash) - Incorporate changes from 79a4c80f8d81e67371f6ff1f8d55bd003ab01208 into the Forgejo themes. - Fix that there's no focus or active coloring on primary and secondary buttons for Forgejo themes caused by 023e937141dd891bce3370c869d4db2c60f971ed that moved variablse from base.css (shared) to the themes. - Extend hack to make red buttons darker on dark Forgejo theme to include active styling and remove the unnecessary `!important`. (cherry picked from commit 2e32da4419e2cbb6cc7d2cab65b03e14fdb75db6) (cherry picked from commit a4eca09543e52342210596a58fcd68d4177a08d5) (cherry picked from commit e6e452811d8104d6a824aa0e220d80b61dd3c74d) (cherry picked from commit e9a5addf3daf56c1fec8daf0551463d9ac337534) (cherry picked from commit a1b8b5fa0d05c95ccb0a0b54ac6fb13bafaa3d12) [BRANDING] Update forgejo theme - Inlcude a103b79f60948fa8ee44f95304716f3d354a8c15 and 1b2cd4c4e19c78390be329b4a3ad50ff8857ca8d and 376c0e25f74c967242b860a740fb4d509bae7ee9 and 023e937141dd891bce3370c869d4db2c60f971ed into the Forgejo theme. - Fix tooltips not being visual, due to missing background color. - Fix labels not having a background color. - Fix modals not having a dimmed background. - Fix no syntax highlighting on Forgejo light due to missing imports. - Incorporate feedback from https://codeberg.org/forgejo/forgejo/issues/1117 to make the labels stand out less. (cherry picked from commit bc21dc21e1a375160e97eb1d2023d095d9067ef5) (cherry picked from commit 82323c09cc9439e723618e38104d6b705f94aad9) (cherry picked from commit 2da09af28dc91996bd261e008f30bd2b9d0d5a85) (cherry picked from commit 978aeb7cde02738ea245d4d12d21d6376bce58cf) (cherry picked from commit 984c264e19dc9497db67139019bf749591bd8447) (cherry picked from commit 6aa7c8db38627394ad71589e4671554a30d96d39) (cherry picked from commit 4379269a46b8fcd9885dd2ddba574375b46519dd) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/2116 (cherry picked from commit 9414391ec1e37978615e27d304a12957c9adffb4) (cherry picked from commit 02c9b776e851f5893a6fdbc6e29402be793d8582) (cherry picked from commit 7324b417ce5f7199901b4beb0d715d9b190e7b43) (cherry picked from commit b20aa3ed1742ac1c883bb2d4d155c99140c956e5)
2022-12-25 06:44:04 -05:00
DefaultTheme: `forgejo-auto`,
Themes: []string{`forgejo-auto`, `forgejo-light`, `forgejo-dark`, `gitea-auto`, `gitea-light`, `gitea-dark`, `forgejo-auto-deuteranopia-protanopia`, `forgejo-light-deuteranopia-protanopia`, `forgejo-dark-deuteranopia-protanopia`, `forgejo-auto-tritanopia`, `forgejo-light-tritanopia`, `forgejo-dark-tritanopia`},
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 72712f467df8de65955f15457c5845b80c2925e1) (cherry picked from commit b49b832899b24efc73bbe7f1d7ed3626e5b55434) (cherry picked from commit a985bb8b902ddcc98d24e6f3078b1e1fee61a1c7) (cherry picked from commit dac4d692182eb96701c46451f6d5a22966494583) (cherry picked from commit 4962eb361dea6528b6d36d29e1c27d8e76351ec9) (cherry picked from commit 61835639c8134b017ee8cf1816315c1536eeedcc) (cherry picked from commit f4e44e3b602bda4c11150bea1e0e56f75f751398) (cherry picked from commit 65c5f553c1cd9890de0eae416820dae84ad412a6) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/1976 (cherry picked from commit ef2f0c1c4a00e23579829ee874f80af2a9423c39) (cherry picked from commit 4c208ef65e9dd65c772d981f165305f2ebd436b2) (cherry picked from commit 3386a9d6ee8ea4e42faa3d9f1879de66f7f44d39) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/2116 (cherry picked from commit 8f93b38c6636e85151d79647050e8731f0cb07a9) (cherry picked from commit af49467e83c073de9d8613facfc833d0912945ef) (cherry picked from commit edef259a3863128359e826e73901bae149e30c28) (cherry picked from commit a46b5bbf389e42cba0b49446302959ddd92922da)
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:"},
PreferredTimestampTense: "mixed",
AmbiguousUnicodeDetection: true,
SkipEscapeContexts: []string{},
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 94b1b902053922ec73213f9c20f1a37a292959b8) (cherry picked from commit cd3565dbed2c86ef9c2d5e6b92931481b17e62c9) (cherry picked from commit 5d02758b22717ec93b9bf36af6d09bc66925e6a8) (cherry picked from commit 5901edd1114dc7a0a1f4d943bd3ba645ab4d0d22) (cherry picked from commit 8a3abe6dafafd5a8a05b3b37551082ce2a948b90) (cherry picked from commit eaa1a3e6ca6a4c178944e6d25a0819478c60d96d) (cherry picked from commit 7191d0abc48c464cafba209a1a5c3b762a4918d8) (cherry picked from commit 579b985d791182c20754293151b8829d95837ae9) (cherry picked from commit 16d7dbed870b69cf2e09c19fb16ad9cea0cce76a) (cherry picked from commit c1fa9edc159596e470daf28571e356295695396d) (cherry picked from commit cdcf37ff1b726b9f3e240935c19dc30160b47eba) (cherry picked from commit b0c78efb8656006239c22f330a63341ac99eb783) (cherry picked from commit dca8fb6cf7f8066bc30ab4df8eb277f3b6d7ef53) (cherry picked from commit 4d08cf9f2e48b1c5dfe88f3c596c7d305f2e2194) (cherry picked from commit 73be848222608347293e2b9487ae959c2adb077c)
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)
if UI.PreferredTimestampTense != "mixed" && UI.PreferredTimestampTense != "absolute" {
log.Fatal("ui.PREFERRED_TIMESTAMP_TENSE must be either 'mixed' or 'absolute'")
}
// 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 + ":"
}
}