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

View File

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

View File

@ -280,4 +280,4 @@ PION_LOG_TRACE=${LOG_TRACE_SCOPES} ./jetkvm_app_debug | tee -a /tmp/jetkvm_app_d
EOF
fi
echo "Deployment complete."
echo "Deployment complete."