From ab7e7c7abc9bb87907125482ef820ad84530d850 Mon Sep 17 00:00:00 2001 From: Evan Jarrett Date: Wed, 7 Jan 2026 22:44:35 -0600 Subject: [PATCH] fix lint --- pkg/appview/db/export.go | 6 +++--- pkg/appview/handlers/settings.go | 10 +++++++--- pkg/hold/config.go | 1 - pkg/hold/pds/xrpc.go | 14 +++++++------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pkg/appview/db/export.go b/pkg/appview/db/export.go index 8991268..3803742 100644 --- a/pkg/appview/db/export.go +++ b/pkg/appview/db/export.go @@ -84,10 +84,10 @@ type KnownHoldExport struct { // CachedDataNote explains what cached data exists and how to access it type CachedDataNote struct { - Message string `json:"message"` - DeletionNotice string `json:"deletion_notice"` + Message string `json:"message"` + DeletionNotice string `json:"deletion_notice"` YourPDSCollections []string `json:"your_pds_collections"` - HowToAccess string `json:"how_to_access"` + HowToAccess string `json:"how_to_access"` } // ExportUserData gathers all user data for GDPR export diff --git a/pkg/appview/handlers/settings.go b/pkg/appview/handlers/settings.go index 3f782db..78aaa8d 100644 --- a/pkg/appview/handlers/settings.go +++ b/pkg/appview/handlers/settings.go @@ -83,7 +83,9 @@ func (h *SettingsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Parse permissions JSON if present if hold.Permissions != "" { - json.Unmarshal([]byte(hold.Permissions), &display.Permissions) + if err := json.Unmarshal([]byte(hold.Permissions), &display.Permissions); err != nil { + slog.Warn("Failed to parse permissions JSON", "component", "settings", "did", user.DID, "hold_did", hold.HoldDID, "error", err) + } } // Add to data map for JavaScript @@ -221,11 +223,13 @@ func (h *UpdateDefaultHoldHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ if !hasAccess { w.Header().Set("Content-Type", "text/html") - h.Templates.ExecuteTemplate(w, "alert", map[string]string{ + if err := h.Templates.ExecuteTemplate(w, "alert", map[string]string{ "Class": "error", "Icon": "alert-circle", "Message": "You don't have access to this hold", - }) + }); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } return } } diff --git a/pkg/hold/config.go b/pkg/hold/config.go index 1d91bd8..ae5d98f 100644 --- a/pkg/hold/config.go +++ b/pkg/hold/config.go @@ -217,7 +217,6 @@ func getEnvOrDefault(key, defaultValue string) string { return defaultValue } - // RequestCrawl sends a crawl request to the ATProto relay for the given hostname. // This makes the hold's PDS discoverable by the relay network. func RequestCrawl(relayEndpoint, publicURL string) error { diff --git a/pkg/hold/pds/xrpc.go b/pkg/hold/pds/xrpc.go index 60ec551..a36e808 100644 --- a/pkg/hold/pds/xrpc.go +++ b/pkg/hold/pds/xrpc.go @@ -1497,13 +1497,13 @@ func (h *XRPCHandler) HandleGetQuota(w http.ResponseWriter, r *http.Request) { // HoldUserDataExport represents the GDPR data export from a hold service type HoldUserDataExport struct { - ExportedAt time.Time `json:"exported_at"` - HoldDID string `json:"hold_did"` - UserDID string `json:"user_did"` - IsCaptain bool `json:"is_captain"` - CrewRecord *CrewExport `json:"crew_record,omitempty"` - LayerRecords []LayerExport `json:"layer_records"` - StatsRecords []StatsExport `json:"stats_records"` + ExportedAt time.Time `json:"exported_at"` + HoldDID string `json:"hold_did"` + UserDID string `json:"user_did"` + IsCaptain bool `json:"is_captain"` + CrewRecord *CrewExport `json:"crew_record,omitempty"` + LayerRecords []LayerExport `json:"layer_records"` + StatsRecords []StatsExport `json:"stats_records"` } // CrewExport represents a sanitized crew record for export