refactor config and security to simplified the structure (#2068)

This commit is contained in:
Cytown authored and GitHub committed 2026-03-28 00:03:34 +08:00
1 parent 98c78363b3
commit b646d3b8fe
48 files changed
+1566 -2372

No files matched your search

+3 -3
View File
@@ -57,7 +57,7 @@ func (h *Handler) handleGetPicoToken(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]any{
"token": cfg.Channels.Pico.Token(),
"token": cfg.Channels.Pico.Token.String(),
"ws_url": wsURL,
"enabled": cfg.Channels.Pico.Enabled,
})
@@ -110,7 +110,7 @@ func (h *Handler) EnsurePicoChannel(callerOrigin string) (bool, error) {
changed = true
}
if cfg.Channels.Pico.Token() == "" {
if cfg.Channels.Pico.Token.String() == "" {
cfg.Channels.Pico.SetToken(generateSecureToken())
changed = true
}
@@ -150,7 +150,7 @@ func (h *Handler) handlePicoSetup(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]any{
"token": cfg.Channels.Pico.Token(),
"token": cfg.Channels.Pico.Token.String(),
"ws_url": wsURL,
"enabled": true,
"changed": changed,