diff options
Diffstat (limited to 'internal/handlers/settings.go')
| -rw-r--r-- | internal/handlers/settings.go | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/internal/handlers/settings.go b/internal/handlers/settings.go index 9ab832c..d140aaf 100644 --- a/internal/handlers/settings.go +++ b/internal/handlers/settings.go @@ -4,6 +4,7 @@ import ( "encoding/json" "net/http" + "task-dashboard/internal/api" "task-dashboard/internal/auth" "task-dashboard/internal/models" "task-dashboard/internal/store" @@ -21,20 +22,28 @@ func (h *Handler) HandleSettingsPage(w http.ResponseWriter, r *http.Request) { bySource[cfg.Source] = append(bySource[cfg.Source], cfg) } + googleTasksToken, _ := h.store.GetOAuthToken(api.GoogleTasksOAuthSource) + data := struct { - Configs map[string][]models.SourceConfig - Sources []string - SyncLog []store.SyncLogEntry - Agents []models.Agent - CSRFToken string - WebAuthnEnabled bool + Configs map[string][]models.SourceConfig + Sources []string + SyncLog []store.SyncLogEntry + Agents []models.Agent + CSRFToken string + WebAuthnEnabled bool + GoogleTasksOAuthReady bool + GoogleTasksConnected bool + GoogleTasksError string }{ - Configs: bySource, - Sources: []string{"trello", "gcal", "gtasks"}, - SyncLog: syncLog, - Agents: agents, - CSRFToken: auth.GetCSRFTokenFromContext(r.Context()), - WebAuthnEnabled: h.WebAuthnEnabled, + Configs: bySource, + Sources: []string{"trello", "gcal", "gtasks"}, + SyncLog: syncLog, + Agents: agents, + CSRFToken: auth.GetCSRFTokenFromContext(r.Context()), + WebAuthnEnabled: h.WebAuthnEnabled, + GoogleTasksOAuthReady: h.googleTasksOAuthConfig != nil, + GoogleTasksConnected: googleTasksToken != nil, + GoogleTasksError: r.URL.Query().Get("google_tasks_error"), } if err := h.renderer.Render(w, "settings.html", data); err != nil { @@ -148,4 +157,3 @@ func (h *Handler) HandleToggleSourceConfig(w http.ResponseWriter, r *http.Reques w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(map[string]bool{"enabled": enabled}) } - |
