Repository navigation
feat: switch pastéis mode and give pastéis from the API - #557
Merged
Merged
Conversation
The mobile app gets the web's pastéis mode, so it needs the same two
writes and the counts.
PUT /api/v1/me/pasteis-mode runs UpdateUserPasteisMode, like the switch
in the web's settings, and answers like GET /api/v1/me. That answer, and
the one after signing in, now carry pasteis_mode, pasteis_remaining,
pasteis_resets_at and pasteis_received, which only the signed-in user
gets.
POST /api/v1/commits/{commit}/pasteis runs CreateCommitPastel with the
web's rules: the mode is on, the commit is someone else's and the user
may see it, ten a day that come back at 00:00 UTC, and 60 a minute. It
answers with the commit as its page shows it, plus pasteis_remaining,
pasteis_resets_at and author_pasteis_received. With none left it is a
422 with the new pasteis_exhausted code and the web's message.
Signed commits now always carry pasteis_count and signed profiles
pasteis_received. The web only shows them in pastéis mode and so does
the app, but sending them either way keeps the app's kept answers right
when the mode changes.
This was referenced Oct 19, 2026
simonhamp
marked this pull request as ready for review
October 19, 2026 08:47
jubianchi
added a commit
to jubianchi/dev-null.sh
that referenced
this pull request
Oct 22, 2026
The API's pastéis route (dev-null-sh#557) came with an unnamed `throttle:60,1`, meant to share the web's 60 a minute: both keyed on the user alone. With the web route on the `pasteis` limiter, the two drifted apart, and the API test still incremented the old unnamed key, so nothing caught it. The API route now uses `pasteis` too, and a test checks that sixty pastéis on the web leave none for the API. 🤖 Generated with Claude Code Claude-Session: https://claude.ai/code/session_01Dmjb753wbaMdaJa9vr3pKV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the mobile app use pastéis mode the way the web does: switch it on or off, give pastéis, and show the counts. 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.
PUT /api/v1/me/pasteis-modewith{"enabled": true or false}UpdateUserPasteisMode, like the switch in settings, and answers likeGET /api/v1/mePOST /api/v1/commits/{id}/pasteisCreateCommitPastelwith the web's rules.200with the commit as its page shows it, pluspasteis_remaining,pasteis_resets_atandauthor_pasteis_received, the author's new totalGiving a pastel needs the mode on, someone else's commit the user may see, and one of the user's 10 a day, which come back at 00:00 UTC. With none left it's a
422with the new codepasteis_exhaustedand the web's message. It keeps the web's limit of 60 a minute.GET /api/v1/me, and the answer after signing in on a new device, now carrypasteis_mode,pasteis_remaining,pasteis_resets_atandpasteis_received, from a newCurrentUserResourceso only the user gets them. Signed commits always carrypasteis_count, and signed profilespasteis_received.Worth checking
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.'pasteis_count' => 0added to that list inBookmarkControllerTest.Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 2,969 tests at 100% coverage.
The app's pastéis mode (NativePHP/dev-null-app#12) has been running against these endpoints on a phone.