v2.9.3
Some checks are pending
Release 3X-UI / Analyze Go code (push) Waiting to run
Release 3X-UI / build (386) (push) Blocked by required conditions
Release 3X-UI / build (amd64) (push) Blocked by required conditions
Release 3X-UI / build (arm64) (push) Blocked by required conditions
Release 3X-UI / build (armv5) (push) Blocked by required conditions
Release 3X-UI / build (armv6) (push) Blocked by required conditions
Release 3X-UI / build (armv7) (push) Blocked by required conditions
Release 3X-UI / build (s390x) (push) Blocked by required conditions
Release 3X-UI / Build for Windows (push) Blocked by required conditions

This commit is contained in:
MHSanaei 2026-04-27 15:31:32 +02:00
parent 03393c9f52
commit 0b5c239f98
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A
3 changed files with 18 additions and 10 deletions

View file

@ -1 +1 @@
2.9.2
2.9.3

20
main.go
View file

@ -130,20 +130,22 @@ func runWebServer() {
}
// resetSetting resets all panel settings to their default values.
func resetSetting() {
func resetSetting() error {
err := database.InitDB(config.GetDBPath())
if err != nil {
fmt.Println("Failed to initialize database:", err)
return
return err
}
settingService := service.SettingService{}
err = settingService.ResetSettings()
if err != nil {
fmt.Println("Failed to reset settings:", err)
return err
} else {
fmt.Println("Settings successfully reset.")
}
return nil
}
// showSetting displays the current panel settings if show is true.
@ -255,11 +257,11 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri
}
// updateSetting updates various panel settings including port, credentials, base path, listen IP, and two-factor authentication.
func updateSetting(port int, username string, password string, webBasePath string, listenIP string, resetTwoFactor bool) {
func updateSetting(port int, username string, password string, webBasePath string, listenIP string, resetTwoFactor bool) error {
err := database.InitDB(config.GetDBPath())
if err != nil {
fmt.Println("Database initialization failed:", err)
return
return err
}
settingService := service.SettingService{}
@ -311,6 +313,8 @@ func updateSetting(port int, username string, password string, webBasePath strin
fmt.Printf("listen %v set successfully", listenIP)
}
}
return nil
}
// updateCert updates the SSL certificate files for the panel.
@ -481,9 +485,13 @@ func main() {
return
}
if reset {
resetSetting()
if err = resetSetting(); err != nil {
return
}
} else {
updateSetting(port, username, password, webBasePath, listenIP, resetTwoFactor)
if err = updateSetting(port, username, password, webBasePath, listenIP, resetTwoFactor); err != nil {
return
}
}
if show {
showSetting(show)

View file

@ -3,12 +3,12 @@ const Protocols = {
VLESS: 'vless',
TROJAN: 'trojan',
SHADOWSOCKS: 'shadowsocks',
TUNNEL: 'tunnel',
WIREGUARD: 'wireguard',
HYSTERIA: 'hysteria',
MIXED: 'mixed',
HTTP: 'http',
WIREGUARD: 'wireguard',
TUNNEL: 'tunnel',
TUN: 'tun',
HYSTERIA: 'hysteria',
};
const SSMethods = {