1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-28 09:21:13 -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 7709d6a67b51c19e154cd229e64e07ac2a2cb3c4) (cherry picked from commit 76aec99cdd35ea2bb07d08b80f6c7447a35cfc5b) (cherry picked from commit 76089f3482181b5878815019ce9ac0538bbf58f7) (cherry picked from commit bac925c76bcd3ce5a9c23991f942667c50840c62) (cherry picked from commit 8fcf1c608ed028a6dc02feb8b2292d9c80fd0463)
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 359c1976237ab37fea84c41cbc2724adbea7c5e4) (cherry picked from commit 1b45cee537a6080867c3f258ba3600af4a3873a6) (cherry picked from commit 8f85921df55f6c4da12ae80b9764c13f0701169b) (cherry picked from commit a4ff35cbbad65c9b3f88963c4f137e2ba3b0092c) (cherry picked from commit 4700ee961e0b54450f99a2d2e92c68f747f3febe)
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 16ed04f9f45dfed0d3583a4f1aa1cbc5c1d97a24) (cherry picked from commit b6f50bf932c89182d9908d2d33bbf2ead69c0c41) (cherry picked from commit bcf255844d6871b7b707338d8babd99df3cb465e) (cherry picked from commit 9eb9f86542a62d5ae28ace41ef53403d97b3b3ad) (cherry picked from commit 9f98d6757b68f4875a9d977b8049261f9cc4f0f4)
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 + ":"
}
}