feat(sync): paginate Android sync with change tokens
Lint / Lint (push) Successful in 1m8s
Tests / Go backend (push) Failing after 1m23s
Tests / Dashboard checks (push) Failing after 38s
Docker / Docker Build & Push (push) Failing after 6m29s

This commit is contained in:
Gabriel20xx committed 2026-10-20 15:27:53 +00:00
1 parent 0ff94f9b10
commit 97c237be80
76 files changed
+3401 -851

No files matched your search

+14 -1
View File
@@ -146,11 +146,24 @@ func requireAPIToken(db *DB) func(http.Handler) http.Handler {
writeJSONError(w, http.StatusUnauthorized, "Invalid API token")
return
}
next.ServeHTTP(w, r)
ctx := context.WithValue(r.Context(), apiUserIDContextKey{}, userID)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
}
type apiUserIDContextKey struct{}
func requestUserID(r *http.Request) int64 {
if userID, ok := r.Context().Value(apiUserIDContextKey{}).(int64); ok {
return userID
}
if user := sharedauth.UserFromContext(r.Context()); user != nil {
return user.ID
}
return 0
}
func extractBearer(r *http.Request) string {
header := r.Header.Get("Authorization")
if !strings.HasPrefix(header, "Bearer ") {