7324b417ce
(cherry picked from commitfaab0c670e
) (cherry picked from commitb6d59493c7
) (cherry picked from commit837da0c1f4
) (cherry picked from commit71ad245e1d
) (cherry picked from commit85a7032f1b
) 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 commit0c2c131bb0
) [BRANDING] Add Forgejo light, dark, and auto themes: fix import Closes: https://codeberg.org/forgejo/forgejo/issues/562 (cherry picked from commit2b0dc1f80f
) (cherry picked from commit494ad6a3b7
) (cherry picked from commit6940fc22c4
) (cherry picked from commitbd6f00656c
) (cherry picked from commitebb506a124
) (cherry picked from commit43d72d3781
) (cherry picked from commit1a87adca01
) (cherry picked from commit0704c410b4
) (cherry picked from commit9039b47c16
) (cherry picked from commite32bb78924
) (cherry picked from commit053ad84f91
) (cherry picked from commita35f1b6da7
) (cherry picked from commit8cb94c01d5
) [BRANDING] fix invisible label in branch protection settings (cherry picked from commit23e5d45721
) (cherry picked from commitf02e4582e5
) [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 commit74c186a380
) (cherry picked from commit7e185c5ca5
) [BRANDING] Add Forgejo light, dark, and auto themes (squash) variables Adapt tob6bcb79987
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 inb6bcb7998
These are the same changes as made in 2574dbcff to the dark theme Refs: forgejo/forgejo#893 (cherry picked from commit9e99fe4f9e
) (cherry picked from commitacbb98bd91
) (cherry picked from commitc80245ed87
) [BRANDING] fix code highlight color in Forgejo themes (cherry picked from commitffc49a4e99
) (cherry picked from commitc5f45a941e
) (cherry picked from commiteee5427c9d
) (cherry picked from commit89be50ca27
) (cherry picked from commit74e4776ef5
) (cherry picked from commit6c4e07a6a7
) [BRANDING] more accessible text selection color in Forgejo themes (cherry picked from commit 7407605ffdedef8fa320477a3bd7efa06df263e2) (cherry picked from commit5aab3872cc
) (cherry picked from commit1ec77d8bd0
) (cherry picked from commit964c89fce7
) (cherry picked from commit8a8023a441
) (cherry picked from commit1c9ffeadf5
) [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 commit8f3f4b219c
) (cherry picked from commitedfb0eef06
) (cherry picked from commita6367fa48a
) (cherry picked from commitd5697abe42
) (cherry picked from commiteaf5370919
) (cherry picked from commit58f11e7310
) (cherry picked from commit732e1b35d5
) (cherry picked from commit0d794ae1c9
) (cherry picked from commitccc8aed308
) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/1582 (cherry picked from commit209059fbaf
) (cherry picked from commit80ba2df4a7
) (cherry picked from commit17b325da23
) (cherry picked from commit3518b87c8d
) (cherry picked from commit4042143f96
) (cherry picked from commit07f976f9d7
) (cherry picked from commit1bbc6b93e9
) (cherry picked from commit8aa0bba307
) (cherry picked from commit94c4a14ac3
) Update Forgejo theme (squash) - Incorporate changes from79a4c80f8d
into the Forgejo themes. - Fix that there's no focus or active coloring on primary and secondary buttons for Forgejo themes caused by023e937141
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 commit2e32da4419
) (cherry picked from commita4eca09543
) (cherry picked from commite6e452811d
) (cherry picked from commite9a5addf3d
) (cherry picked from commita1b8b5fa0d
) [BRANDING] Update forgejo theme - Inlcudea103b79f60
and1b2cd4c4e1
and376c0e25f7
and023e937141
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 commitbc21dc21e1
) (cherry picked from commit82323c09cc
) (cherry picked from commit2da09af28d
) (cherry picked from commit978aeb7cde
) (cherry picked from commit984c264e19
) (cherry picked from commit6aa7c8db38
) (cherry picked from commit4379269a46
) Conflicts: modules/setting/ui.go https://codeberg.org/forgejo/forgejo/pulls/2116 (cherry picked from commit9414391ec1
) (cherry picked from commit02c9b776e8
)
164 lines
4.7 KiB
Go
164 lines
4.7 KiB
Go
// 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
|
|
|
|
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,
|
|
DefaultTheme: `forgejo-auto`,
|
|
Themes: []string{`forgejo-auto`, `forgejo-light`, `forgejo-dark`, `gitea-auto`, `gitea-light`, `gitea-dark`},
|
|
Reactions: []string{`+1`, `-1`, `laugh`, `hooray`, `confused`, `heart`, `rocket`, `eyes`},
|
|
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,
|
|
|
|
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
|
|
}{
|
|
Author: "Gitea - Git with a cup of tea",
|
|
Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
|
|
Keywords: "go,git,self-hosted,gitea",
|
|
},
|
|
}
|
|
|
|
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 + ":"
|
|
}
|
|
}
|