mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-10 12:16:18 +00:00
Revert "Add certificate setting update to CLI"
This reverts commit 2a937d59d7
.
This commit is contained in:
parent
2a937d59d7
commit
ee6b2254f0
2 changed files with 0 additions and 51 deletions
43
main.go
43
main.go
|
@ -254,33 +254,6 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateCert(publicKey string, privateKey string) {
|
|
||||||
err := database.InitDB(config.GetDBPath())
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (privateKey != "" && publicKey != "") || (privateKey == "" && publicKey == "") {
|
|
||||||
settingService := service.SettingService{}
|
|
||||||
err = settingService.SetCertFile(publicKey)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("set certificate public key failed:", err)
|
|
||||||
} else {
|
|
||||||
fmt.Println("set certificate public key success")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = settingService.SetKeyFile(privateKey)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("set certificate private key failed:", err)
|
|
||||||
} else {
|
|
||||||
fmt.Println("set certificate private key success")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Println("both public and private key should be entered.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func migrateDb() {
|
func migrateDb() {
|
||||||
inboundService := service.InboundService{}
|
inboundService := service.InboundService{}
|
||||||
|
|
||||||
|
@ -339,8 +312,6 @@ func main() {
|
||||||
var username string
|
var username string
|
||||||
var password string
|
var password string
|
||||||
var webBasePath string
|
var webBasePath string
|
||||||
var webCertFile string
|
|
||||||
var webKeyFile string
|
|
||||||
var tgbottoken string
|
var tgbottoken string
|
||||||
var tgbotchatid string
|
var tgbotchatid string
|
||||||
var enabletgbot bool
|
var enabletgbot bool
|
||||||
|
@ -355,8 +326,6 @@ func main() {
|
||||||
settingCmd.StringVar(&username, "username", "", "set login username")
|
settingCmd.StringVar(&username, "username", "", "set login username")
|
||||||
settingCmd.StringVar(&password, "password", "", "set login password")
|
settingCmd.StringVar(&password, "password", "", "set login password")
|
||||||
settingCmd.StringVar(&webBasePath, "webBasePath", "", "set web base path")
|
settingCmd.StringVar(&webBasePath, "webBasePath", "", "set web base path")
|
||||||
settingCmd.StringVar(&webCertFile, "webCert", "", "set web public key path")
|
|
||||||
settingCmd.StringVar(&webKeyFile, "webCertKey", "", "set web private key path")
|
|
||||||
settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "set telegram bot token")
|
settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "set telegram bot token")
|
||||||
settingCmd.StringVar(&tgbotRuntime, "tgbotRuntime", "", "set telegram bot cron time")
|
settingCmd.StringVar(&tgbotRuntime, "tgbotRuntime", "", "set telegram bot cron time")
|
||||||
settingCmd.StringVar(&tgbotchatid, "tgbotchatid", "", "set telegram bot chat id")
|
settingCmd.StringVar(&tgbotchatid, "tgbotchatid", "", "set telegram bot chat id")
|
||||||
|
@ -411,18 +380,6 @@ func main() {
|
||||||
if enabletgbot {
|
if enabletgbot {
|
||||||
updateTgbotEnableSts(enabletgbot)
|
updateTgbotEnableSts(enabletgbot)
|
||||||
}
|
}
|
||||||
case "cert":
|
|
||||||
err := settingCmd.Parse(os.Args[2:])
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if reset {
|
|
||||||
updateCert("", "")
|
|
||||||
} else {
|
|
||||||
updateCert(webCertFile, webKeyFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt.Println("Invalid subcommands")
|
fmt.Println("Invalid subcommands")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
|
@ -309,18 +309,10 @@ func (s *SettingService) SetPort(port int) error {
|
||||||
return s.setInt("webPort", port)
|
return s.setInt("webPort", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SettingService) SetCertFile(webCertFile string) error {
|
|
||||||
return s.setString("webCertFile", webCertFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SettingService) GetCertFile() (string, error) {
|
func (s *SettingService) GetCertFile() (string, error) {
|
||||||
return s.getString("webCertFile")
|
return s.getString("webCertFile")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SettingService) SetKeyFile(webKeyFile string) error {
|
|
||||||
return s.setString("webKeyFile", webKeyFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SettingService) GetKeyFile() (string, error) {
|
func (s *SettingService) GetKeyFile() (string, error) {
|
||||||
return s.getString("webKeyFile")
|
return s.getString("webKeyFile")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue