Repository navigation
feat(fields): add a token field, and use it for the Sync token - #41
Merged
Merged
Conversation
input: 'token' holds a key or an id another system uses. A new record gets one as its form opens, and the server makes one for a record created over the API without it. The field is read-only, with Copy and Regenerate, and options.length, options.prefix and options.format shape the token. The docs count of input types was out of date and now says 36.
…c token The token field was read-only and filled itself. It is now a text field with Generate and Copy buttons: a token is typed, pasted, or made at random. options.autoGenerate gives a new record one by itself, in the admin and over the API; it is off by default. The Token under This CMS in the Sync settings is a token field, so its secret no longer has to be invented by hand; the token of the other CMS stays a text field, where it is pasted.
xiaodoudou
added a commit
that referenced
this pull request
Oct 12, 2026
feat(fields): add a token field, and use it for the Sync token
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.
A new field type,
input: 'token', holds a key, a secret or an id that two systems share. You can type it, paste it, or click Generate to make a random one. The Copy button appears once the field has a value. Options set the number of random bytes (8 to 128, 32 by default), a prefix such askey_, and the format (base64urlorhex). WithautoGenerate, a new record gets a token by itself: the form fills the field when it opens, and the server fills it for a record created over the API without one. An update never makes a new token.The local token of the Sync settings now uses this field, with the prefix
sync_, so a node's token can be generated and copied from the form instead of being made up by hand. The remote token stays a plain text field, because it is pasted from the other node.The catalogue has two examples in
resources/text_formats.js:apiKey(prefix, typed or generated) andhexToken(8 bytes in hex, filled on creation).docs/reference/fields/token.mddescribes the field and has three screenshots taken withnpm run docs:screenshots -- --only ^token, and FIELDS.md lists it, which brings the count of input types to 36.New tests cover the token options and generation on both sides, the server filling on create, and the component (typing and pasting, Generate, Copy, auto-fill for a new record only, read-only). Frontend suite: 123 files, 2869 tests pass, and ESLint is clean. Backend suite: 1895 tests pass. Three fail on Windows for reasons that have nothing to do with the branch: the admin start-up test expects a 503 while a dev server was answering on its port, and two tests can't remove their temp folders in cleanup (
EBUSY,cms command optionsandCMS class). The backend suite was not run on Linux here.