mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
feat: add anonymous Zen support
This commit is contained in:
1 parent
fdae1902a0
commit
8e131dcf3b
10 files changed
+301
-51
No files matched your search
@@ -230,6 +230,7 @@ type ConfigView struct {
|
||||
ServerKeys []SecretView `json:"server_keys"`
|
||||
ZenKeys []SecretView `json:"zen_keys"`
|
||||
GoKeys []SecretView `json:"go_keys"`
|
||||
Anonymous bool `json:"anonymous"`
|
||||
Proxies []SecretView `json:"proxies"`
|
||||
ProxyFile string `json:"proxyfile"`
|
||||
Upstream UpstreamConfig `json:"upstream"`
|
||||
@@ -266,6 +267,7 @@ type ConfigUpdate struct {
|
||||
ServerKeys []SecretInput `json:"server_keys"`
|
||||
ZenKeys []SecretInput `json:"zen_keys"`
|
||||
GoKeys []SecretInput `json:"go_keys"`
|
||||
Anonymous bool `json:"anonymous"`
|
||||
Proxies []SecretInput `json:"proxies"`
|
||||
ProxyFile string `json:"proxyfile"`
|
||||
Upstream UpstreamConfig `json:"upstream"`
|
||||
@@ -310,7 +312,7 @@ func (a *AdminServer) handlePutConfig(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
candidate := Config{
|
||||
Listen: update.Listen, ServerKeys: serverKeys, ZenKeys: zenKeys, GoKeys: goKeys, Proxies: proxies, ProxyFile: update.ProxyFile,
|
||||
Listen: update.Listen, ServerKeys: serverKeys, ZenKeys: zenKeys, GoKeys: goKeys, Anonymous: update.Anonymous, Proxies: proxies, ProxyFile: update.ProxyFile,
|
||||
Upstream: update.Upstream, Retry: update.Retry, Models: update.Models, Performance: update.Performance, Logging: update.Logging, Prefer: update.Prefer,
|
||||
WebUI: WebUIConfig{Enabled: update.WebUI.Enabled, Listen: update.WebUI.Listen, Username: current.WebUI.Username, PasswordHash: current.WebUI.PasswordHash, SessionTTLMinutes: update.WebUI.SessionTTLMinutes},
|
||||
}
|
||||
@@ -465,7 +467,7 @@ func (a *AdminServer) configView() ConfigView {
|
||||
cfg := a.manager.Config()
|
||||
effective, restart := a.manager.RestartStatus()
|
||||
return ConfigView{
|
||||
Listen: cfg.Listen, ServerKeys: maskSecrets(cfg.ServerKeys, false), ZenKeys: maskSecrets(cfg.ZenKeys, false), GoKeys: maskSecrets(cfg.GoKeys, false),
|
||||
Listen: cfg.Listen, ServerKeys: maskSecrets(cfg.ServerKeys, false), ZenKeys: maskSecrets(cfg.ZenKeys, false), GoKeys: maskSecrets(cfg.GoKeys, false), Anonymous: cfg.Anonymous,
|
||||
Proxies: maskSecrets(cfg.Proxies, true), ProxyFile: cfg.ProxyFile, Upstream: cfg.Upstream, Retry: cfg.Retry, Models: cfg.Models,
|
||||
Performance: cfg.Performance, Logging: cfg.Logging, Prefer: cfg.Prefer,
|
||||
WebUI: WebUIView{Enabled: cfg.WebUI.Enabled, Listen: cfg.WebUI.Listen, Username: cfg.WebUI.Username, SessionTTLMinutes: cfg.WebUI.SessionTTLMinutes},
|
||||
|
||||
Reference in new issue
Block a user