feat: implement fixed local API port settings for desktop app, allowing users to specify a port for consistent access, with corresponding UI and translations

This commit is contained in:
wizardchen
2026-04-11 16:02:52 +08:00
committed by lyingbug
parent 3f0f69815f
commit d99e2cbac3
13 changed files with 392 additions and 279 deletions
+10
View File
@@ -36,3 +36,13 @@ func (a *App) GetAPIBaseURL() string {
}
return strings.TrimRight(a.backendURL, "/") + "/api/v1"
}
// GetDesktopHTTPPortSetting returns the saved local API port (0 = random port each launch).
func (a *App) GetDesktopHTTPPortSetting() int {
return LoadDesktopPrefsHTTPPort()
}
// SetDesktopHTTPPortSetting saves the preferred local API port to application support. Restart the app for it to take effect unless it matches the current listener.
func (a *App) SetDesktopHTTPPortSetting(port int) error {
return SaveDesktopHTTPPortPreference(port)
}