Release 3.8.0.2: app.zip updates, lock hygiene, secret-safe getState.

This commit is contained in:
M4
2026-07-29 22:00:39 +03:00
parent 54b5b87990
commit 6a7480dceb
31 changed files with 2058 additions and 1537 deletions
+19 -1
View File
@@ -80,6 +80,15 @@ func New(mgr *core.Manager, cfgPath string, logBuf *bytes.Buffer) *App {
}
func (a *App) GetState() (UIState, error) {
return a.getState(false)
}
// GetEditState returns full active proxy / hy2 secrets for the editor form (not for polls).
func (a *App) GetEditState() (UIState, error) {
return a.getState(true)
}
func (a *App) getState(includeSecrets bool) (UIState, error) {
a.mu.Lock()
defer a.mu.Unlock()
@@ -91,6 +100,9 @@ func (a *App) GetState() (UIState, error) {
proxy = p.Proxy
active = p.Name
}
if !includeSecrets {
proxy = config.RedactProxyURI(proxy)
}
corePath := ""
coreReady := false
if p, err := cfg.ActiveProfile(); err == nil {
@@ -115,6 +127,10 @@ func (a *App) GetState() (UIState, error) {
} else if path, err := naive.ResolveBinary(a.Mgr.BinDir()); err == nil {
corePath, coreReady = path, true
}
hy2 := a.Mgr.ActiveHy2Options()
if !includeSecrets {
hy2.ObfsPassword = ""
}
out := UIState{
Connected: st.Connected,
Profile: st.Profile,
@@ -132,7 +148,7 @@ func (a *App) GetState() (UIState, error) {
Update: a.UpdateStatus,
Pings: append([]netcheck.Result(nil), a.Pings...),
Subscription: cfg.SubscriptionURL,
Hy2: a.Mgr.ActiveHy2Options(),
Hy2: hy2,
}
if out.Protocol == "" {
if p, err := cfg.ActiveProfile(); err == nil {
@@ -473,6 +489,8 @@ func (a *App) dispatch(name string, args []json.RawMessage) (any, error) {
switch name {
case "getState":
return a.GetState()
case "getEditState":
return a.GetEditState()
case "connect":
return nil, a.Connect()
case "disconnect":