Skip to content

Commit 8c244a9

Browse files
authored
refactor(assets): migrate to resource domain (#975)
* refactor(assets): migrate to resource domain * feat(bootstrap): add migration value for logo and favicon settings
1 parent df479ba commit 8c244a9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

drivers/url_tree/meta.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Addition struct {
1010
// driver.RootPath
1111
// driver.RootID
1212
// define other
13-
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"`
13+
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"`
1414
HeadSize bool `json:"head_size" type:"bool" default:"false" help:"Use head method to get file size, but it may be failed."`
1515
Writable bool `json:"writable" type:"bool" default:"false"`
1616
}

internal/bootstrap/data/setting.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ func InitialSettings() []model.SettingItem {
107107
{Key: conf.AllowMounted, Value: "true", Type: conf.TypeBool, Group: model.SITE},
108108
{Key: conf.RobotsTxt, Value: "User-agent: *\nAllow: /", Type: conf.TypeText, Group: model.SITE},
109109
// style settings
110-
{Key: conf.Logo, Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeText, Group: model.STYLE},
111-
{Key: conf.Favicon, Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.STYLE},
110+
{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},
111+
{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},
112112
{Key: conf.MainColor, Value: "#1890ff", Type: conf.TypeString, Group: model.STYLE},
113113
{Key: "home_icon", Value: "🏠", Type: conf.TypeString, Group: model.STYLE},
114114
{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 {
141141
// {Key: conf.PdfViewers, Value: `{
142142
// "pdf.js":"https://openlistteam.github.io/pdf.js/web/viewer.html?file=$url"
143143
//}`, Type: conf.TypeText, Group: model.PREVIEW},
144-
{Key: "audio_cover", Value: "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg", Type: conf.TypeString, Group: model.PREVIEW},
144+
{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},
145145
{Key: conf.AudioAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
146146
{Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
147147
{Key: conf.PreviewArchivesByDefault, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},

internal/model/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ func (u *User) WebAuthnCredentials() []webauthn.Credential {
185185
}
186186

187187
func (u *User) WebAuthnIcon() string {
188-
return "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg"
188+
return "https://res.oplist.org/logo/logo.svg"
189189
}

server/static/static.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ func UpdateIndex() {
116116
mainColor := setting.GetStr(conf.MainColor)
117117
utils.Log.Debug("Applying replacements for default pages...")
118118
replaceMap1 := map[string]string{
119-
"https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg": favicon,
120-
"https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.png": logo,
121-
"Loading...": title,
122-
"main_color: undefined": fmt.Sprintf("main_color: '%s'", mainColor),
119+
"https://res.oplist.org/logo/logo.svg": favicon,
120+
"https://res.oplist.org/logo/logo.png": logo,
121+
"Loading...": title,
122+
"main_color: undefined": fmt.Sprintf("main_color: '%s'", mainColor),
123123
}
124124
conf.ManageHtml = replaceStrings(conf.RawIndexHtml, replaceMap1)
125125
utils.Log.Debug("Applying replacements for manage pages...")

0 commit comments

Comments
 (0)