refactor(assets): migrate to resource domain (#975)

* refactor(assets): migrate to resource domain

* feat(bootstrap): add migration value for logo and favicon settings
This commit is contained in:
MadDogOwner
2025-08-10 09:57:33 +08:00
committed by GitHub
parent df479ba806
commit 8c244a984d
4 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ type Addition struct {
// driver.RootPath // driver.RootPath
// driver.RootID // driver.RootID
// define other // define other
UrlStructure string `json:"url_structure" type:"text" required:"true" default:"https://cdn.oplist.org/gh/OpenListTeam/OpenList/README.md\nhttps://cdn.oplist.org/gh/OpenListTeam/OpenList/README_cn.md\nfolder:\n CONTRIBUTING.md:1635:https://cdn.oplist.org/gh/OpenListTeam/OpenList/CONTRIBUTING.md\n CODE_OF_CONDUCT.md:2093:https://cdn.oplist.org/gh/OpenListTeam/OpenList/CODE_OF_CONDUCT.md" help:"structure:FolderName:\n [FileName:][FileSize:][Modified:]Url"` UrlStructure string `json:"url_structure" type:"text" required:"true" default:"https://raw.githubusercontent.com/OpenListTeam/OpenList/main/README.md\nhttps://raw.githubusercontent.com/OpenListTeam/OpenList/main/README_cn.md\nfolder:\n CONTRIBUTING.md:1635:https://raw.githubusercontent.com/OpenListTeam/OpenList/main/CONTRIBUTING.md\n CODE_OF_CONDUCT.md:2093:https://raw.githubusercontent.com/OpenListTeam/OpenList/main/CODE_OF_CONDUCT.md" help:"structure:FolderName:\n [FileName:][FileSize:][Modified:]Url"`
HeadSize bool `json:"head_size" type:"bool" default:"false" help:"Use head method to get file size, but it may be failed."` HeadSize bool `json:"head_size" type:"bool" default:"false" help:"Use head method to get file size, but it may be failed."`
Writable bool `json:"writable" type:"bool" default:"false"` Writable bool `json:"writable" type:"bool" default:"false"`
} }

View File

@ -107,8 +107,8 @@ func InitialSettings() []model.SettingItem {
{Key: conf.AllowMounted, Value: "true", Type: conf.TypeBool, Group: model.SITE}, {Key: conf.AllowMounted, Value: "true", Type: conf.TypeBool, Group: model.SITE},
{Key: conf.RobotsTxt, Value: "User-agent: *\nAllow: /", Type: conf.TypeText, Group: model.SITE}, {Key: conf.RobotsTxt, Value: "User-agent: *\nAllow: /", Type: conf.TypeText, Group: model.SITE},
// style settings // style settings
{Key: conf.Logo, Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeText, Group: model.STYLE}, {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},
{Key: conf.Favicon, Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.STYLE}, {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},
{Key: conf.MainColor, Value: "#1890ff", Type: conf.TypeString, Group: model.STYLE}, {Key: conf.MainColor, Value: "#1890ff", Type: conf.TypeString, Group: model.STYLE},
{Key: "home_icon", Value: "🏠", Type: conf.TypeString, Group: model.STYLE}, {Key: "home_icon", Value: "🏠", Type: conf.TypeString, Group: model.STYLE},
{Key: "home_container", Value: "max_980px", Type: conf.TypeSelect, Options: "max_980px,hope_container", Group: model.STYLE}, {Key: "home_container", Value: "max_980px", Type: conf.TypeSelect, Options: "max_980px,hope_container", Group: model.STYLE},
@ -141,7 +141,7 @@ func InitialSettings() []model.SettingItem {
// {Key: conf.PdfViewers, Value: `{ // {Key: conf.PdfViewers, Value: `{
// "pdf.js":"https://openlistteam.github.io/pdf.js/web/viewer.html?file=$url" // "pdf.js":"https://openlistteam.github.io/pdf.js/web/viewer.html?file=$url"
//}`, Type: conf.TypeText, Group: model.PREVIEW}, //}`, Type: conf.TypeText, Group: model.PREVIEW},
{Key: "audio_cover", Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.PREVIEW}, {Key: "audio_cover", Value: "https://res.oplist.org/logo/logo.svg", MigrationValue: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.PREVIEW},
{Key: conf.AudioAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW}, {Key: conf.AudioAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
{Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW}, {Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
{Key: conf.PreviewArchivesByDefault, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW}, {Key: conf.PreviewArchivesByDefault, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},

View File

@ -185,5 +185,5 @@ func (u *User) WebAuthnCredentials() []webauthn.Credential {
} }
func (u *User) WebAuthnIcon() string { func (u *User) WebAuthnIcon() string {
return "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg" return "https://res.oplist.org/logo/logo.svg"
} }

View File

@ -116,10 +116,10 @@ func UpdateIndex() {
mainColor := setting.GetStr(conf.MainColor) mainColor := setting.GetStr(conf.MainColor)
utils.Log.Debug("Applying replacements for default pages...") utils.Log.Debug("Applying replacements for default pages...")
replaceMap1 := map[string]string{ replaceMap1 := map[string]string{
"https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg": favicon, "https://res.oplist.org/logo/logo.svg": favicon,
"https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.png": logo, "https://res.oplist.org/logo/logo.png": logo,
"Loading...": title, "Loading...": title,
"main_color: undefined": fmt.Sprintf("main_color: '%s'", mainColor), "main_color: undefined": fmt.Sprintf("main_color: '%s'", mainColor),
} }
conf.ManageHtml = replaceStrings(conf.RawIndexHtml, replaceMap1) conf.ManageHtml = replaceStrings(conf.RawIndexHtml, replaceMap1)
utils.Log.Debug("Applying replacements for manage pages...") utils.Log.Debug("Applying replacements for manage pages...")