Skip to content

feat: sync from GitHub and save the lane color from the API - #554

Merged
xHeaven merged 3 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-settings
Oct 19, 2026
Merged

xHeaven merged 3 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-settings

Conversation

@simonhamp

@simonhamp simonhamp commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Lets the mobile app's Account screen do what the web's profile settings do: sync the profile from GitHub and pick a lane color. It follows #130, which added the signed API, and is one of a few small PRs for the endpoints the app (NativePHP/dev-null-app) uses on top of it.

Endpoints

All signed. Both writes answer like GET /api/v1/me.

Request Answer
PUT /api/v1/me/github Runs UpdateUserProfile, like Sync from GitHub. 503 with the new code github_sync_failed and the web's message when GitHub can't be reached. 429 with rate_limited over the web's limit of one sync a minute.
PUT /api/v1/me/lane with {"lane": 0-5 or null, "color": "#rrggbb"} Runs UpdateUserLane with the web's rules. null means Automatic. color is a custom color for the web's color picker, only with a null lane.

GET /api/v1/me, and the answer after signing in on a new device, now also carry what only the user sees in settings: preferred_lane (a lane, a custom color, or null), automatic_lane, sponsors_url and github_synced_at. They come from a new CurrentUserResource, so other people's profiles never get them.

Worth checking

  • The profile-syncs limiter now answers API requests with a rate_limited JSON error, and keeps the toast and redirect for the web.
  • Pastéis mode (feat: switch pastéis mode and give pastéis from the API #557) also adds a CurrentUserResource for its own fields on /me. Whichever of the two merges second will conflict there, and the fix is to keep both sets of fields.

Testing

Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 2,977 tests at 100% coverage.

The app's Account screen has been running against these endpoints on a phone.

The mobile app's Account screen now works like the web's profile settings,
so it needs the same two writes.

PUT /api/v1/me/github runs UpdateUserProfile, like Sync from GitHub. It
shares the web's profile-syncs limit of one a minute, which now answers API
requests with a rate_limited JSON error instead of a redirect. When GitHub
can't be reached the app gets a 503 with github_sync_failed and the web's
message.

PUT /api/v1/me/lane runs UpdateUserLane with the web's rules: a lane from 0
to 5, null for Automatic, or a custom color as lowercase #rrggbb with a
null lane, as the web's color picker does.

Both answer like GET /api/v1/me. That answer, and the one after signing in,
now also carry preferred_lane (a lane, a custom color or null),
automatic_lane, sponsors_url and github_synced_at, which only the signed-in
user gets.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xHeaven
xHeaven merged commit f986109 into dev-null-sh:production Oct 19, 2026
4 of 5 checks passed
@simonhamp
simonhamp deleted the feat/api-settings branch October 19, 2026 23:12
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.

3 participants