chirkle 0.4.1 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -202
- package/bin/release/darwin-amd64/chirkle-server +2 -2
- package/bin/release/darwin-arm64/chirkle-server +0 -0
- package/bin/release/linux-amd64/chirkle-server +0 -0
- package/bin/release/linux-arm64/chirkle-server +0 -0
- package/package.json +17 -5
- package/pb_hooks/federation/inbox.js +2 -0
- package/pb_hooks/federation/messages.js +40 -2
- package/pb_hooks/federation/worker.js +7 -3
- package/pb_hooks/lib/collections.js +5 -3
- package/pb_hooks/lib/files.js +36 -0
- package/pb_hooks/lib/handles.js +24 -2
- package/pb_hooks/lib/http.js +2 -2
- package/pb_hooks/lib/inbox.js +6 -5
- package/pb_hooks/lib/media.js +16 -3
- package/pb_hooks/lib/messages.js +16 -6
- package/pb_hooks/lib/pins.js +199 -0
- package/pb_hooks/lib/rooms.js +4 -0
- package/pb_hooks/lib/users.js +33 -2
- package/pb_hooks/main.pb.js +17 -3
- package/pb_hooks/telegram/inbound.js +187 -16
- package/pb_hooks/telegram/links.js +12 -1
- package/pb_hooks/telegram/outbound.js +153 -12
- package/pb_hooks/telegram/worker.js +3 -1
- package/pb_migrations/1760000057_reactions_seen.js +17 -0
- package/pb_migrations/1760000058_users_kind_public.js +20 -0
- package/pb_migrations/1760000059_telegram_media_edits.js +37 -0
- package/pb_migrations/1760000060_pins.js +23 -0
- package/pb_public/assets/{access-UK3L54NR.js → access-23A7N3OD.js} +2 -2
- package/pb_public/assets/access-23A7N3OD.js.br +0 -0
- package/pb_public/assets/access-23A7N3OD.js.gz +0 -0
- package/pb_public/assets/access-XGNXIUR5.css +2 -0
- package/pb_public/assets/access-XGNXIUR5.css.br +0 -0
- package/pb_public/assets/access-XGNXIUR5.css.gz +0 -0
- package/pb_public/assets/access-XGNXIUR5.css.map +7 -0
- package/pb_public/assets/account-EBCPOLWT.css +2 -0
- package/pb_public/assets/account-EBCPOLWT.css.br +0 -0
- package/pb_public/assets/account-EBCPOLWT.css.gz +0 -0
- package/pb_public/assets/account-EBCPOLWT.css.map +7 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.br +0 -0
- package/pb_public/assets/account-api-J6A6IYVX.js.gz +0 -0
- package/pb_public/assets/app-A7HBI65K.js +3 -0
- package/pb_public/assets/app-A7HBI65K.js.br +0 -0
- package/pb_public/assets/app-A7HBI65K.js.gz +0 -0
- package/pb_public/assets/app-A7HBI65K.js.map +7 -0
- package/pb_public/assets/app-HMWQXURS.css +2 -0
- package/pb_public/assets/app-HMWQXURS.css.br +0 -0
- package/pb_public/assets/app-HMWQXURS.css.gz +0 -0
- package/pb_public/assets/app-HMWQXURS.css.map +7 -0
- package/pb_public/assets/chunk-AG73QNUN.js.br +0 -0
- package/pb_public/assets/chunk-AG73QNUN.js.gz +0 -0
- package/pb_public/assets/chunk-DC4TJ7HF.js +2 -0
- package/pb_public/assets/chunk-DC4TJ7HF.js.br +0 -0
- package/pb_public/assets/chunk-DC4TJ7HF.js.gz +0 -0
- package/pb_public/assets/chunk-DC4TJ7HF.js.map +7 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.br +0 -0
- package/pb_public/assets/chunk-DCLJRQ53.js.gz +0 -0
- package/pb_public/assets/chunk-RPCBA7VF.js.br +0 -0
- package/pb_public/assets/chunk-RPCBA7VF.js.gz +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js +2 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.br +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.gz +0 -0
- package/pb_public/assets/chunk-RYZHXNLF.js.map +7 -0
- package/pb_public/assets/chunk-SM542ZXL.js +2 -0
- package/pb_public/assets/chunk-SM542ZXL.js.br +0 -0
- package/pb_public/assets/chunk-SM542ZXL.js.gz +0 -0
- package/pb_public/assets/chunk-SM542ZXL.js.map +7 -0
- package/pb_public/assets/chunk-SZMAZMR4.js +2 -0
- package/pb_public/assets/chunk-SZMAZMR4.js.br +0 -0
- package/pb_public/assets/chunk-SZMAZMR4.js.gz +0 -0
- package/pb_public/assets/chunk-SZMAZMR4.js.map +7 -0
- package/pb_public/assets/chunk-UZDXAORM.js.br +0 -0
- package/pb_public/assets/chunk-UZDXAORM.js.gz +0 -0
- package/pb_public/assets/chunk-VSHXXDW4.js +2 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.br +0 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.gz +0 -0
- package/pb_public/assets/chunk-VSHXXDW4.js.map +7 -0
- package/pb_public/assets/chunk-VTOUI25E.js.br +0 -0
- package/pb_public/assets/chunk-VTOUI25E.js.gz +0 -0
- package/pb_public/assets/chunk-WDXT4S4J.js +2 -0
- package/pb_public/assets/chunk-WDXT4S4J.js.br +0 -0
- package/pb_public/assets/chunk-WDXT4S4J.js.gz +0 -0
- package/pb_public/assets/chunk-WDXT4S4J.js.map +7 -0
- package/pb_public/assets/collections-FZB6G4W4.css +2 -0
- package/pb_public/assets/collections-FZB6G4W4.css.br +0 -0
- package/pb_public/assets/collections-FZB6G4W4.css.gz +0 -0
- package/pb_public/assets/collections-FZB6G4W4.css.map +7 -0
- package/pb_public/assets/emoji-IHRUMGCY.css +2 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.br +0 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.gz +0 -0
- package/pb_public/assets/emoji-IHRUMGCY.css.map +7 -0
- package/pb_public/assets/{emoji-picker-K6JTK2GV.js → emoji-picker-K4DOKYL3.js} +2 -2
- package/pb_public/assets/emoji-picker-K4DOKYL3.js.br +0 -0
- package/pb_public/assets/emoji-picker-K4DOKYL3.js.gz +0 -0
- package/pb_public/assets/{emoji-picker-K6JTK2GV.js.map → emoji-picker-K4DOKYL3.js.map} +2 -2
- package/pb_public/assets/forward-OR7S3EHR.js +2 -0
- package/pb_public/assets/forward-OR7S3EHR.js.br +0 -0
- package/pb_public/assets/forward-OR7S3EHR.js.gz +0 -0
- package/pb_public/assets/forward-OR7S3EHR.js.map +7 -0
- package/pb_public/assets/inbox-2AXY3INA.css +2 -0
- package/pb_public/assets/inbox-2AXY3INA.css.br +0 -0
- package/pb_public/assets/inbox-2AXY3INA.css.gz +0 -0
- package/pb_public/assets/inbox-2AXY3INA.css.map +7 -0
- package/pb_public/assets/{inbox-CLMYESNI.js → inbox-A46J7ZU2.js} +2 -2
- package/pb_public/assets/inbox-A46J7ZU2.js.br +0 -0
- package/pb_public/assets/inbox-A46J7ZU2.js.gz +0 -0
- package/pb_public/assets/{inbox-CLMYESNI.js.map → inbox-A46J7ZU2.js.map} +2 -2
- package/pb_public/assets/{invite-OGT5E2MZ.js → invite-VGT2DI2L.js} +2 -2
- package/pb_public/assets/invite-VGT2DI2L.js.br +0 -0
- package/pb_public/assets/invite-VGT2DI2L.js.gz +0 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js.br +0 -0
- package/pb_public/assets/invite-api-7G7XPXQW.js.gz +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js +2 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.br +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.gz +0 -0
- package/pb_public/assets/lazy-OVEJT5CP.js.map +7 -0
- package/pb_public/assets/{login-TK6K4WGB.js → login-TN6R7N2U.js} +2 -2
- package/pb_public/assets/login-TN6R7N2U.js.br +0 -0
- package/pb_public/assets/login-TN6R7N2U.js.gz +0 -0
- package/pb_public/assets/media-BCKZQR2R.css +2 -0
- package/pb_public/assets/media-BCKZQR2R.css.br +0 -0
- package/pb_public/assets/media-BCKZQR2R.css.gz +0 -0
- package/pb_public/assets/media-BCKZQR2R.css.map +7 -0
- package/pb_public/assets/{media-WZ4653L5.js → media-VCJWBQJZ.js} +2 -2
- package/pb_public/assets/media-VCJWBQJZ.js.br +0 -0
- package/pb_public/assets/media-VCJWBQJZ.js.gz +0 -0
- package/pb_public/assets/{mention-suggest-ODJD2IC5.js → mention-suggest-K3UUHR4D.js} +2 -2
- package/pb_public/assets/mention-suggest-K3UUHR4D.js.br +0 -0
- package/pb_public/assets/mention-suggest-K3UUHR4D.js.gz +0 -0
- package/pb_public/assets/notify-EPDM772N.js.br +0 -0
- package/pb_public/assets/notify-EPDM772N.js.gz +0 -0
- package/pb_public/assets/pins-DSUFB5EW.css +2 -0
- package/pb_public/assets/pins-DSUFB5EW.css.br +0 -0
- package/pb_public/assets/pins-DSUFB5EW.css.gz +0 -0
- package/pb_public/assets/pins-DSUFB5EW.css.map +7 -0
- package/pb_public/assets/pins-XWBYZN4P.js +2 -0
- package/pb_public/assets/pins-XWBYZN4P.js.br +0 -0
- package/pb_public/assets/pins-XWBYZN4P.js.gz +0 -0
- package/pb_public/assets/pins-XWBYZN4P.js.map +7 -0
- package/pb_public/assets/profile-NQ6QCQIB.js +2 -0
- package/pb_public/assets/profile-NQ6QCQIB.js.br +0 -0
- package/pb_public/assets/profile-NQ6QCQIB.js.gz +0 -0
- package/pb_public/assets/profile-NQ6QCQIB.js.map +7 -0
- package/pb_public/assets/rooms-forms-NYMPXVUQ.js +2 -0
- package/pb_public/assets/rooms-forms-NYMPXVUQ.js.br +0 -0
- package/pb_public/assets/rooms-forms-NYMPXVUQ.js.gz +0 -0
- package/pb_public/assets/rooms-forms-NYMPXVUQ.js.map +7 -0
- package/pb_public/assets/search-HOPAWIMQ.js +2 -0
- package/pb_public/assets/search-HOPAWIMQ.js.br +0 -0
- package/pb_public/assets/search-HOPAWIMQ.js.gz +0 -0
- package/pb_public/assets/search-HOPAWIMQ.js.map +7 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css +2 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.br +0 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.gz +0 -0
- package/pb_public/assets/sidebar-forms-ETSRVSPY.css.map +7 -0
- package/pb_public/assets/stats-5GSWDHZI.css +2 -0
- package/pb_public/assets/stats-5GSWDHZI.css.br +0 -0
- package/pb_public/assets/stats-5GSWDHZI.css.gz +0 -0
- package/pb_public/assets/stats-5GSWDHZI.css.map +7 -0
- package/pb_public/assets/{stats-GTO2H6PG.js → stats-Y3LIXAZR.js} +2 -2
- package/pb_public/assets/stats-Y3LIXAZR.js.br +0 -0
- package/pb_public/assets/stats-Y3LIXAZR.js.gz +0 -0
- package/pb_public/assets/stats-Y3LIXAZR.js.map +7 -0
- package/pb_public/assets/switcher-TFSO45KV.js.br +0 -0
- package/pb_public/assets/switcher-TFSO45KV.js.gz +0 -0
- package/pb_public/assets/user-search-GUNMIBSB.js +2 -0
- package/pb_public/assets/user-search-GUNMIBSB.js.br +0 -0
- package/pb_public/assets/user-search-GUNMIBSB.js.gz +0 -0
- package/pb_public/assets/{viewer-2Y5FJBW4.js → viewer-BHKVAADP.js} +2 -2
- package/pb_public/assets/viewer-BHKVAADP.js.br +0 -0
- package/pb_public/assets/viewer-BHKVAADP.js.gz +0 -0
- package/pb_public/assets/viewer-JBZU46HP.css +2 -0
- package/pb_public/assets/viewer-JBZU46HP.css.br +0 -0
- package/pb_public/assets/viewer-JBZU46HP.css.gz +0 -0
- package/pb_public/assets/{viewer-P7GYCBYM.css.map → viewer-JBZU46HP.css.map} +2 -2
- package/pb_public/index.html +9 -8
- package/pb_public/stats.html +3 -3
- package/scripts/service.mjs +1 -1
- package/scripts/start.mjs +2 -1
- package/pb_public/assets/access-GPRLOZOO.css +0 -2
- package/pb_public/assets/access-GPRLOZOO.css.map +0 -7
- package/pb_public/assets/account-CT2BVMAX.css +0 -2
- package/pb_public/assets/account-CT2BVMAX.css.map +0 -7
- package/pb_public/assets/app-HB3NZHQ2.js +0 -3
- package/pb_public/assets/app-HB3NZHQ2.js.map +0 -7
- package/pb_public/assets/app-XJ73EU5O.css +0 -2
- package/pb_public/assets/app-XJ73EU5O.css.map +0 -7
- package/pb_public/assets/chunk-56ACD3V5.js +0 -2
- package/pb_public/assets/chunk-56ACD3V5.js.map +0 -7
- package/pb_public/assets/chunk-DZC4SY4M.js +0 -2
- package/pb_public/assets/chunk-DZC4SY4M.js.map +0 -7
- package/pb_public/assets/chunk-N2OFGBCZ.js +0 -2
- package/pb_public/assets/chunk-N2OFGBCZ.js.map +0 -7
- package/pb_public/assets/chunk-OKIIBH7O.js +0 -2
- package/pb_public/assets/chunk-OKIIBH7O.js.map +0 -7
- package/pb_public/assets/chunk-WR25F7FU.js +0 -2
- package/pb_public/assets/chunk-WR25F7FU.js.map +0 -7
- package/pb_public/assets/collections-DHJEOLHW.css +0 -2
- package/pb_public/assets/collections-DHJEOLHW.css.map +0 -7
- package/pb_public/assets/emoji-WWNPWCF3.css +0 -2
- package/pb_public/assets/emoji-WWNPWCF3.css.map +0 -7
- package/pb_public/assets/forward-267HRNPY.js +0 -2
- package/pb_public/assets/forward-267HRNPY.js.map +0 -7
- package/pb_public/assets/inbox-3FSOPY2T.css +0 -2
- package/pb_public/assets/inbox-3FSOPY2T.css.map +0 -7
- package/pb_public/assets/lazy-H3KIJVB5.js +0 -2
- package/pb_public/assets/lazy-H3KIJVB5.js.map +0 -7
- package/pb_public/assets/media-7TCBG7WM.css +0 -2
- package/pb_public/assets/media-7TCBG7WM.css.map +0 -7
- package/pb_public/assets/profile-3R6S5QYS.js +0 -2
- package/pb_public/assets/profile-3R6S5QYS.js.map +0 -7
- package/pb_public/assets/search-WCHOGAJQ.js +0 -2
- package/pb_public/assets/search-WCHOGAJQ.js.map +0 -7
- package/pb_public/assets/stats-A2TBRUI6.css +0 -2
- package/pb_public/assets/stats-A2TBRUI6.css.map +0 -7
- package/pb_public/assets/stats-GTO2H6PG.js.map +0 -7
- package/pb_public/assets/user-search-3HQOCQWL.js +0 -2
- package/pb_public/assets/viewer-P7GYCBYM.css +0 -2
- /package/pb_public/assets/{access-UK3L54NR.js.map → access-23A7N3OD.js.map} +0 -0
- /package/pb_public/assets/{invite-OGT5E2MZ.js.map → invite-VGT2DI2L.js.map} +0 -0
- /package/pb_public/assets/{login-TK6K4WGB.js.map → login-TN6R7N2U.js.map} +0 -0
- /package/pb_public/assets/{media-WZ4653L5.js.map → media-VCJWBQJZ.js.map} +0 -0
- /package/pb_public/assets/{mention-suggest-ODJD2IC5.js.map → mention-suggest-K3UUHR4D.js.map} +0 -0
- /package/pb_public/assets/{user-search-3HQOCQWL.js.map → user-search-GUNMIBSB.js.map} +0 -0
- /package/pb_public/assets/{viewer-2Y5FJBW4.js.map → viewer-BHKVAADP.js.map} +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Mentions & replies, which load on first use).
|
|
|
8
8
|
|
|
9
9
|
<picture>
|
|
10
10
|
<source media="(prefers-color-scheme: dark)" srcset="docs/screenshot-dark.png">
|
|
11
|
-
<img alt="A room in Chirkle: the
|
|
11
|
+
<img alt="A room in Chirkle: the sidebar on the left, with the faces of who mentioned you, unread dots and mention counts; messages with avatars, a reply, an @mention of you, a photo and emoji reactions on the right" src="docs/screenshot-light.png">
|
|
12
12
|
</picture>
|
|
13
13
|
|
|
14
14
|
- Runs on a $5 VPS (1 vCPU, 1 GB of RAM): about 1,000 people online at a normal pace (2,000
|
|
@@ -31,7 +31,7 @@ Mentions & replies, which load on first use).
|
|
|
31
31
|
- Links in messages are clickable and open in a new tab (http, https and www. addresses only)
|
|
32
32
|
- Emoji: a picker in the composer with search by name, ":name" suggestions as you type, and reactions on any message
|
|
33
33
|
(as many different ones as you like), live for everyone
|
|
34
|
-
- Attachments: up to 10 files of 20 MB per message, with an upload progress bar; images shown as thumbnails and videos as their first frame (4 tiles, then "+N"); files
|
|
34
|
+
- Attachments: up to 10 files of 20 MB per message, with an upload progress bar; images shown as thumbnails and videos as their first frame (4 tiles, then "+N"); files open by a link that can't be guessed, and stops working when the message is deleted
|
|
35
35
|
- Image viewer: click a thumbnail to see it full size (or a video to play it) and step through the room's images and videos (buttons, arrow keys, swipe);
|
|
36
36
|
loaded only when first used, so it adds nothing to the page's first load
|
|
37
37
|
- Collections: save any image or video from the chat to collections of your own, public or private, and attach from them to messages; subscribe to other people's public collections to use theirs too, with a count of what's new and the new items highlighted; media attached from a collection link to it (or say "Private collection")
|
|
@@ -41,6 +41,8 @@ Mentions & replies, which load on first use).
|
|
|
41
41
|
- What you were typing is kept per room, even across a reload; "Jump to latest" whenever you are scrolled up
|
|
42
42
|
- Invite links for private rooms: share one link that adds whoever opens it (after logging in or signing up) as a
|
|
43
43
|
member; it works for 1, 7 or 30 days and can be revoked or replaced at any time (web and Android)
|
|
44
|
+
- Pinned messages: up to 20 per room or DM, in a bar under its header; click to go to each, however far back. A room's
|
|
45
|
+
creator and moderators pin in rooms, either person in a DM; edits show in the pin, a deleted message is unpinned (web and the console client)
|
|
44
46
|
- Moderators, chosen by the admin: they delete anyone's messages, change any room's access, archive rooms, and ban or
|
|
45
47
|
unban people (a banned account can't log in); DMs and private rooms they aren't in stay out of their reach
|
|
46
48
|
- Usage statistics at `/stats` for moderators and the admin: people online now, messages and active people over
|
|
@@ -49,7 +51,7 @@ Mentions & replies, which load on first use).
|
|
|
49
51
|
- Your own branding (title and logo) and, if you like, invite-only signups: set by the admin in PocketBase
|
|
50
52
|
- Forgot password: once the admin sets up email, "Forgot password?" on the login page (web and Android) emails a link
|
|
51
53
|
that sets a new password and logs out every device
|
|
52
|
-
- Telegram bridge (optional): link rooms to Telegram groups through a bot; messages, replies, edits, files and (with the bot an admin) reactions go both ways (deletes from Chirkle to Telegram), Telegram people show under stand-in accounts with their names and pictures — see [Telegram
|
|
54
|
+
- Telegram bridge (optional): link rooms to Telegram groups through a bot; messages, replies, edits, files and (with the bot an admin) reactions go both ways (deletes from Chirkle to Telegram), Telegram people show under stand-in accounts with their names and pictures — see [the Telegram bridge](https://chirkle.com/docs/telegram/)
|
|
53
55
|
- Fast room switching: each room's latest messages are kept in the browser (IndexedDB) and shown at once while the
|
|
54
56
|
server answers; unread rooms are fetched ahead. Attachment thumbnails are kept by the service worker, so going back
|
|
55
57
|
to a room (or reloading) doesn't download them again. All of it is cleared on logout
|
|
@@ -59,14 +61,17 @@ Mentions & replies, which load on first use).
|
|
|
59
61
|
- Installable as an app (PWA: Add to Home Screen, the browser's Install button); it opens offline to its shell
|
|
60
62
|
- Optimistic sending with safe retries, reconnect gap-fill, light/dark themes, works on phones
|
|
61
63
|
- A native Android app (Kotlin, Jetpack Compose) with the same features, notifications and a 3 MB download — see
|
|
62
|
-
[Android app](
|
|
64
|
+
[the Android app](https://chirkle.com/docs/android/)
|
|
63
65
|
|
|
64
66
|
<picture>
|
|
65
67
|
<source media="(prefers-color-scheme: dark)" srcset="docs/collections-dark.png">
|
|
66
68
|
<img alt="A collection in Chirkle: the private Moodboard's pictures by month, with Upload, Rename and Make public; the sidebar lists your collections with their counts and a followed one with 3 new" src="docs/collections-light.png">
|
|
67
69
|
</picture>
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
**Documentation: [chirkle.com/docs](https://chirkle.com/docs/)**: installing and deploying, the user guide, administration, the
|
|
72
|
+
Android app, linked servers, the Telegram bridge and the configuration reference.
|
|
73
|
+
|
|
74
|
+
Design: [`docs/DESIGN.md`](docs/DESIGN.md) · Android app: [`docs/ANDROID.md`](docs/ANDROID.md) · Console client: [`docs/CLI.md`](docs/CLI.md) · QA: [`docs/QA.md`](docs/QA.md) · Refactoring plan: [`docs/REFACTOR.md`](docs/REFACTOR.md) · Archived plans: [MVP build](docs/history/BUILD_PLAN.md), [avatars, DMs, attachments](docs/history/NEXT_FEATURES_PLAN.md)
|
|
70
75
|
|
|
71
76
|
## Requirements
|
|
72
77
|
|
|
@@ -93,8 +98,7 @@ Open the page and sign up. The first run prints a link to create the admin (supe
|
|
|
93
98
|
`npx chirkle superuser upsert you@example.com <password>` (`npm start -- superuser upsert …` in a clone).
|
|
94
99
|
`HOST` and `PORT` choose the address (default `127.0.0.1:8090`; `HOST=0.0.0.0` to reach it from other machines),
|
|
95
100
|
`CHIRKLE_DATA` the data directory (default `./pb_data`), and any other `pocketbase serve` flags can follow
|
|
96
|
-
(`npx chirkle --http=0.0.0.0:80`).
|
|
97
|
-
apply as they are. The package ships the server built for Linux and macOS (x64, arm64): no Go or PocketBase download
|
|
101
|
+
(`npx chirkle --http=0.0.0.0:80`). Every setting is in the [configuration reference](https://chirkle.com/docs/reference/configuration/). The package ships the server built for Linux and macOS (x64, arm64): no Go or PocketBase download
|
|
98
102
|
needed.
|
|
99
103
|
|
|
100
104
|
## Getting started (development)
|
|
@@ -130,8 +134,9 @@ The PocketBase admin UI is at http://127.0.0.1:8090/_/ (create a superuser with
|
|
|
130
134
|
| `npm run doctor` | Is this machine ready for the tests? Go, the server binary, ffmpeg, versitygw, free space in `TMPDIR`, stray test servers, free e2e ports, and a browser that starts and draws text (`-- --browsers=chromium,firefox,webkit`). The e2e setup runs it first |
|
|
131
135
|
|
|
132
136
|
Every test run starts its own PocketBase on a free port with a temp data dir — nothing to clean up, and no fakes
|
|
133
|
-
except a stub Telegram Bot API for the bridge's tests. CI (`.github/workflows/ci.yml`) runs
|
|
134
|
-
per browser
|
|
137
|
+
except a stub Telegram Bot API for the bridge's tests. CI (`.github/workflows/ci.yml`) runs small jobs all side by side, so a failed one is re-run alone: typecheck, lint,
|
|
138
|
+
build, Go, unit, component, integration (3 shards), e2e (2 shards per browser: Chromium, Firefox, WebKit), the speed
|
|
139
|
+
check, and the Android app's lint, tests and size. A final "CI passed" job is green only when all of them are.
|
|
135
140
|
|
|
136
141
|
## Project layout
|
|
137
142
|
|
|
@@ -151,150 +156,42 @@ android/ the Android app (docs/ANDROID.md): core/data (API, realtime, da
|
|
|
151
156
|
|
|
152
157
|
## Deploying
|
|
153
158
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
On a Linux server with Node 22+, with a domain pointing at it, this installs Chirkle as a systemd service that serves
|
|
157
|
-
HTTPS itself (Let's Encrypt, on :80/:443):
|
|
159
|
+
On a Linux server with Node 22+ and a domain pointing at it, one command installs Chirkle as a systemd service that
|
|
160
|
+
serves HTTPS itself (Let's Encrypt, on :80/:443):
|
|
158
161
|
|
|
159
162
|
```sh
|
|
160
163
|
sudo npx chirkle install-service chat.example.com
|
|
161
|
-
sudo -u chirkle /opt/chirkle/chirkle-server superuser upsert you@example.com <password> --dir=/opt/chirkle/pb_data
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
It copies the server, `pb_public/`, `pb_migrations/` and `pb_hooks/` to `/opt/chirkle`, creates the system user
|
|
165
|
-
`chirkle`, which owns the data directory `/opt/chirkle/pb_data` (and nothing else), writes
|
|
166
|
-
`/etc/systemd/system/chirkle.service` (sandboxed: `ProtectSystem`, `ProtectHome`, `NoNewPrivileges`), and enables and
|
|
167
|
-
starts it. Run it again — `sudo npx chirkle@latest install-service chat.example.com` — to upgrade: the files are
|
|
168
|
-
replaced and the service restarted, the data stays. `sudo npx chirkle uninstall-service` stops and removes the unit
|
|
169
|
-
(files and data are left for you to delete).
|
|
170
|
-
|
|
171
|
-
- Without a domain it listens on `127.0.0.1:8090` for a reverse proxy on the same machine, and sets
|
|
172
|
-
`TRUSTED_PROXY=X-Forwarded-For` (see below); `--http=<addr>` picks another address (trusted only on loopback).
|
|
173
|
-
- `--prefix=<dir>`, `--data=<dir>`, `--user=<name>`, `--name=<unit>` (several instances side by side) change the
|
|
174
|
-
defaults; any other flag goes to `serve`.
|
|
175
|
-
- `--dry-run` prints the unit file and what it would do, and changes nothing; use it to write the unit yourself.
|
|
176
|
-
- More settings (`FFMPEG=`, other environment): `sudo systemctl edit chirkle`, which survives reinstalls.
|
|
177
|
-
|
|
178
|
-
### By hand
|
|
179
|
-
|
|
180
|
-
Build once, then copy `bin/chirkle-server`, `pb_public/`, `pb_migrations/` and `pb_hooks/` to the server. It is PocketBase
|
|
181
|
-
with the hot paths in Go (`server/`): the same commands and flags as the `pocketbase` binary. Go builds it for another
|
|
182
|
-
platform with `GOOS`/`GOARCH` (`node scripts/build-server.mjs --all` builds them all into `bin/release/`).
|
|
183
|
-
Migrations run automatically on start, and nothing is served until they are done, so they change only the database.
|
|
184
|
-
What stored files need moving (the shared files of DESIGN.md §37) the media worker does afterwards, while the server
|
|
185
|
-
runs.
|
|
186
|
-
|
|
187
|
-
```sh
|
|
188
|
-
npm ci && npm run setup && npm run build
|
|
189
|
-
rsync -a bin/chirkle-server pb_public pb_migrations pb_hooks server:/opt/chirkle/
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
With a domain pointing at the server, PocketBase serves HTTPS itself (Let's Encrypt): run
|
|
193
|
-
`chirkle-server serve chat.example.com --hooksPool=100 --dir=… --publicDir=… --migrationsDir=… --hooksDir=…` under your
|
|
194
|
-
init system with `CAP_NET_BIND_SERVICE` (`npx chirkle install-service chat.example.com --dry-run` prints a systemd unit
|
|
195
|
-
for it).
|
|
196
|
-
|
|
197
|
-
Behind an existing reverse proxy instead, use `serve --http=127.0.0.1:8090` and proxy to it (keep
|
|
198
|
-
`/api/realtime` unbuffered — it is a Server-Sent Events stream — and let request bodies through up to 210 MB, since a
|
|
199
|
-
message may carry 10 files of 20 MB), and start PocketBase with
|
|
200
|
-
`TRUSTED_PROXY=X-Forwarded-For` (`Environment=` in the unit). The rate limits are per client IP: without it, every
|
|
201
|
-
request seems to come from the proxy, and one client tripping a limit trips it for everyone. The rightmost address of
|
|
202
|
-
the header is used, the one your proxy added. The Docker image sets it (Dokku always runs a proxy in front); run it
|
|
203
|
-
with `-e TRUSTED_PROXY=off` if clients reach port 8090 directly, since they could then choose their own IP. Unset, the
|
|
204
|
-
setting is left as configured under *Settings → Application* in the admin UI.
|
|
205
|
-
|
|
206
|
-
### Dokku
|
|
207
|
-
|
|
208
|
-
The `Dockerfile` builds the production image (frontend + pinned PocketBase), and `app.json` gives Dokku its health
|
|
209
|
-
check. On the server:
|
|
210
|
-
|
|
211
|
-
```sh
|
|
212
|
-
dokku apps:create chirkle
|
|
213
|
-
# All data (SQLite + uploads) lives in /pb_data: keep it on the host. The directory is owned by uid 32767, the
|
|
214
|
-
# image's user.
|
|
215
|
-
dokku storage:ensure-directory chirkle
|
|
216
|
-
dokku storage:mount chirkle /var/lib/dokku/data/storage/chirkle:/pb_data
|
|
217
|
-
dokku domains:set chirkle chat.example.com
|
|
218
|
-
# nginx allows 1 MB bodies by default; a message may carry 10 files of 20 MB.
|
|
219
|
-
dokku nginx:set chirkle client-max-body-size 210m
|
|
220
|
-
dokku letsencrypt:enable chirkle # with the dokku-letsencrypt plugin
|
|
221
164
|
```
|
|
222
165
|
|
|
223
|
-
|
|
224
|
-
`.github/workflows/image.yml` pushes `ghcr.io/border-radius/chirkle:<commit>` (and `:latest`), so the server only pulls
|
|
225
|
-
and restarts, however many apps run it:
|
|
166
|
+
The documentation covers the rest:
|
|
226
167
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Or build on the server: `git push dokku master` from a clone with `dokku@server:chirkle` as the `dokku` remote, or
|
|
236
|
-
`dokku git:sync --build chirkle https://github.com/border-radius/chirkle.git master`. Then create a superuser:
|
|
237
|
-
|
|
238
|
-
```sh
|
|
239
|
-
dokku run chirkle /app/chirkle-server superuser upsert you@example.com <password> --dir=/pb_data
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
Settings go in as environment variables (`dokku config:set chirkle KEY=value`, which restarts the app); the image already
|
|
243
|
-
sets `TRUSTED_PROXY` for Dokku's proxy. `dokku logs chirkle -t` shows PocketBase's output; the app's own log (request
|
|
244
|
-
log and errors from hooks) is in the admin UI under *Logs*.
|
|
245
|
-
|
|
246
|
-
### Running it
|
|
247
|
-
|
|
248
|
-
**Branding and invite-only signups:** in the admin UI, *Collections → site*, edit the one record: `title` and `logo`
|
|
249
|
-
are shown in the app bar, on the login page and in the tab's title. Tick `invite_only` and fill `invite_code` to let
|
|
250
|
-
only people who have the code sign up (they enter it on the Sign up form; it is case-sensitive). Change the code to stop
|
|
251
|
-
the old one working; leave it empty to close signups. Existing accounts are unaffected, and you can still create
|
|
252
|
-
accounts yourself under *Collections → users*.
|
|
253
|
-
|
|
254
|
-
**Moderators and statistics:** in the admin UI, *Collections → users*, tick `moderator` on someone's record. They
|
|
255
|
-
then delete messages, change room access, archive rooms and ban people from the app (`banned` on the same record
|
|
256
|
-
undoes a ban), and find usage statistics on Settings; superusers signed in to the admin UI open `/stats` directly.
|
|
257
|
-
Tick `no_stats` on the *site* record to stop recording them.
|
|
258
|
-
|
|
259
|
-
**Forgot password:** in the admin UI, set *Settings → Application → Application URL* to the server's public
|
|
260
|
-
address (the emailed link starts with it) and the sender under *Settings → Mail settings*, and turn on *Use SMTP
|
|
261
|
-
mail server* with your provider's host, port and login; *Send test email* checks it. Only then do the login pages
|
|
262
|
-
offer "Forgot password?" (an SMTP server set but turned off isn't used). The link opens `/reset-password/…` on the
|
|
263
|
-
web, works once for 30 minutes, and logs out every device of the account. The email's wording is under *Collections →
|
|
264
|
-
users → Options → Default Password reset email template*; keep `{APP_URL}/reset-password/{TOKEN}` as its link.
|
|
265
|
-
|
|
266
|
-
**Backups:** in the admin UI, *Settings → Backups* — schedule automatic backups (optionally to S3-compatible
|
|
267
|
-
storage). Uploaded files (avatars, attachments) live in `pb_data/storage` (or S3, under *Settings → Files storage*) and
|
|
268
|
-
are part of the backups, so plan disk space for them. **Rate limits** (per IP: messages 10 per 5 s, edits/deletes 20
|
|
269
|
-
per 10 s, reactions 30 per 10 s, forwarding and deleting several messages 20 requests per minute each, password changes 5 per minute, password reset emails 5 per 10 minutes, new rooms 5 per minute, opening DMs 10 per minute, marking rooms read 120 per minute, signups 20 per minute; PocketBase defaults for the rest)
|
|
270
|
-
are set by the migrations and adjustable under *Settings → Rate limits*.
|
|
168
|
+
- [Run it on a server](https://chirkle.com/docs/deploy/): the one-command install and its options, updating, uninstalling, and running the
|
|
169
|
+
server by hand
|
|
170
|
+
- [Docker](https://chirkle.com/docs/deploy/docker/) and [Dokku](https://chirkle.com/docs/deploy/dokku/), including running the image GitHub builds for every
|
|
171
|
+
commit on `master` and following it from cron
|
|
172
|
+
- [Behind a reverse proxy](https://chirkle.com/docs/deploy/reverse-proxy/): nginx and Caddy examples, and `TRUSTED_PROXY`
|
|
173
|
+
- [Administration](https://chirkle.com/docs/admin/): branding, invite-only signups, moderators, anonymous rooms, email, backups and S3,
|
|
174
|
+
rate limits, [link previews and video thumbnails](https://chirkle.com/docs/admin/previews-and-thumbnails/), metrics
|
|
175
|
+
- [Configuration reference](https://chirkle.com/docs/reference/configuration/): every environment variable, flag and setting in one place
|
|
271
176
|
|
|
272
177
|
## Android app
|
|
273
178
|
|
|
274
|
-
|
|
275
|
-
|
|
179
|
+
A native client for any server running Chirkle (Kotlin, Jetpack Compose), with several accounts at once on one server
|
|
180
|
+
or many, and notifications without Google services. Installing it, and what a server's admin can set up for it (room
|
|
181
|
+
links that open in the app, a minimum app version, a build for your own server):
|
|
182
|
+
[the Android app](https://chirkle.com/docs/android/) and [for admins](https://chirkle.com/docs/android/for-admins/).
|
|
276
183
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
rest. Its tests start the server from `bin/`, so run `npm run setup` first.
|
|
184
|
+
To work on it (`android/`), you need JDK 17+ (21 recommended) and the Android SDK (`ANDROID_HOME`, or `sdk.dir` in
|
|
185
|
+
`android/local.properties`); Gradle fetches the rest. Its tests start the server from `bin/`, so run `npm run setup`
|
|
186
|
+
first.
|
|
281
187
|
|
|
282
188
|
```sh
|
|
283
189
|
cd android
|
|
284
190
|
./gradlew assembleDebug # app/build/outputs/apk/debug: offers http://10.0.2.2:8090 (the dev server, from the emulator)
|
|
285
191
|
./gradlew check # lint, unit tests, API tests against PocketBase, UI tests on Robolectric
|
|
286
|
-
./gradlew checkApkSize -Pchirkle.server=https://chat.example.org -Pchirkle.appId=org.example.chirkle
|
|
287
192
|
```
|
|
288
193
|
|
|
289
|
-
|
|
290
|
-
A build only sets the server offered first: `-Pchirkle.devServer=http://192.168.1.20:8090` for a debug build on a device,
|
|
291
|
-
`chirkle.server` for a release (without one, the app asks for a server, and no host's links open in the app). Debug builds
|
|
292
|
-
take http addresses; release builds take https only. The app notifies of DMs and replies to you by checking each
|
|
293
|
-
account's server about every 15 minutes (WorkManager), with no Google services and nothing to set up on the server
|
|
294
|
-
(ANDROID.md §21). Links to rooms on the build's server open in the app once `ANDROID_CERT_SHA256` is
|
|
295
|
-
set (`/.well-known/assetlinks.json`; `ANDROID_APP_ID` only for a build with another `chirkle.appId`). An admin can set
|
|
296
|
-
`min_android_version` on the site record to make older apps ask for an update. What is built and what isn't yet:
|
|
297
|
-
[`docs/ANDROID.md` §16](docs/ANDROID.md#16-implementation-2026-10-18), and [`android/PARITY.md`](android/PARITY.md).
|
|
194
|
+
Design: [`docs/ANDROID.md`](docs/ANDROID.md). What it has of the web app's features: [`android/PARITY.md`](android/PARITY.md).
|
|
298
195
|
|
|
299
196
|
## Releasing
|
|
300
197
|
|
|
@@ -305,77 +202,16 @@ Commit, push, then publish a GitHub Release with the new tag `v0.2.0`. The Relea
|
|
|
305
202
|
stages `chirkle@0.2.0` on npm; approve it on npmjs.com (2FA) to publish it. Setup and details:
|
|
306
203
|
[`docs/ANDROID.md` §28.7](docs/ANDROID.md#287-one-release-for-the-app-and-the-npm-package-2026-11-08).
|
|
307
204
|
|
|
308
|
-
## Link previews
|
|
309
|
-
|
|
310
|
-
Messages show a line under them for each link: the page's favicon and title ([`docs/DESIGN.md` §28](docs/design/28-link-previews.md)).
|
|
311
|
-
The server fetches them with `curl` (in the Docker image), only from public addresses. Set `LINK_PREVIEWS=off` to turn
|
|
312
|
-
it off.
|
|
313
|
-
|
|
314
|
-
## Media grid
|
|
315
|
-
|
|
316
|
-
Each room's Media button shows its images and videos as a grid ([`docs/DESIGN.md` §30](docs/design/30-media-grid.md)). A worker on
|
|
317
|
-
the server makes their thumbnails ahead of time, and a poster frame for each video with `ffmpeg` (in the Docker
|
|
318
|
-
image), which the room shows too, so browsers don't load videos just to draw their first frame. Set `FFMPEG=off` to
|
|
319
|
-
go without: videos then show their first frame in the room as before, and plain tiles in the grid.
|
|
320
|
-
|
|
321
205
|
## Telegram integration
|
|
322
206
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
the bot posts Chirkle messages with the author's name above them.
|
|
327
|
-
|
|
328
|
-
**Setup**
|
|
329
|
-
|
|
330
|
-
1. Create a bot with [@BotFather](https://t.me/BotFather) (`/newbot`) and keep its token. Turn its privacy mode off
|
|
331
|
-
(`/setprivacy` → Disable) so it sees group messages; if the bot is already in a group, remove it and add it again.
|
|
332
|
-
2. Set the environment and restart:
|
|
333
|
-
- `TELEGRAM_BOT_TOKEN` — the bot's token (without it the bridge is off)
|
|
334
|
-
- `TELEGRAM_WEBHOOK_URL` — `https://<your domain>/api/telegram/webhook` (without it the bridge polls Telegram,
|
|
335
|
-
for local development)
|
|
336
|
-
|
|
337
|
-
With Dokku: `dokku config:set chirkle TELEGRAM_BOT_TOKEN='…' TELEGRAM_WEBHOOK_URL='https://chat.example.com/api/telegram/webhook'`.
|
|
338
|
-
3. Add the bot to a Telegram group. A row for it appears in the admin UI under *Collections → tg_links*: pick the
|
|
339
|
-
room and tick `enabled`. `/chatid` in the group says whether it is linked. Make the bot a group admin to bring
|
|
340
|
-
reactions over: Telegram tells only admins about them. Tick `anonymous` too to repost the
|
|
341
|
-
room's messages to that group without their authors' names.
|
|
342
|
-
|
|
343
|
-
To make a room **anonymous**, tick `anonymous` on its row under *Collections → rooms* in the admin UI. Messages
|
|
344
|
-
posted from then on show the room's name instead of their authors to everyone but the authors themselves (and
|
|
345
|
-
superusers); see DESIGN.md §35. Telegram groups linked to it get the room's name as the author too.
|
|
346
|
-
|
|
347
|
-
The bridge is self-contained: `pb_hooks/telegram.pb.js`, `pb_hooks/telegram/` and its own `tg_*` collections. Delete
|
|
348
|
-
the first two to remove it.
|
|
207
|
+
Link rooms to Telegram groups and channels through your own bot: messages, replies, edits and files go both ways, and
|
|
208
|
+
reactions too with the bot an admin. Set `TELEGRAM_BOT_TOKEN` and `TELEGRAM_WEBHOOK_URL`, add the bot to a group, and
|
|
209
|
+
link the group to a room in the admin UI. Setup, options and limits: [the Telegram bridge](https://chirkle.com/docs/telegram/).
|
|
349
210
|
|
|
350
211
|
## Linked instances
|
|
351
212
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
replies, reactions and files go both ways. People from the other server show under stand-in users named after them
|
|
355
|
-
("Ann (B)"). Only the admins of both servers pair them and choose which rooms to share.
|
|
356
|
-
|
|
357
|
-
**Setup** (on each server)
|
|
358
|
-
|
|
359
|
-
1. Turn it on: in the admin UI, set *Settings → Application → Application URL* to the server's public address, e.g.
|
|
360
|
-
`https://chat.example.com`, then tick `federation` on the record under *Collections → site*. Peers are reached over
|
|
361
|
-
https, on public addresses only. The address is part of the ids the peers keep, so it can't be changed while any
|
|
362
|
-
peer is listed. (A server set up with the old `FEDERATION_ORIGIN` variable gets both done by its next start's
|
|
363
|
-
migration; the variable is no longer read after that.)
|
|
364
|
-
2. Pair: on server A, under *Collections → fed_peers*, add a row with B's address and a short label for its people
|
|
365
|
-
(`B`); tick `dms` to let people write DMs across. A sends B the request, and it shows on B as a row with status
|
|
366
|
-
`requested` (B checks with A that it really asked). B's admin accepts by setting its status to `active`, choosing
|
|
367
|
-
a label for A's people (and `dms`); both rows are then `active`. Deleting the request declines it. A request B
|
|
368
|
-
can't be reached for is sent again every minute; one nobody accepts expires after 7 days. If both admins add
|
|
369
|
-
each other, they pair at once.
|
|
370
|
-
3. Share a room: on its home, add a row under *fed_shares* with the room and the peer. The peer's admin finds it under
|
|
371
|
-
*fed_shares* there and ticks `accepted`; the room then appears there, named "general (A)", with its latest 200
|
|
372
|
-
messages. Private rooms too: each side's admins add their own people (on the copy, by editing its members), and the
|
|
373
|
-
room's creator can add people from the other server by their address, `ann@b.example`.
|
|
374
|
-
4. DMs: with `dms` ticked on both sides, people type `name@b.example` in "New message".
|
|
375
|
-
|
|
376
|
-
Suspend a peer by setting its `status` to `suspended`; delete its row to unpair (the copies are archived, DMs become
|
|
377
|
-
read-only). The feature is self-contained: `pb_hooks/federation.pb.js`, `pb_hooks/federation/` and the `fed_*`
|
|
378
|
-
collections; while `federation` isn't ticked, its routes answer 404 and nothing is sent.
|
|
213
|
+
Chirkle servers can be paired by their admins to share rooms, public or private, and let their people DM each other.
|
|
214
|
+
Off by default. Setup, sharing, moderation and unpairing: [linked servers](https://chirkle.com/docs/linking/).
|
|
379
215
|
|
|
380
216
|
## License
|
|
381
217
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/release/darwin-amd64/chirkle-server
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 34443616 bytes
|
|
4
|
+
sha256: fe89a9f3e4779c62b10321994f892db8afb79fa3bbb0d78107af88e0d8b14832
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chirkle",
|
|
3
|
-
"version": "0.4
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "A small, fast, real-time group chat: one PocketBase server, a vanilla TypeScript web app",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/border-radius/chirkle.git"
|
|
9
9
|
},
|
|
10
|
-
"
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/border-radius/chirkle/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://chirkle.com/",
|
|
11
14
|
"keywords": [
|
|
12
15
|
"chat",
|
|
13
|
-
"
|
|
16
|
+
"messenger",
|
|
17
|
+
"team-chat",
|
|
18
|
+
"group-chat",
|
|
14
19
|
"self-hosted",
|
|
15
|
-
"
|
|
20
|
+
"selfhosted",
|
|
21
|
+
"slack-alternative",
|
|
22
|
+
"discord-alternative",
|
|
23
|
+
"telegram",
|
|
24
|
+
"pocketbase",
|
|
25
|
+
"sqlite",
|
|
26
|
+
"realtime",
|
|
27
|
+
"pwa"
|
|
16
28
|
],
|
|
17
29
|
"type": "module",
|
|
18
30
|
"bin": {
|
|
@@ -71,7 +83,7 @@
|
|
|
71
83
|
"eventsource": "5.1.2",
|
|
72
84
|
"happy-dom": "20.14.5",
|
|
73
85
|
"playwright-core": "1.63.0",
|
|
74
|
-
"pocketbase": "0.
|
|
86
|
+
"pocketbase": "0.29.0",
|
|
75
87
|
"typescript": "7.0.2",
|
|
76
88
|
"vitest": "5.0.2"
|
|
77
89
|
},
|
|
@@ -54,6 +54,8 @@ function apply(app, peer, ev) {
|
|
|
54
54
|
return fedMessages.applyMessage(app, peer, ev);
|
|
55
55
|
case "edit":
|
|
56
56
|
return fedMessages.applyEdit(app, peer, ev);
|
|
57
|
+
case "files":
|
|
58
|
+
return fedMessages.applyFiles(app, peer, ev);
|
|
57
59
|
case "delete":
|
|
58
60
|
return fedMessages.applyDelete(app, peer, ev);
|
|
59
61
|
case "react":
|
|
@@ -141,7 +141,12 @@ function messageCreated(app, rec) {
|
|
|
141
141
|
*/
|
|
142
142
|
function before(rec) {
|
|
143
143
|
const orig = rec.original();
|
|
144
|
-
return {
|
|
144
|
+
return {
|
|
145
|
+
text: orig.getString("text"),
|
|
146
|
+
files: orig.getStringSlice("files"),
|
|
147
|
+
deleted: orig.getBool("deleted"),
|
|
148
|
+
reactions: reactionsOf(orig),
|
|
149
|
+
};
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
/**
|
|
@@ -152,7 +157,8 @@ function before(rec) {
|
|
|
152
157
|
*/
|
|
153
158
|
function checkMirrorChange(app, rec) {
|
|
154
159
|
const orig = rec.original();
|
|
155
|
-
|
|
160
|
+
const sameFiles = rec.getStringSlice("files").join("/") === orig.getStringSlice("files").join("/");
|
|
161
|
+
if (rec.getString("text") === orig.getString("text") && sameFiles && rec.getBool("deleted") === orig.getBool("deleted")) return;
|
|
156
162
|
if (originOf(app, rec.id)) return;
|
|
157
163
|
let room;
|
|
158
164
|
try {
|
|
@@ -202,6 +208,12 @@ function messageChanged(app, rec, was) {
|
|
|
202
208
|
);
|
|
203
209
|
}
|
|
204
210
|
}
|
|
211
|
+
// Its attachments replaced (a Telegram media edit, §26.4): the new ones, which peers fetch from here (§33.8).
|
|
212
|
+
if (!rec.getBool("deleted") && rec.getStringSlice("files").join("/") !== was.files.join("/")) {
|
|
213
|
+
const names = jsonOf(rec, "file_names", {});
|
|
214
|
+
const files = rec.getStringSlice("files").map((f) => ({ path: `/api/fed/files/${rec.id}/${f}`, name: String(names[f] || f) }));
|
|
215
|
+
for (const peerId of audience(app, room, rec.id)) enqueue(app, peerId, { type: "files", room: rg, message: g, files });
|
|
216
|
+
}
|
|
205
217
|
const now = reactionsOf(rec);
|
|
206
218
|
if (deleted || JSON.stringify(now) === JSON.stringify(was.reactions)) return;
|
|
207
219
|
if (isMirror(room)) {
|
|
@@ -396,6 +408,31 @@ function applyEdit(app, sender, ev) {
|
|
|
396
408
|
saveFor(app, rec, sender);
|
|
397
409
|
}
|
|
398
410
|
|
|
411
|
+
/**
|
|
412
|
+
* A `files` event: a message's attachments replaced where it came from (a Telegram media edit, §26.4). Like an edit,
|
|
413
|
+
* only from the author's own instance on the home, never our own people's on a mirror. The new files are fetched
|
|
414
|
+
* first (the worker, §33.8; `files`: the fetched ones, then); when none comes, the message keeps its own.
|
|
415
|
+
* @param {core.App} app
|
|
416
|
+
* @param {core.Record} sender
|
|
417
|
+
* @param {any} ev
|
|
418
|
+
* @param {any[]} [files] filesystem.File
|
|
419
|
+
*/
|
|
420
|
+
function applyFiles(app, sender, ev, files) {
|
|
421
|
+
const rec = target(app, sender, ev, true);
|
|
422
|
+
if (!rec || rec.getBool("deleted") || rec.getString("forwarded_from")) return;
|
|
423
|
+
if (isMine(gidOf(app, rec.getString("author")))) throw refusal(403, "People of this instance change their messages here.");
|
|
424
|
+
const listed = (Array.isArray(ev.files) ? ev.files : []).slice(0, MAX_FILES);
|
|
425
|
+
if (!listed.length) return;
|
|
426
|
+
if (!files) {
|
|
427
|
+
enqueueWork(app, sender.id, "fetch", { event: ev });
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (!files.length) return;
|
|
431
|
+
const shared = require(`${__hooks}/lib/files.js`);
|
|
432
|
+
shared.replaceMessageFiles(app, rec, shared.fromUploads(app, files));
|
|
433
|
+
saveFor(app, rec, sender);
|
|
434
|
+
}
|
|
435
|
+
|
|
399
436
|
/**
|
|
400
437
|
* A `delete` event. A message still being fetched is dropped from the queue.
|
|
401
438
|
* @param {core.App} app
|
|
@@ -461,6 +498,7 @@ module.exports = {
|
|
|
461
498
|
messageChanged,
|
|
462
499
|
applyMessage,
|
|
463
500
|
applyEdit,
|
|
501
|
+
applyFiles,
|
|
464
502
|
applyDelete,
|
|
465
503
|
applyReact,
|
|
466
504
|
applyReactions,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const { isActive, jsonOf, peerHost } = require(`${__hooks}/federation/config.js`);
|
|
9
9
|
const { call, errorOf, jsonBody } = require(`${__hooks}/federation/net.js`);
|
|
10
|
-
const { applyMessage, MAX_FILES } = require(`${__hooks}/federation/messages.js`);
|
|
10
|
+
const { applyFiles, applyMessage, MAX_FILES } = require(`${__hooks}/federation/messages.js`);
|
|
11
11
|
const { setDown } = require(`${__hooks}/federation/rooms.js`);
|
|
12
12
|
const { isLost } = require(`${__hooks}/lib/worker.js`);
|
|
13
13
|
|
|
@@ -226,7 +226,10 @@ function download(peer, path, max) {
|
|
|
226
226
|
*/
|
|
227
227
|
function fetchMessage(app, peer, payload) {
|
|
228
228
|
const ev = payload.event || {};
|
|
229
|
-
|
|
229
|
+
// A message's, or (a `files` event) a message's new attachments.
|
|
230
|
+
const refiled = ev.type === "files";
|
|
231
|
+
const src = refiled ? ev.files : ev.message?.files;
|
|
232
|
+
const listed = (Array.isArray(src) ? src : []).slice(0, MAX_FILES);
|
|
230
233
|
/** @type {string[]} */
|
|
231
234
|
const temps = [];
|
|
232
235
|
try {
|
|
@@ -245,7 +248,8 @@ function fetchMessage(app, peer, payload) {
|
|
|
245
248
|
uploads.push(up);
|
|
246
249
|
}
|
|
247
250
|
app.runInTransaction((tx) => {
|
|
248
|
-
|
|
251
|
+
if (refiled) applyFiles(tx, peer, ev, uploads);
|
|
252
|
+
else applyMessage(tx, peer, ev, uploads);
|
|
249
253
|
});
|
|
250
254
|
} finally {
|
|
251
255
|
for (const t of temps) {
|
|
@@ -162,11 +162,13 @@ function list(e) {
|
|
|
162
162
|
.newQuery("SELECT id, name, public, items, last_added FROM collections WHERE owner = {:me} ORDER BY name_key, id")
|
|
163
163
|
.bind({ me: user.id })
|
|
164
164
|
.all(mine);
|
|
165
|
-
const subs = arrayOf(
|
|
165
|
+
const subs = arrayOf(
|
|
166
|
+
new DynamicModel({ id: "", name: "", items: 0, last_added: "", owner: "", owner_name: "", owner_avatar: "", seen_at: "", n: 0 }),
|
|
167
|
+
);
|
|
166
168
|
e.app
|
|
167
169
|
.db()
|
|
168
170
|
.newQuery(
|
|
169
|
-
`SELECT c.id, c.name, c.items, c.last_added, c.owner, COALESCE(u.name, '') AS owner_name, s.seen_at, (
|
|
171
|
+
`SELECT c.id, c.name, c.items, c.last_added, c.owner, COALESCE(u.name, '') AS owner_name, COALESCE(u.avatar, '') AS owner_avatar, s.seen_at, (
|
|
170
172
|
SELECT COUNT(*) FROM (
|
|
171
173
|
SELECT 1 FROM collection_items i WHERE i.collection = c.id AND i.created > s.seen_at LIMIT ${NEW_CAP}
|
|
172
174
|
)
|
|
@@ -195,7 +197,7 @@ function list(e) {
|
|
|
195
197
|
public: true,
|
|
196
198
|
items: c.items,
|
|
197
199
|
last_added: c.last_added,
|
|
198
|
-
owner: { id: c.owner, name: c.owner_name },
|
|
200
|
+
owner: { id: c.owner, name: c.owner_name, avatar: c.owner_avatar },
|
|
199
201
|
seen_at: c.seen_at,
|
|
200
202
|
new: c.n,
|
|
201
203
|
preview: previews[c.id] ?? [],
|
package/pb_hooks/lib/files.js
CHANGED
|
@@ -270,6 +270,39 @@ function setMessageFiles(app, rec, rows, sources = {}, later = false) {
|
|
|
270
270
|
/** A custom key (neither stored nor sent): the `files` rows a message's save is to link (setMessageFiles `later`). */
|
|
271
271
|
const PENDING = "@link";
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* A custom key (neither stored nor sent): this save replaces the message's attachments (replaceMessageFiles), which
|
|
275
|
+
* nothing else may change (§17.1). Never taken from a request (lib/messages.js beforeMessageUpdateRequest).
|
|
276
|
+
*/
|
|
277
|
+
const REPLACING = "@replace_files";
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Replace the attachments of a message about to be saved, the server's doing only: a Telegram message's media
|
|
281
|
+
* replaced (§26.4), or a linked instance passing that on (§33.6). `rows` in order, those it keeps among them; what it
|
|
282
|
+
* no longer names is unlinked once saved (main.pb.js), and the new ones linked in the save. A kept file stays from
|
|
283
|
+
* the collection it was attached from.
|
|
284
|
+
* @param {core.App} app
|
|
285
|
+
* @param {core.Record} rec
|
|
286
|
+
* @param {core.Record[]} rows
|
|
287
|
+
*/
|
|
288
|
+
function replaceMessageFiles(app, rec, rows) {
|
|
289
|
+
const was = /** @type {Record<string, string>} */ (parse(rec.original().getString("file_sources")) || {});
|
|
290
|
+
/** @type {Record<string, string>} */
|
|
291
|
+
const sources = {};
|
|
292
|
+
for (const row of rows) {
|
|
293
|
+
const name = row.getString("file");
|
|
294
|
+
if (was[name]) sources[name] = was[name];
|
|
295
|
+
}
|
|
296
|
+
setMessageFiles(app, rec, rows, sources, true);
|
|
297
|
+
rec.set(REPLACING, true);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Is this save of a message a replaceMessageFiles?
|
|
302
|
+
* @param {core.Record} rec
|
|
303
|
+
*/
|
|
304
|
+
const replacing = (rec) => rec.get(REPLACING) === true;
|
|
305
|
+
|
|
273
306
|
/**
|
|
274
307
|
* Link what setMessageFiles left to the save of `rec` (main.pb.js, in the save's transaction).
|
|
275
308
|
* @param {core.App} app
|
|
@@ -306,6 +339,9 @@ function attachUploads(app, rec, uploads) {
|
|
|
306
339
|
module.exports = {
|
|
307
340
|
discard,
|
|
308
341
|
linkPending,
|
|
342
|
+
REPLACING,
|
|
343
|
+
replaceMessageFiles,
|
|
344
|
+
replacing,
|
|
309
345
|
MAX_FILES,
|
|
310
346
|
isImage,
|
|
311
347
|
isVideo,
|
package/pb_hooks/lib/handles.js
CHANGED
|
@@ -10,8 +10,30 @@ const { nameKey } = require(`${__hooks}/lib/text.js`);
|
|
|
10
10
|
const HANDLE_MIN = 3;
|
|
11
11
|
const HANDLE_MAX = 24;
|
|
12
12
|
const HANDLE = /^[a-z0-9_]{3,24}$/;
|
|
13
|
-
/** Kept for what may one day mean everyone in a room. */
|
|
14
|
-
const
|
|
13
|
+
/** Kept for what may one day mean everyone in a room: nobody has these (migration 46 took them back). */
|
|
14
|
+
const GROUP = ["all", "everyone", "here", "room", "channel"];
|
|
15
|
+
/**
|
|
16
|
+
* Words that would lend a stranger the site's authority in a mention ("@admin says…", QA SEC-2): not given to a new
|
|
17
|
+
* handle, nor taken in a change. Whoever has one already keeps it (and is still mentioned by it).
|
|
18
|
+
*/
|
|
19
|
+
const STAFF = [
|
|
20
|
+
"admin",
|
|
21
|
+
"admins",
|
|
22
|
+
"administrator",
|
|
23
|
+
"chirkle",
|
|
24
|
+
"help",
|
|
25
|
+
"mod",
|
|
26
|
+
"moderator",
|
|
27
|
+
"moderators",
|
|
28
|
+
"mods",
|
|
29
|
+
"official",
|
|
30
|
+
"root",
|
|
31
|
+
"security",
|
|
32
|
+
"staff",
|
|
33
|
+
"support",
|
|
34
|
+
"system",
|
|
35
|
+
];
|
|
36
|
+
const RESERVED = new Set([...GROUP, ...STAFF]);
|
|
15
37
|
/** Most people one message mentions. */
|
|
16
38
|
const MAX_MENTIONS = 20;
|
|
17
39
|
/** Most people GET /api/chat/mentionable suggests. */
|
package/pb_hooks/lib/http.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
const CSP = [
|
|
5
5
|
"default-src 'self'",
|
|
6
|
-
// The hash is index.html's inline theme script (web/src/theme.ts); tests/unit/build/csp.test.ts checks it.
|
|
7
|
-
"script-src 'self' 'sha256-
|
|
6
|
+
// The hash is index.html's inline theme and text size script (web/src/theme.ts); tests/unit/build/csp.test.ts checks it.
|
|
7
|
+
"script-src 'self' 'sha256-mOQF+ckehOwPXg3QQaTKo5nz/mkpPjspccYc517TGsE='",
|
|
8
8
|
"style-src 'self'",
|
|
9
9
|
"connect-src 'self'",
|
|
10
10
|
"img-src 'self' data: blob:",
|