mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-08 14:36:13 +00:00
v2.9.3
This commit is contained in:
@@ -1 +1 @@
|
|||||||
2.9.2
|
2.9.3
|
||||||
20
main.go
20
main.go
@@ -130,20 +130,22 @@ func runWebServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resetSetting resets all panel settings to their default values.
|
// resetSetting resets all panel settings to their default values.
|
||||||
func resetSetting() {
|
func resetSetting() error {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Failed to initialize database:", err)
|
fmt.Println("Failed to initialize database:", err)
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
err = settingService.ResetSettings()
|
err = settingService.ResetSettings()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Failed to reset settings:", err)
|
fmt.Println("Failed to reset settings:", err)
|
||||||
|
return err
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Settings successfully reset.")
|
fmt.Println("Settings successfully reset.")
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// showSetting displays the current panel settings if show is true.
|
// 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.
|
// 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())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Database initialization failed:", err)
|
fmt.Println("Database initialization failed:", err)
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
@@ -311,6 +313,8 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
|||||||
fmt.Printf("listen %v set successfully", listenIP)
|
fmt.Printf("listen %v set successfully", listenIP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateCert updates the SSL certificate files for the panel.
|
// updateCert updates the SSL certificate files for the panel.
|
||||||
@@ -481,9 +485,13 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if reset {
|
if reset {
|
||||||
resetSetting()
|
if err = resetSetting(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
updateSetting(port, username, password, webBasePath, listenIP, resetTwoFactor)
|
if err = updateSetting(port, username, password, webBasePath, listenIP, resetTwoFactor); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if show {
|
if show {
|
||||||
showSetting(show)
|
showSetting(show)
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ const Protocols = {
|
|||||||
VLESS: 'vless',
|
VLESS: 'vless',
|
||||||
TROJAN: 'trojan',
|
TROJAN: 'trojan',
|
||||||
SHADOWSOCKS: 'shadowsocks',
|
SHADOWSOCKS: 'shadowsocks',
|
||||||
TUNNEL: 'tunnel',
|
WIREGUARD: 'wireguard',
|
||||||
|
HYSTERIA: 'hysteria',
|
||||||
MIXED: 'mixed',
|
MIXED: 'mixed',
|
||||||
HTTP: 'http',
|
HTTP: 'http',
|
||||||
WIREGUARD: 'wireguard',
|
TUNNEL: 'tunnel',
|
||||||
TUN: 'tun',
|
TUN: 'tun',
|
||||||
HYSTERIA: 'hysteria',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const SSMethods = {
|
const SSMethods = {
|
||||||
|
|||||||
Reference in New Issue
Block a user