前端页面
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
package apps
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
)
|
||||
|
||||
type AppSettingsResetAESSecretAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *AppSettingsResetAESSecretAction) RunPost(params struct {
|
||||
AppId int64
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
}) {
|
||||
params.Must.Field("appId", params.AppId).Gt(0, "请选择应用")
|
||||
|
||||
app := pickApp(params.AppId)
|
||||
resetAESSecret(app)
|
||||
this.Success()
|
||||
}
|
||||
@@ -17,7 +17,6 @@ var appSettingsStore = struct {
|
||||
|
||||
func defaultAppSettings(app maps.Map) maps.Map {
|
||||
signSecretPlain := randomPlainSecret("ss")
|
||||
aesSecretPlain := randomPlainSecret("as")
|
||||
return maps.Map{
|
||||
"appId": app.GetString("appId"),
|
||||
"primaryClusterId": app.GetInt64("clusterId"),
|
||||
@@ -25,9 +24,6 @@ func defaultAppSettings(app maps.Map) maps.Map {
|
||||
"signSecretPlain": signSecretPlain,
|
||||
"signSecretMasked": maskSecret(signSecretPlain),
|
||||
"signSecretUpdatedAt": "2026-02-20 12:30:00",
|
||||
"aesSecretPlain": aesSecretPlain,
|
||||
"aesSecretMasked": maskSecret(aesSecretPlain),
|
||||
"aesSecretUpdatedAt": "2026-02-12 09:45:00",
|
||||
"appStatus": app.GetBool("isOn"),
|
||||
"defaultTTL": 30,
|
||||
"fallbackTimeoutMs": 300,
|
||||
@@ -52,9 +48,6 @@ func cloneSettings(settings maps.Map) maps.Map {
|
||||
"signSecretPlain": settings.GetString("signSecretPlain"),
|
||||
"signSecretMasked": settings.GetString("signSecretMasked"),
|
||||
"signSecretUpdatedAt": settings.GetString("signSecretUpdatedAt"),
|
||||
"aesSecretPlain": settings.GetString("aesSecretPlain"),
|
||||
"aesSecretMasked": settings.GetString("aesSecretMasked"),
|
||||
"aesSecretUpdatedAt": settings.GetString("aesSecretUpdatedAt"),
|
||||
"appStatus": settings.GetBool("appStatus"),
|
||||
"defaultTTL": settings.GetInt("defaultTTL"),
|
||||
"fallbackTimeoutMs": settings.GetInt("fallbackTimeoutMs"),
|
||||
@@ -110,16 +103,6 @@ func resetSignSecret(app maps.Map) maps.Map {
|
||||
return settings
|
||||
}
|
||||
|
||||
func resetAESSecret(app maps.Map) maps.Map {
|
||||
settings := loadAppSettings(app)
|
||||
aesSecretPlain := randomPlainSecret("as")
|
||||
settings["aesSecretPlain"] = aesSecretPlain
|
||||
settings["aesSecretMasked"] = maskSecret(aesSecretPlain)
|
||||
settings["aesSecretUpdatedAt"] = nowDateTime()
|
||||
saveAppSettings(app.GetInt64("id"), settings)
|
||||
return settings
|
||||
}
|
||||
|
||||
func nowDateTime() string {
|
||||
return time.Now().Format("2006-01-02 15:04:05")
|
||||
}
|
||||
@@ -182,21 +165,6 @@ func ensureSettingsFields(settings maps.Map) bool {
|
||||
changed = true
|
||||
}
|
||||
|
||||
aesSecretPlain := settings.GetString("aesSecretPlain")
|
||||
if len(aesSecretPlain) == 0 {
|
||||
aesSecretPlain = randomPlainSecret("as")
|
||||
settings["aesSecretPlain"] = aesSecretPlain
|
||||
changed = true
|
||||
}
|
||||
if len(settings.GetString("aesSecretMasked")) == 0 {
|
||||
settings["aesSecretMasked"] = maskSecret(aesSecretPlain)
|
||||
changed = true
|
||||
}
|
||||
if len(settings.GetString("aesSecretUpdatedAt")) == 0 {
|
||||
settings["aesSecretUpdatedAt"] = nowDateTime()
|
||||
changed = true
|
||||
}
|
||||
|
||||
if len(settings.GetString("sniPolicy")) == 0 {
|
||||
settings["sniPolicy"] = "level2"
|
||||
changed = true
|
||||
|
||||
@@ -19,7 +19,6 @@ func init() {
|
||||
GetPost("/app/settings", new(AppSettingsAction)).
|
||||
Post("/app/settings/toggleSignEnabled", new(AppSettingsToggleSignEnabledAction)).
|
||||
Post("/app/settings/resetSignSecret", new(AppSettingsResetSignSecretAction)).
|
||||
Post("/app/settings/resetAESSecret", new(AppSettingsResetAESSecretAction)).
|
||||
Get("/domains", new(DomainsAction)).
|
||||
Get("/customRecords", new(CustomRecordsAction)).
|
||||
GetPost("/createPopup", new(CreatePopupAction)).
|
||||
|
||||
Reference in New Issue
Block a user