clean up comments and add default API URL

This commit is contained in:
Siyuan 2025-11-14 12:11:50 +00:00
parent 1d7f8ddc29
commit 1abf1f03b7
4 changed files with 11 additions and 6 deletions

View File

@ -10,5 +10,6 @@
] ]
}, },
"git.ignoreLimitWarning": true, "git.ignoreLimitWarning": true,
"cmake.sourceDirectory": "internal/native/cgo" "cmake.sourceDirectory": "/workspaces/kvm-static-ip/internal/native/cgo",
"cmake.ignoreCMakeListsMissing": true
} }

View File

@ -16,6 +16,10 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promauto"
) )
const (
DefaultAPIURL = "https://api.jetkvm.com"
)
type WakeOnLanDevice struct { type WakeOnLanDevice struct {
Name string `json:"name"` Name string `json:"name"`
MacAddress string `json:"macAddress"` MacAddress string `json:"macAddress"`
@ -114,7 +118,7 @@ type Config struct {
// GetUpdateAPIURL returns the update API URL // GetUpdateAPIURL returns the update API URL
func (c *Config) GetUpdateAPIURL() string { func (c *Config) GetUpdateAPIURL() string {
if c.UpdateAPIURL == "" { if c.UpdateAPIURL == "" {
return "https://api.jetkvm.com" return DefaultAPIURL
} }
return strings.TrimSuffix(c.UpdateAPIURL, "/") + "/releases" return strings.TrimSuffix(c.UpdateAPIURL, "/") + "/releases"
} }
@ -168,8 +172,8 @@ var (
func getDefaultConfig() Config { func getDefaultConfig() Config {
return Config{ return Config{
CloudURL: "https://api.jetkvm.com", CloudURL: DefaultAPIURL,
UpdateAPIURL: "https://api.jetkvm.com", UpdateAPIURL: DefaultAPIURL,
CloudAppURL: "https://app.jetkvm.com", CloudAppURL: "https://app.jetkvm.com",
AutoUpdateEnabled: true, // Set a default value AutoUpdateEnabled: true, // Set a default value
ActiveExtension: "", ActiveExtension: "",

View File

@ -50,8 +50,8 @@ func Main() {
initOta() initOta()
initDisplay()
initNative(systemVersionLocal, appVersionLocal) initNative(systemVersionLocal, appVersionLocal)
initDisplay()
http.DefaultClient.Timeout = 1 * time.Minute http.DefaultClient.Timeout = 1 * time.Minute