34 lines
949 B
JavaScript
34 lines
949 B
JavaScript
Tea.context(function () {
|
|
this.success = NotifyReloadSuccess("保存成功")
|
|
|
|
this.activeSection = this.activeSection || "basic"
|
|
this.tlsAdvancedVisible = false
|
|
|
|
if (!this.settings) {
|
|
this.settings = {}
|
|
}
|
|
|
|
let toBool = function (v) {
|
|
if (typeof v === "boolean") {
|
|
return v
|
|
}
|
|
if (typeof v === "number") {
|
|
return v === 1
|
|
}
|
|
if (typeof v === "string") {
|
|
let s = v.toLowerCase().trim()
|
|
return s === "1" || s === "true" || s === "on" || s === "yes" || s === "enabled"
|
|
}
|
|
return false
|
|
}
|
|
|
|
this.settings.autoRemoteStart = toBool(this.settings.autoRemoteStart)
|
|
this.settings.accessLogIsOn = toBool(this.settings.accessLogIsOn)
|
|
this.settings.isOn = toBool(this.settings.isOn)
|
|
|
|
if (!this.settings.timeZone || this.settings.timeZone.length == 0) {
|
|
this.settings.timeZone = "Asia/Shanghai"
|
|
}
|
|
})
|
|
|