44package setting
55
66import (
7+ "context"
78 "sync"
89
910 "code.gitea.io/gitea/modules/log"
@@ -51,9 +52,90 @@ type RepositoryStruct struct {
5152 OpenWithEditorApps * config.Value [OpenWithEditorAppsType ]
5253}
5354
55+ type UIStruct struct {
56+ ExplorePagingNum * config.Value [int ]
57+ SitemapPagingNum * config.Value [int ]
58+ IssuePagingNum * config.Value [int ]
59+ RepoSearchPagingNum * config.Value [int ]
60+ MembersPagingNum * config.Value [int ]
61+ FeedMaxCommitNum * config.Value [int ]
62+ FeedPagingNum * config.Value [int ]
63+ PackagesPagingNum * config.Value [int ]
64+ GraphMaxCommitNum * config.Value [int ]
65+ CodeCommentLines * config.Value [int ]
66+ ReactionMaxUserNum * config.Value [int ]
67+ MaxDisplayFileSize * config.Value [int64 ]
68+ ShowUserEmail * config.Value [bool ]
69+ DefaultShowFullName * config.Value [bool ]
70+ DefaultTheme * config.Value [string ]
71+ Themes * config.Value [[]string ]
72+ Reactions * config.Value [[]string ]
73+ CustomEmojis * config.Value [[]string ]
74+ SearchRepoDescription * config.Value [bool ]
75+ OnlyShowRelevantRepos * config.Value [bool ]
76+ ExploreDefaultSort * config.Value [string ]
77+ PreferredTimestampTense * config.Value [string ]
78+ AmbiguousUnicodeDetection * config.Value [bool ]
79+ }
80+
81+ func (u * UIStruct ) ToStruct (ctx context.Context ) UIForm {
82+ return UIForm {
83+ ExplorePagingNum : u .ExplorePagingNum .Value (ctx ),
84+ SitemapPagingNum : u .SitemapPagingNum .Value (ctx ),
85+ IssuePagingNum : u .IssuePagingNum .Value (ctx ),
86+ RepoSearchPagingNum : u .RepoSearchPagingNum .Value (ctx ),
87+ MembersPagingNum : u .MembersPagingNum .Value (ctx ),
88+ FeedMaxCommitNum : u .FeedMaxCommitNum .Value (ctx ),
89+ FeedPagingNum : u .FeedPagingNum .Value (ctx ),
90+ PackagesPagingNum : u .PackagesPagingNum .Value (ctx ),
91+ GraphMaxCommitNum : u .GraphMaxCommitNum .Value (ctx ),
92+ CodeCommentLines : u .CodeCommentLines .Value (ctx ),
93+ ReactionMaxUserNum : u .ReactionMaxUserNum .Value (ctx ),
94+ MaxDisplayFileSize : u .MaxDisplayFileSize .Value (ctx ),
95+ ShowUserEmail : u .ShowUserEmail .Value (ctx ),
96+ DefaultShowFullName : u .DefaultShowFullName .Value (ctx ),
97+ DefaultTheme : u .DefaultTheme .Value (ctx ),
98+ Themes : u .Themes .Value (ctx ),
99+ Reactions : u .Reactions .Value (ctx ),
100+ CustomEmojis : u .CustomEmojis .Value (ctx ),
101+ SearchRepoDescription : u .SearchRepoDescription .Value (ctx ),
102+ OnlyShowRelevantRepos : u .OnlyShowRelevantRepos .Value (ctx ),
103+ ExploreDefaultSort : u .ExploreDefaultSort .Value (ctx ),
104+ PreferredTimestampTense : u .PreferredTimestampTense .Value (ctx ),
105+ AmbiguousUnicodeDetection : u .AmbiguousUnicodeDetection .Value (ctx ),
106+ }
107+ }
108+
109+ type UIForm struct {
110+ ExplorePagingNum int
111+ SitemapPagingNum int
112+ IssuePagingNum int
113+ RepoSearchPagingNum int
114+ MembersPagingNum int
115+ FeedMaxCommitNum int
116+ FeedPagingNum int
117+ PackagesPagingNum int
118+ GraphMaxCommitNum int
119+ CodeCommentLines int
120+ ReactionMaxUserNum int
121+ MaxDisplayFileSize int64
122+ ShowUserEmail bool
123+ DefaultShowFullName bool
124+ DefaultTheme string
125+ Themes []string
126+ Reactions []string
127+ CustomEmojis []string
128+ SearchRepoDescription bool
129+ OnlyShowRelevantRepos bool
130+ ExploreDefaultSort string
131+ PreferredTimestampTense string
132+ AmbiguousUnicodeDetection bool
133+ }
134+
54135type ConfigStruct struct {
55136 Picture * PictureStruct
56137 Repository * RepositoryStruct
138+ UI * UIStruct
57139}
58140
59141var (
@@ -71,6 +153,31 @@ func initDefaultConfig() {
71153 Repository : & RepositoryStruct {
72154 OpenWithEditorApps : config.ValueJSON [OpenWithEditorAppsType ]("repository.open-with.editor-apps" ),
73155 },
156+ UI : & UIStruct {
157+ ExplorePagingNum : config.ValueJSON [int ]("ui.explore_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "EXPLORE_PAGING_NUM" }),
158+ SitemapPagingNum : config.ValueJSON [int ]("ui.sitemap_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "SITEMAP_PAGING_NUM" }),
159+ IssuePagingNum : config.ValueJSON [int ]("ui.issue_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "ISSUE_PAGING_NUM" }),
160+ RepoSearchPagingNum : config.ValueJSON [int ]("ui.repo_search_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "REPO_SEARCH_PAGING_NUM" }),
161+ MembersPagingNum : config.ValueJSON [int ]("ui.members_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "MEMBERS_PAGING_NUM" }),
162+ FeedMaxCommitNum : config.ValueJSON [int ]("ui.feed_max_commit_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "FEED_MAX_COMMIT_NUM" }),
163+ FeedPagingNum : config.ValueJSON [int ]("ui.feed_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "FEED_PAGE_NUM" }),
164+ PackagesPagingNum : config.ValueJSON [int ]("ui.package_paging_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "PACKAGE_PAGING_NUM" }),
165+ GraphMaxCommitNum : config.ValueJSON [int ]("ui.graph_max_commit_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "GRAPH_MAX_COMMIT_NUM" }),
166+ CodeCommentLines : config.ValueJSON [int ]("ui.code_comment_lines" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "CODE_COMMENT_LINES" }),
167+ ReactionMaxUserNum : config.ValueJSON [int ]("ui.reaction_max_user_num" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "REACTION_MAX_USER_NUM" }),
168+ MaxDisplayFileSize : config.ValueJSON [int64 ]("ui.max_display_file_size" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "MAX_DISPLAY_FILE_SIZE" }),
169+ ShowUserEmail : config.ValueJSON [bool ]("ui.show_user_email" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "SHOW_USER_EMAIL" }),
170+ DefaultShowFullName : config.ValueJSON [bool ]("ui.default_show_full_name" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "DEFAULT_SHOW_FULL_NAME" }),
171+ DefaultTheme : config.ValueJSON [string ]("ui.default_theme" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "DEFAULT_THEME" }),
172+ Themes : config.ValueJSON [[]string ]("ui.themes" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "THEMES" }),
173+ Reactions : config.ValueJSON [[]string ]("ui.reactions" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "REACTIONS" }),
174+ CustomEmojis : config.ValueJSON [[]string ]("ui.custom_emojis" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "CUSTOM_EMOJIS" }),
175+ SearchRepoDescription : config.ValueJSON [bool ]("ui.search_repo_description" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "SEARCH_REPO_DESCRIPTION" }),
176+ OnlyShowRelevantRepos : config.ValueJSON [bool ]("ui.only_show_relevant_repos" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "ONLY_SHOW_RELEVANT_REPOS" }),
177+ ExploreDefaultSort : config.ValueJSON [string ]("ui.explore_default_sort" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "EXPLORE_PAGING_DEFAULT_SORT" }),
178+ PreferredTimestampTense : config.ValueJSON [string ]("ui.preferred_timestamp_tense" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "PREFERRED_TIMESTAMP_TENSE" }),
179+ AmbiguousUnicodeDetection : config.ValueJSON [bool ]("ui.ambiguous_unicode_detection" ).WithFileConfig (config.CfgSecKey {Sec : "ui" , Key : "AMBIGUOUS_UNICODE" }),
180+ },
74181 }
75182}
76183
0 commit comments