Create short links directly from the link button dialog

The "Add link button" dialog can now either pick an existing short
link or create a new one (destination + optional shortcode) in the
page's namespace. The block API accepts `newLink` as an alternative
to `targetId`; link and button are created in one transaction, so a
failed request leaves nothing behind. Field errors such as a taken
shortcode are shown inline, and the label is suggested from the
destination's hostname.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 16:37:50 +02:00
co-authored by Claude Opus 5.5
parent 55d2b9433f
commit c3640c8966
5 changed files with 220 additions and 53 deletions
+2
View File
@@ -81,6 +81,8 @@ curl -X POST https://short.example.com/~/api/pages \
Main endpoints: `GET/POST /pages`, `GET/PATCH/DELETE /pages/:id`, `GET/DELETE /pages/:id/stats?days=7|30|90`, `POST /pages/:id/blocks`, `PUT /pages/:id/blocks/order`, `PATCH/DELETE /blocks/:id`, `PUT /pages/:id/avatar`, `GET/POST/DELETE /tokens`.
Admin only: `PUT/DELETE /pin`, `GET /users`, `GET /conflicts`.
Link buttons can reference an existing short link (`{"kind":"link","label":"…","targetId":12}`) or create one in the page's namespace in the same request (`{"kind":"link","label":"…","newLink":{"dest":"https://…","code":"optional"}}`).
## Development
```sh