后台关闭切换主题功能

This commit is contained in:
naiba 2024-02-27 21:05:39 +08:00
parent 6fa149519d
commit da6a3463ed
8 changed files with 40 additions and 6 deletions

View File

@ -858,8 +858,9 @@ type settingForm struct {
GRPCHost string GRPCHost string
Cover uint8 Cover uint8
EnableIPChangeNotification string EnableIPChangeNotification string
EnablePlainIPInNotification string EnablePlainIPInNotification string
DisableSwitchTemplateInFrontend string
} }
func (ma *memberAPI) updateSetting(c *gin.Context) { func (ma *memberAPI) updateSetting(c *gin.Context) {
@ -907,6 +908,7 @@ func (ma *memberAPI) updateSetting(c *gin.Context) {
singleton.Conf.Language = sf.Language singleton.Conf.Language = sf.Language
singleton.Conf.EnableIPChangeNotification = sf.EnableIPChangeNotification == "on" singleton.Conf.EnableIPChangeNotification = sf.EnableIPChangeNotification == "on"
singleton.Conf.EnablePlainIPInNotification = sf.EnablePlainIPInNotification == "on" singleton.Conf.EnablePlainIPInNotification = sf.EnablePlainIPInNotification == "on"
singleton.Conf.DisableSwitchTemplateInFrontend = sf.DisableSwitchTemplateInFrontend == "on"
singleton.Conf.Cover = sf.Cover singleton.Conf.Cover = sf.Cover
singleton.Conf.GRPCHost = sf.GRPCHost singleton.Conf.GRPCHost = sf.GRPCHost
singleton.Conf.IgnoredIPNotification = sf.IgnoredIPNotification singleton.Conf.IgnoredIPNotification = sf.IgnoredIPNotification

View File

@ -98,7 +98,8 @@ type Config struct {
ProxyGRPCPort uint ProxyGRPCPort uint
TLS bool TLS bool
EnablePlainIPInNotification bool // 通知信息IP不打码 EnablePlainIPInNotification bool // 通知信息IP不打码
DisableSwitchTemplateInFrontend bool // 前台禁用切换模板功能
// IP变更提醒 // IP变更提醒
EnableIPChangeNotification bool EnableIPChangeNotification bool

View File

@ -630,3 +630,6 @@ other = "Template"
[Stat] [Stat]
other = "Stat" other = "Stat"
[DisableSwitchTemplateInFrontend]
other = "Disable Switch Template in Frontend"

View File

@ -203,7 +203,7 @@ other = "Agregar Servidor"
other = "Editar Grupo de Servidores en Lote" other = "Editar Grupo de Servidores en Lote"
[BatchDeleteServer] [BatchDeleteServer]
other = "Eliminar Servidores en Lote"" other = "Eliminar Servidores en Lote"
[InputServerGroupName] [InputServerGroupName]
other = "Ingrese Nombre del Grupo de Servidores" other = "Ingrese Nombre del Grupo de Servidores"
@ -630,3 +630,6 @@ other = "Plantilla"
[Stat] [Stat]
other = "Stat" other = "Stat"
[DisableSwitchTemplateInFrontend]
other = "Deshabilitar Cambio de Plantilla en Frontend"

View File

@ -630,3 +630,6 @@ other = "主题"
[Stat] [Stat]
other = "信息" other = "信息"
[DisableSwitchTemplateInFrontend]
other = "禁止前台切换模板"

View File

@ -630,3 +630,6 @@ other = "主題"
[Stat] [Stat]
other = "信息" other = "信息"
[DisableSwitchTemplateInFrontend]
other = "禁止前台切換主題"

View File

@ -70,18 +70,24 @@
<input type="text" name="IPChangeNotificationTag" placeholder="" value="{{.Conf.IPChangeNotificationTag}}"> <input type="text" name="IPChangeNotificationTag" placeholder="" value="{{.Conf.IPChangeNotificationTag}}">
</div> </div>
<div class="field"> <div class="field">
<div class="ui nf-ssl checkbox ip-change"> <div class="ui checkbox ip-change">
<input name="EnableIPChangeNotification" type="checkbox" tabindex="0" class="hidden"> <input name="EnableIPChangeNotification" type="checkbox" tabindex="0" class="hidden">
<label>{{tr "Enable"}}</label> <label>{{tr "Enable"}}</label>
</div> </div>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui nf-ssl checkbox plain-ip"> <div class="ui checkbox plain-ip">
<input name="EnablePlainIPInNotification" type="checkbox" tabindex="0" class="hidden"> <input name="EnablePlainIPInNotification" type="checkbox" tabindex="0" class="hidden">
<label>{{tr "NotificationMessagesDoNotHideIP"}}</label> <label>{{tr "NotificationMessagesDoNotHideIP"}}</label>
</div> </div>
</div> </div>
<div class="field">
<div class="ui checkbox disable-switch-template">
<input name="DisableSwitchTemplateInFrontend" type="checkbox" tabindex="0" class="hidden">
<label>{{tr "DisableSwitchTemplateInFrontend"}}</label>
</div>
</div>
<button class="ui button" type="submit">{{tr "Save"}}</button> <button class="ui button" type="submit">{{tr "Save"}}</button>
</form> </form>
</div> </div>
@ -128,5 +134,8 @@
{{if .Conf.EnablePlainIPInNotification}} {{if .Conf.EnablePlainIPInNotification}}
$('.checkbox.plain-ip').checkbox('set checked') $('.checkbox.plain-ip').checkbox('set checked')
{{ end }} {{ end }}
{{if .Conf.DisableSwitchTemplateInFrontend }}
$('.checkbox.disable-switch-template').checkbox('set checked')
{{ end }}
</script> </script>
{{end}} {{end}}

View File

@ -7,6 +7,16 @@
{{.Version}}</small> {{.Version}}</small>
</div> </div>
</div> </div>
{{ if not .Conf.DisableSwitchTemplateInFrontend }}
<script>
function showSwitchTemplate(list, currentBackendTheme) {
console.log(list, currentBackendTheme);
}
showSwitchTemplate({{ .Themes }}, {{ .Conf.Site.Theme }})
</script>
{{ end }}
<script>
</script>
</body> </body>
</html> </html>
{{end}} {{end}}