[bugfix] Load instance-wide custom css in page stylesheets template (#3601)

* [bugfix] Load instance-wide custom css in page stylesheets template

* [chore] remove redunt import
This commit is contained in:
CDN 2024-12-18 17:47:17 +08:00 committed by GitHub
parent eb77ceeed6
commit f78002f915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 15 additions and 14 deletions

View File

@ -54,7 +54,7 @@ func (m *Module) aboutGETHandler(c *gin.Context) {
Template: "about.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssAbout, instanceCustomCSSPath},
Stylesheets: []string{cssAbout},
Extra: map[string]any{
"showStrap": true,
"blocklistExposed": config.GetInstanceExposeSuspendedWeb(),

View File

@ -127,9 +127,8 @@ func (m *Module) confirmEmailPOSTHandler(c *gin.Context) {
// Serve page informing user that their
// email address is now confirmed.
page := apiutil.WebPage{
Template: "confirmed_email.tmpl",
Instance: instance,
Stylesheets: []string{instanceCustomCSSPath},
Template: "confirmed_email.tmpl",
Instance: instance,
Extra: map[string]any{
"email": user.Email,
"username": user.Account.Username,

View File

@ -67,7 +67,7 @@ func (m *Module) domainBlockListGETHandler(c *gin.Context) {
Template: "domain-blocklist.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssFA, instanceCustomCSSPath},
Stylesheets: []string{cssFA},
Javascript: []string{jsFrontend},
Extra: map[string]any{"blocklist": domainBlocks},
}

View File

@ -59,7 +59,7 @@ func (m *Module) indexHandler(c *gin.Context) {
Template: "index.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssAbout, cssIndex, instanceCustomCSSPath},
Stylesheets: []string{cssAbout, cssIndex},
Extra: map[string]any{"showStrap": true},
}

View File

@ -142,7 +142,6 @@ func (m *Module) profileGETHandler(c *gin.Context) {
cssStatus,
cssThread,
cssProfile,
instanceCustomCSSPath,
}...,
)

View File

@ -53,7 +53,6 @@ func (m *Module) SettingsPanelHandler(c *gin.Context) {
cssProfile, // Used for rendering stub/fake profiles.
cssStatus, // Used for rendering stub/fake statuses.
cssSettings,
instanceCustomCSSPath,
},
Javascript: []string{jsSettings},
}

View File

@ -126,10 +126,9 @@ func (m *Module) signupPOSTHandler(c *gin.Context) {
// Serve a page informing the
// user that they've signed up.
page := apiutil.WebPage{
Template: "signed-up.tmpl",
Instance: instance,
Stylesheets: []string{instanceCustomCSSPath},
OGMeta: apiutil.OGBase(instance),
Template: "signed-up.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Extra: map[string]any{
"email": user.UnconfirmedEmail,
"username": user.Account.Username,

View File

@ -59,7 +59,7 @@ func (m *Module) tagGETHandler(c *gin.Context) {
Template: "tag.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssFA, cssThread, cssTag, instanceCustomCSSPath},
Stylesheets: []string{cssFA, cssThread, cssTag},
Extra: map[string]any{"tagName": tagName},
}

View File

@ -124,7 +124,6 @@ func (m *Module) threadGETHandler(c *gin.Context) {
cssFA,
cssStatus,
cssThread,
instanceCustomCSSPath,
}...,
)

View File

@ -32,10 +32,16 @@
{{- range .stylesheets }}
<link rel="preload" href="{{- . -}}" as="style">
{{- end }}
{{- if .instance.CustomCSS }}
<link rel="preload" href="/custom.css" as="style">
{{- end }}
<link rel="stylesheet" href="/assets/dist/_colors.css">
<link rel="stylesheet" href="/assets/dist/base.css">
<link rel="stylesheet" href="/assets/dist/page.css">
{{- range .stylesheets }}
<link rel="stylesheet" href="{{- . -}}">
{{- end }}
{{- if .instance.CustomCSS }}
<link rel="stylesheet" href="/custom.css">
{{- end }}
{{- end }}