MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / InitialSettings

Function InitialSettings

internal/bootstrap/data/setting.go:96–267  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94}
95
96func InitialSettings() []model.SettingItem {
97 var token string
98 if flags.Dev {
99 token = "dev_token"
100 } else {
101 token = random.Token()
102 }
103 siteVersion := fmt.Sprintf("%s (Commit: %s) - Frontend: %s - Build at: %s", conf.Version, conf.GitCommit, conf.WebVersion, conf.BuiltAt)
104 initialSettingItems := []model.SettingItem{
105 // site settings
106 {Key: conf.VERSION, Value: siteVersion, Type: conf.TypeString, Group: model.SITE, Flag: model.READONLY},
107 //{Key: conf.ApiUrl, Value: "", Type: conf.TypeString, Group: model.SITE},
108 //{Key: conf.BasePath, Value: "", Type: conf.TypeString, Group: model.SITE},
109 {Key: conf.SiteTitle, Value: "OpenList", Type: conf.TypeString, Group: model.SITE},
110 {Key: conf.Announcement, Value: "Welcome to the OpenList project!\nFor the latest updates, to contribute code, or to submit suggestions and issues, please visit our [project repository](https://github.com/OpenListTeam/OpenList).", Type: conf.TypeText, Group: model.SITE},
111 {Key: "pagination_type", Value: "all", Type: conf.TypeSelect, Options: "all,pagination,load_more,auto_load_more", Group: model.SITE},
112 {Key: "default_page_size", Value: "30", Type: conf.TypeNumber, Group: model.SITE},
113 {Key: conf.AllowIndexed, Value: "false", Type: conf.TypeBool, Group: model.SITE},
114 {Key: conf.AllowMounted, Value: "true", Type: conf.TypeBool, Group: model.SITE},
115 {Key: conf.RobotsTxt, Value: "User-agent: *\nAllow: /", Type: conf.TypeText, Group: model.SITE},
116 // style settings
117 {Key: conf.Logo, Value: "https://res.oplist.org/logo/logo.svg", MigrationValue: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeText, Group: model.STYLE},
118 {Key: conf.Favicon, Value: "https://res.oplist.org/logo/logo.svg", MigrationValue: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.STYLE},
119 {Key: conf.MainColor, Value: "#1890ff", Type: conf.TypeString, Group: model.STYLE},
120 {Key: "home_icon", Value: "🏠", Type: conf.TypeString, Group: model.STYLE},
121 {Key: "share_icon", Value: "🎁", Type: conf.TypeString, Group: model.STYLE},
122 {Key: "home_container", Value: "max_980px", Type: conf.TypeSelect, Options: "max_980px,hope_container", Group: model.STYLE},
123 {Key: "settings_layout", Value: "list", Type: conf.TypeSelect, Options: "list,responsive", Group: model.STYLE},
124 {Key: conf.HideStorageDetails, Value: "true", Type: conf.TypeBool, Group: model.STYLE, Flag: model.PRIVATE},
125 {Key: conf.HideStorageDetailsInManagePage, Value: "true", Type: conf.TypeBool, Group: model.STYLE, Flag: model.PRIVATE},
126 {Key: "show_disk_usage_in_plain_text", Value: "false", Type: conf.TypeBool, Group: model.STYLE, Flag: model.PUBLIC},
127 // preview settings
128 {Key: conf.TextTypes, Value: "txt,htm,html,xml,java,properties,sql,js,md,json,conf,ini,vue,php,py,bat,gitignore,yml,go,sh,c,cpp,h,hpp,tsx,vtt,srt,ass,rs,lrc,strm", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
129 {Key: conf.AudioTypes, Value: "mp3,flac,ogg,m4a,wav,opus,wma", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
130 {Key: conf.VideoTypes, Value: "mp4,mkv,avi,mov,rmvb,webm,flv,m3u8", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
131 {Key: conf.ImageTypes, Value: "jpg,tiff,jpeg,png,gif,bmp,svg,ico,swf,webp,avif", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
132 //{Key: conf.OfficeTypes, Value: "doc,docx,xls,xlsx,ppt,pptx", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
133 {Key: conf.ProxyTypes, Value: "m3u8,url", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
134 {Key: conf.ProxyIgnoreHeaders, Value: "authorization,referer", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
135 {Key: "external_previews", Value: `{}`, Type: conf.TypeText, Group: model.PREVIEW},
136 {Key: "iframe_previews", Value: `{
137 "doc,docx,xls,xlsx,ppt,pptx": {
138 "Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$e_url",
139 "Google":"https://docs.google.com/gview?url=$e_url&embedded=true"
140 },
141 "pdf": {
142 "PDF.js":"https://res.oplist.org/pdf.js/web/viewer.html?file=$e_url"
143 },
144 "epub": {
145 "EPUB.js":"https://res.oplist.org/epub.js/viewer.html?url=$e_url"
146 }
147}`, Type: conf.TypeText, Group: model.PREVIEW},
148 // {Key: conf.OfficeViewers, Value: `{
149 // "Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url",
150 // "Google":"https://docs.google.com/gview?url=$url&embedded=true",
151 //}`, Type: conf.TypeText, Group: model.PREVIEW},
152 // {Key: conf.PdfViewers, Value: `{
153 // "pdf.js":"https://openlistteam.github.io/pdf.js/web/viewer.html?file=$url"

Callers 3

generateSettingsJsonFunction · 0.92
DefaultSettingsFunction · 0.92
initSettingsFunction · 0.85

Calls 2

TokenFunction · 0.92
ItemsMethod · 0.65

Tested by

no test coverage detected