Something went wrong. Try again.
sloproxy
Something went wrong. Try again.
1.3 kB · 44 lines
Go
at commit e8e39526
123456789101112131415161718192021222324252627282930313233343536373839404142434445// auth_diff.go computes human-readable diffs for auth file field changes.package diff
import ( "fmt" "strings"
coreauth "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/auth")
// BuildAuthChangeDetails computes a redacted, human-readable list of auth field changes.// Only prefix, proxy_url, and disabled fields are tracked; sensitive data is never printed.func BuildAuthChangeDetails(oldAuth, newAuth *coreauth.Auth) []string { changes := make([]string, 0, 3)
// Handle nil cases by using empty Auth as default if oldAuth == nil { oldAuth = &coreauth.Auth{} } if newAuth == nil { return changes }
// Compare prefix oldPrefix := strings.TrimSpace(oldAuth.Prefix) newPrefix := strings.TrimSpace(newAuth.Prefix) if oldPrefix != newPrefix { changes = append(changes, fmt.Sprintf("prefix: %s -> %s", oldPrefix, newPrefix)) }
// Compare proxy_url (redacted) oldProxy := strings.TrimSpace(oldAuth.ProxyURL) newProxy := strings.TrimSpace(newAuth.ProxyURL) if oldProxy != newProxy { changes = append(changes, fmt.Sprintf("proxy_url: %s -> %s", formatProxyURL(oldProxy), formatProxyURL(newProxy))) }
// Compare disabled if oldAuth.Disabled != newAuth.Disabled { changes = append(changes, fmt.Sprintf("disabled: %t -> %t", oldAuth.Disabled, newAuth.Disabled)) }
return changes}