feat: 管理后台自定义代码

This commit is contained in:
naiba
2024-08-14 00:24:17 +08:00
parent da8fb57268
commit daab64d232
14 changed files with 43 additions and 20 deletions

View File

@@ -331,6 +331,9 @@ other = "Frontend Theme"
[CustomCodes]
other = "Custom Codes (Style and Script)"
[CustomCodesDashboard]
other = "Custom Codes for Dashboard"
[AccessPassword]
other = "Frontend Access Password"

View File

@@ -331,6 +331,9 @@ other = "Tema de Frontend"
[CustomCodes]
other = "Códigos Personalizados (Incluye style y script)"
[CustomCodesDashboard]
other = "Custom Codes for Dashboard"
[AccessPassword]
other = "Contraseña de Acceso al Frontend"

View File

@@ -331,6 +331,9 @@ other = "前台界面主题"
[CustomCodes]
other = "自定义代码(包括 style 和 script"
[CustomCodesDashboard]
other = "Custom Codes for Dashboard"
[AccessPassword]
other = "前台访问密码"

View File

@@ -331,6 +331,9 @@ other = "前台界面主題"
[CustomCodes]
other = "自定義代碼(包括 style 和 script"
[CustomCodesDashboard]
other = "Custom Codes for Dashboard"
[AccessPassword]
other = "前台訪問密碼"

View File

@@ -14,8 +14,7 @@
<script>
(function () {
updateLang({{.LANG }});
document.documentElement.setAttribute('nz-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
}) ();
})();
</script>
</body>

View File

@@ -13,6 +13,10 @@
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
<link rel="stylesheet" type="text/css" href="/static/main.css?v20240813">
<link rel="stylesheet" type="text/css" href="/static/darkmode.css?v20240813">
<script>
document.documentElement.setAttribute('nz-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
</script>
</head>
{{if ts .CustomCodeDashboard}} {{.CustomCodeDashboard|safe}} {{end}}
<body>
{{end}}

View File

@@ -41,6 +41,10 @@
<label>{{tr "CustomCodes"}}</label>
<textarea name="CustomCode">{{.Conf.Site.CustomCode}}</textarea>
</div>
<div class="field">
<label>{{tr "CustomCodesDashboard"}}</label>
<textarea name="CustomCodeDashboard">{{.Conf.Site.CustomCodeDashboard}}</textarea>
</div>
<div class="field">
<label>{{tr "AccessPassword"}}</label>
<input type="text" name="ViewPassword" placeholder="" value="{{.Conf.Site.ViewPassword}}">
@@ -128,13 +132,13 @@
})
$('.checkbox').checkbox()
$('#settingForm').find("select[name=Cover]").val({{.Conf.Cover }});
{{if .Conf.EnableIPChangeNotification}}
{{ if .Conf.EnableIPChangeNotification}}
$('.checkbox.ip-change').checkbox('set checked')
{{ end }}
{{if .Conf.EnablePlainIPInNotification}}
{{ if .Conf.EnablePlainIPInNotification}}
$('.checkbox.plain-ip').checkbox('set checked')
{{ end }}
{{if .Conf.DisableSwitchTemplateInFrontend }}
{{ if .Conf.DisableSwitchTemplateInFrontend }}
$('.checkbox.disable-switch-template').checkbox('set checked')
{{ end }}
</script>

View File

@@ -14,7 +14,6 @@
// console.log("currentBackendTheme:",currentBackendTheme);
}
showSwitchTemplate({{ .Themes }}, {{ .Conf.Site.Theme }})
document.documentElement.setAttribute('nz-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
</script>
{{ end }}
<script>

View File

@@ -1,6 +1,7 @@
{{define "theme-default/header"}}
<!DOCTYPE html>
<html lang="{{.Conf.Language}}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -21,7 +22,10 @@
<script src="https://unpkg.com/echarts@5.5.0/dist/echarts.min.js"></script>
<script src="/static/semantic-ui-alerts.min.js"></script>
<script src="/static/theme-default/js/mixin.js?v20240302"></script>
<script>
document.documentElement.setAttribute('nz-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
</script>
</head>
<body>
{{end}}
{{end}}