Skip to content

fix: let users banned on Hackatime use Lapse - #296

Merged
anscg merged 1 commit into
mainfrom
fix/hackatime-banned-users
Oct 8, 2026
Merged

anscg merged 1 commit into
mainfrom
fix/hackatime-banned-users

Conversation

@anscg

@anscg anscg commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

Hackatime returns 401 on every OAuth endpoint except /me for banned (red) users (ensure_api_access_allowed → api_access_restricted?). Lapse's linkStatus read that 401 as a dead token, so banned users got the "Reconnect Hackatime / Hackatime needs your permission again" modal and banner on every page. Signing in again could never fix it, and their Hackatime sync failed silently.

Fix

  • linkStatus: when /projects returns 401, check /me. If /me still works, the token is fine and the user is restricted: return restricted: true and no relink prompt. Relink is only requested on a 403, or when /me also returns 401. Other Hackatime errors no longer prompt either.
  • Contract: linkStatus gains restricted: boolean.
  • Client: banned users skip the Hackatime step entirely. "Continue" publishes directly on the publish page, the draft page and the Lookout panel, and the "Sync with Hackatime" button is hidden. No notice is shown.
  • Lookout panel context gains hackatimeRestricted (based on trust_factor.trust_level from /me).

Notes

  • Not type-checked locally (no node_modules in my environment).
  • Banned users still can't sync to Hackatime, because Hackatime won't hand out their API key over OAuth.

🤖 Generated with Claude Code

Hackatime answers 401 on every OAuth endpoint but /me for banned (red) users, which Lapse read as a dead token - so
they were stuck on a "Hackatime needs your permission again" prompt that signing in again could never fix.

linkStatus now probes /me when /projects returns 401: if the token still works there, the user is restricted rather
than unlinked. Restricted users skip the Hackatime step when publishing, and the sync button is hidden for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anscg

anscg commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

hi, this is urgent and i checked it end-to-end correctly. merging.

@anscg
anscg merged commit a76bbb6 into main Oct 8, 2026
7 checks passed
@Lamparter
Lamparter deleted the fix/hackatime-banned-users branch October 9, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant