mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-16 23:03:21 +01:00
84fee487c7
(cherry picked from commitb1a792b635
) (cherry picked from commitba71acccdb
) (cherry picked from commitef58efb8e0
) (cherry picked from commit6a1b08241e
) (cherry picked from commit132c7a3a07
) (cherry picked from commita1f07975d6
) (cherry picked from commitf3793598b2
) (cherry picked from commit60f38116af
) (cherry picked from commit88884cf283
) (cherry picked from commit520de41aef
) (cherry picked from commitcfd5e5b95a
) (cherry picked from commit5cf1738f0a
) (cherry picked from commitb95f9b3142
) (cherry picked from commit0118fba970
) (cherry picked from commitef213ec79d
) (cherry picked from commitf6794f694b
) (cherry picked from commit639110c03b
) (cherry picked from commit2be6eca1e1
) (cherry picked from commiteb929d0d56
) (cherry picked from commitc49dd4ed7f
) (cherry picked from commit8ea074c4dd
) (cherry picked from commit3145df43d6
) (cherry picked from commitd0df3e306a
) (cherry picked from commit8f4850705e
) (cherry picked from commit5a24d4319c
) (cherry picked from commit756c04c6c4
) (cherry picked from commitea627e79e3
) (cherry picked from commitc52b141902
) (cherry picked from commit49ab0c5559
) (cherry picked from commitf14f26c940
) (cherry picked from commit4caebbb6be
) (cherry picked from commit7c3d0bca9e
) (cherry picked from commit171a207006
) (cherry picked from commit2a4a7d05fb
) (cherry picked from commitbf19c35f84
) (cherry picked from commitbff760c91a
) (cherry picked from commitab648f7b67
) (cherry picked from commit0e3bd4b4ab
) (cherry picked from commitf75b95c2f6
)
151 lines
4.2 KiB
Go
151 lines
4.2 KiB
Go
// 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,
|
||
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`},
|
||
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
|
||
}{
|
||
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 + ":"
|
||
}
|
||
}
|