chirkle 0.4.1 → 0.6.0

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.
Files changed (229) hide show
  1. package/README.md +56 -202
  2. package/bin/release/darwin-amd64/chirkle-server +2 -2
  3. package/bin/release/darwin-arm64/chirkle-server +0 -0
  4. package/bin/release/linux-amd64/chirkle-server +0 -0
  5. package/bin/release/linux-arm64/chirkle-server +0 -0
  6. package/package.json +18 -5
  7. package/pb_hooks/federation/inbox.js +2 -0
  8. package/pb_hooks/federation/messages.js +40 -2
  9. package/pb_hooks/federation/worker.js +7 -3
  10. package/pb_hooks/lib/collections.js +5 -3
  11. package/pb_hooks/lib/files.js +36 -0
  12. package/pb_hooks/lib/handles.js +24 -2
  13. package/pb_hooks/lib/http.js +2 -2
  14. package/pb_hooks/lib/inbox.js +6 -5
  15. package/pb_hooks/lib/media.js +16 -3
  16. package/pb_hooks/lib/messages.js +16 -6
  17. package/pb_hooks/lib/pins.js +199 -0
  18. package/pb_hooks/lib/rooms.js +4 -0
  19. package/pb_hooks/lib/users.js +33 -2
  20. package/pb_hooks/main.pb.js +17 -3
  21. package/pb_hooks/telegram/inbound.js +187 -16
  22. package/pb_hooks/telegram/links.js +12 -1
  23. package/pb_hooks/telegram/outbound.js +153 -12
  24. package/pb_hooks/telegram/worker.js +3 -1
  25. package/pb_migrations/1760000057_reactions_seen.js +17 -0
  26. package/pb_migrations/1760000058_users_kind_public.js +20 -0
  27. package/pb_migrations/1760000059_telegram_media_edits.js +37 -0
  28. package/pb_migrations/1760000060_pins.js +23 -0
  29. package/pb_public/assets/{access-UK3L54NR.js → access-23A7N3OD.js} +2 -2
  30. package/pb_public/assets/access-23A7N3OD.js.br +0 -0
  31. package/pb_public/assets/access-23A7N3OD.js.gz +0 -0
  32. package/pb_public/assets/access-XGNXIUR5.css +2 -0
  33. package/pb_public/assets/access-XGNXIUR5.css.br +0 -0
  34. package/pb_public/assets/access-XGNXIUR5.css.gz +0 -0
  35. package/pb_public/assets/access-XGNXIUR5.css.map +7 -0
  36. package/pb_public/assets/account-EBCPOLWT.css +2 -0
  37. package/pb_public/assets/account-EBCPOLWT.css.br +0 -0
  38. package/pb_public/assets/account-EBCPOLWT.css.gz +0 -0
  39. package/pb_public/assets/account-EBCPOLWT.css.map +7 -0
  40. package/pb_public/assets/account-api-J6A6IYVX.js.br +0 -0
  41. package/pb_public/assets/account-api-J6A6IYVX.js.gz +0 -0
  42. package/pb_public/assets/app-7VYWTXX4.js +3 -0
  43. package/pb_public/assets/app-7VYWTXX4.js.br +0 -0
  44. package/pb_public/assets/app-7VYWTXX4.js.gz +0 -0
  45. package/pb_public/assets/app-7VYWTXX4.js.map +7 -0
  46. package/pb_public/assets/app-LDOYFRVQ.css +2 -0
  47. package/pb_public/assets/app-LDOYFRVQ.css.br +0 -0
  48. package/pb_public/assets/app-LDOYFRVQ.css.gz +0 -0
  49. package/pb_public/assets/app-LDOYFRVQ.css.map +7 -0
  50. package/pb_public/assets/chunk-AG73QNUN.js.br +0 -0
  51. package/pb_public/assets/chunk-AG73QNUN.js.gz +0 -0
  52. package/pb_public/assets/chunk-DC4TJ7HF.js +2 -0
  53. package/pb_public/assets/chunk-DC4TJ7HF.js.br +0 -0
  54. package/pb_public/assets/chunk-DC4TJ7HF.js.gz +0 -0
  55. package/pb_public/assets/chunk-DC4TJ7HF.js.map +7 -0
  56. package/pb_public/assets/chunk-DCLJRQ53.js.br +0 -0
  57. package/pb_public/assets/chunk-DCLJRQ53.js.gz +0 -0
  58. package/pb_public/assets/chunk-RPCBA7VF.js.br +0 -0
  59. package/pb_public/assets/chunk-RPCBA7VF.js.gz +0 -0
  60. package/pb_public/assets/chunk-RYZHXNLF.js +2 -0
  61. package/pb_public/assets/chunk-RYZHXNLF.js.br +0 -0
  62. package/pb_public/assets/chunk-RYZHXNLF.js.gz +0 -0
  63. package/pb_public/assets/chunk-RYZHXNLF.js.map +7 -0
  64. package/pb_public/assets/chunk-SM542ZXL.js +2 -0
  65. package/pb_public/assets/chunk-SM542ZXL.js.br +0 -0
  66. package/pb_public/assets/chunk-SM542ZXL.js.gz +0 -0
  67. package/pb_public/assets/chunk-SM542ZXL.js.map +7 -0
  68. package/pb_public/assets/chunk-SZMAZMR4.js +2 -0
  69. package/pb_public/assets/chunk-SZMAZMR4.js.br +0 -0
  70. package/pb_public/assets/chunk-SZMAZMR4.js.gz +0 -0
  71. package/pb_public/assets/chunk-SZMAZMR4.js.map +7 -0
  72. package/pb_public/assets/chunk-UZDXAORM.js.br +0 -0
  73. package/pb_public/assets/chunk-UZDXAORM.js.gz +0 -0
  74. package/pb_public/assets/chunk-VSHXXDW4.js +2 -0
  75. package/pb_public/assets/chunk-VSHXXDW4.js.br +0 -0
  76. package/pb_public/assets/chunk-VSHXXDW4.js.gz +0 -0
  77. package/pb_public/assets/chunk-VSHXXDW4.js.map +7 -0
  78. package/pb_public/assets/chunk-VTOUI25E.js.br +0 -0
  79. package/pb_public/assets/chunk-VTOUI25E.js.gz +0 -0
  80. package/pb_public/assets/chunk-WDXT4S4J.js +2 -0
  81. package/pb_public/assets/chunk-WDXT4S4J.js.br +0 -0
  82. package/pb_public/assets/chunk-WDXT4S4J.js.gz +0 -0
  83. package/pb_public/assets/chunk-WDXT4S4J.js.map +7 -0
  84. package/pb_public/assets/collections-FZB6G4W4.css +2 -0
  85. package/pb_public/assets/collections-FZB6G4W4.css.br +0 -0
  86. package/pb_public/assets/collections-FZB6G4W4.css.gz +0 -0
  87. package/pb_public/assets/collections-FZB6G4W4.css.map +7 -0
  88. package/pb_public/assets/emoji-IHRUMGCY.css +2 -0
  89. package/pb_public/assets/emoji-IHRUMGCY.css.br +0 -0
  90. package/pb_public/assets/emoji-IHRUMGCY.css.gz +0 -0
  91. package/pb_public/assets/emoji-IHRUMGCY.css.map +7 -0
  92. package/pb_public/assets/{emoji-picker-K6JTK2GV.js → emoji-picker-K4DOKYL3.js} +2 -2
  93. package/pb_public/assets/emoji-picker-K4DOKYL3.js.br +0 -0
  94. package/pb_public/assets/emoji-picker-K4DOKYL3.js.gz +0 -0
  95. package/pb_public/assets/{emoji-picker-K6JTK2GV.js.map → emoji-picker-K4DOKYL3.js.map} +2 -2
  96. package/pb_public/assets/forward-OR7S3EHR.js +2 -0
  97. package/pb_public/assets/forward-OR7S3EHR.js.br +0 -0
  98. package/pb_public/assets/forward-OR7S3EHR.js.gz +0 -0
  99. package/pb_public/assets/forward-OR7S3EHR.js.map +7 -0
  100. package/pb_public/assets/inbox-2AXY3INA.css +2 -0
  101. package/pb_public/assets/inbox-2AXY3INA.css.br +0 -0
  102. package/pb_public/assets/inbox-2AXY3INA.css.gz +0 -0
  103. package/pb_public/assets/inbox-2AXY3INA.css.map +7 -0
  104. package/pb_public/assets/{inbox-CLMYESNI.js → inbox-A46J7ZU2.js} +2 -2
  105. package/pb_public/assets/inbox-A46J7ZU2.js.br +0 -0
  106. package/pb_public/assets/inbox-A46J7ZU2.js.gz +0 -0
  107. package/pb_public/assets/{inbox-CLMYESNI.js.map → inbox-A46J7ZU2.js.map} +2 -2
  108. package/pb_public/assets/{invite-OGT5E2MZ.js → invite-VGT2DI2L.js} +2 -2
  109. package/pb_public/assets/invite-VGT2DI2L.js.br +0 -0
  110. package/pb_public/assets/invite-VGT2DI2L.js.gz +0 -0
  111. package/pb_public/assets/invite-api-7G7XPXQW.js.br +0 -0
  112. package/pb_public/assets/invite-api-7G7XPXQW.js.gz +0 -0
  113. package/pb_public/assets/lazy-OVEJT5CP.js +2 -0
  114. package/pb_public/assets/lazy-OVEJT5CP.js.br +0 -0
  115. package/pb_public/assets/lazy-OVEJT5CP.js.gz +0 -0
  116. package/pb_public/assets/lazy-OVEJT5CP.js.map +7 -0
  117. package/pb_public/assets/{login-TK6K4WGB.js → login-TN6R7N2U.js} +2 -2
  118. package/pb_public/assets/login-TN6R7N2U.js.br +0 -0
  119. package/pb_public/assets/login-TN6R7N2U.js.gz +0 -0
  120. package/pb_public/assets/media-BCKZQR2R.css +2 -0
  121. package/pb_public/assets/media-BCKZQR2R.css.br +0 -0
  122. package/pb_public/assets/media-BCKZQR2R.css.gz +0 -0
  123. package/pb_public/assets/media-BCKZQR2R.css.map +7 -0
  124. package/pb_public/assets/{media-WZ4653L5.js → media-VCJWBQJZ.js} +2 -2
  125. package/pb_public/assets/media-VCJWBQJZ.js.br +0 -0
  126. package/pb_public/assets/media-VCJWBQJZ.js.gz +0 -0
  127. package/pb_public/assets/{mention-suggest-ODJD2IC5.js → mention-suggest-K3UUHR4D.js} +2 -2
  128. package/pb_public/assets/mention-suggest-K3UUHR4D.js.br +0 -0
  129. package/pb_public/assets/mention-suggest-K3UUHR4D.js.gz +0 -0
  130. package/pb_public/assets/notify-EPDM772N.js.br +0 -0
  131. package/pb_public/assets/notify-EPDM772N.js.gz +0 -0
  132. package/pb_public/assets/pins-6NQUEU3U.js +2 -0
  133. package/pb_public/assets/pins-6NQUEU3U.js.br +0 -0
  134. package/pb_public/assets/pins-6NQUEU3U.js.gz +0 -0
  135. package/pb_public/assets/pins-6NQUEU3U.js.map +7 -0
  136. package/pb_public/assets/pins-6ZVYPBB5.css +2 -0
  137. package/pb_public/assets/pins-6ZVYPBB5.css.br +0 -0
  138. package/pb_public/assets/pins-6ZVYPBB5.css.gz +0 -0
  139. package/pb_public/assets/pins-6ZVYPBB5.css.map +7 -0
  140. package/pb_public/assets/profile-NQ6QCQIB.js +2 -0
  141. package/pb_public/assets/profile-NQ6QCQIB.js.br +0 -0
  142. package/pb_public/assets/profile-NQ6QCQIB.js.gz +0 -0
  143. package/pb_public/assets/profile-NQ6QCQIB.js.map +7 -0
  144. package/pb_public/assets/rooms-forms-NYMPXVUQ.js +2 -0
  145. package/pb_public/assets/rooms-forms-NYMPXVUQ.js.br +0 -0
  146. package/pb_public/assets/rooms-forms-NYMPXVUQ.js.gz +0 -0
  147. package/pb_public/assets/rooms-forms-NYMPXVUQ.js.map +7 -0
  148. package/pb_public/assets/search-DRQHBOXE.js +2 -0
  149. package/pb_public/assets/search-DRQHBOXE.js.br +0 -0
  150. package/pb_public/assets/search-DRQHBOXE.js.gz +0 -0
  151. package/pb_public/assets/search-DRQHBOXE.js.map +7 -0
  152. package/pb_public/assets/search-QYHX6XDT.css +2 -0
  153. package/pb_public/assets/search-QYHX6XDT.css.br +0 -0
  154. package/pb_public/assets/search-QYHX6XDT.css.gz +0 -0
  155. package/pb_public/assets/search-QYHX6XDT.css.map +7 -0
  156. package/pb_public/assets/sidebar-forms-ETSRVSPY.css +2 -0
  157. package/pb_public/assets/sidebar-forms-ETSRVSPY.css.br +0 -0
  158. package/pb_public/assets/sidebar-forms-ETSRVSPY.css.gz +0 -0
  159. package/pb_public/assets/sidebar-forms-ETSRVSPY.css.map +7 -0
  160. package/pb_public/assets/stats-5GSWDHZI.css +2 -0
  161. package/pb_public/assets/stats-5GSWDHZI.css.br +0 -0
  162. package/pb_public/assets/stats-5GSWDHZI.css.gz +0 -0
  163. package/pb_public/assets/stats-5GSWDHZI.css.map +7 -0
  164. package/pb_public/assets/{stats-GTO2H6PG.js → stats-Y3LIXAZR.js} +2 -2
  165. package/pb_public/assets/stats-Y3LIXAZR.js.br +0 -0
  166. package/pb_public/assets/stats-Y3LIXAZR.js.gz +0 -0
  167. package/pb_public/assets/stats-Y3LIXAZR.js.map +7 -0
  168. package/pb_public/assets/switcher-TFSO45KV.js.br +0 -0
  169. package/pb_public/assets/switcher-TFSO45KV.js.gz +0 -0
  170. package/pb_public/assets/user-search-GUNMIBSB.js +2 -0
  171. package/pb_public/assets/user-search-GUNMIBSB.js.br +0 -0
  172. package/pb_public/assets/user-search-GUNMIBSB.js.gz +0 -0
  173. package/pb_public/assets/{viewer-2Y5FJBW4.js → viewer-BHKVAADP.js} +2 -2
  174. package/pb_public/assets/viewer-BHKVAADP.js.br +0 -0
  175. package/pb_public/assets/viewer-BHKVAADP.js.gz +0 -0
  176. package/pb_public/assets/viewer-JBZU46HP.css +2 -0
  177. package/pb_public/assets/viewer-JBZU46HP.css.br +0 -0
  178. package/pb_public/assets/viewer-JBZU46HP.css.gz +0 -0
  179. package/pb_public/assets/{viewer-P7GYCBYM.css.map → viewer-JBZU46HP.css.map} +2 -2
  180. package/pb_public/index.html +9 -8
  181. package/pb_public/stats.html +3 -3
  182. package/scripts/service.mjs +1 -1
  183. package/scripts/start.mjs +2 -1
  184. package/pb_public/assets/access-GPRLOZOO.css +0 -2
  185. package/pb_public/assets/access-GPRLOZOO.css.map +0 -7
  186. package/pb_public/assets/account-CT2BVMAX.css +0 -2
  187. package/pb_public/assets/account-CT2BVMAX.css.map +0 -7
  188. package/pb_public/assets/app-HB3NZHQ2.js +0 -3
  189. package/pb_public/assets/app-HB3NZHQ2.js.map +0 -7
  190. package/pb_public/assets/app-XJ73EU5O.css +0 -2
  191. package/pb_public/assets/app-XJ73EU5O.css.map +0 -7
  192. package/pb_public/assets/chunk-56ACD3V5.js +0 -2
  193. package/pb_public/assets/chunk-56ACD3V5.js.map +0 -7
  194. package/pb_public/assets/chunk-DZC4SY4M.js +0 -2
  195. package/pb_public/assets/chunk-DZC4SY4M.js.map +0 -7
  196. package/pb_public/assets/chunk-N2OFGBCZ.js +0 -2
  197. package/pb_public/assets/chunk-N2OFGBCZ.js.map +0 -7
  198. package/pb_public/assets/chunk-OKIIBH7O.js +0 -2
  199. package/pb_public/assets/chunk-OKIIBH7O.js.map +0 -7
  200. package/pb_public/assets/chunk-WR25F7FU.js +0 -2
  201. package/pb_public/assets/chunk-WR25F7FU.js.map +0 -7
  202. package/pb_public/assets/collections-DHJEOLHW.css +0 -2
  203. package/pb_public/assets/collections-DHJEOLHW.css.map +0 -7
  204. package/pb_public/assets/emoji-WWNPWCF3.css +0 -2
  205. package/pb_public/assets/emoji-WWNPWCF3.css.map +0 -7
  206. package/pb_public/assets/forward-267HRNPY.js +0 -2
  207. package/pb_public/assets/forward-267HRNPY.js.map +0 -7
  208. package/pb_public/assets/inbox-3FSOPY2T.css +0 -2
  209. package/pb_public/assets/inbox-3FSOPY2T.css.map +0 -7
  210. package/pb_public/assets/lazy-H3KIJVB5.js +0 -2
  211. package/pb_public/assets/lazy-H3KIJVB5.js.map +0 -7
  212. package/pb_public/assets/media-7TCBG7WM.css +0 -2
  213. package/pb_public/assets/media-7TCBG7WM.css.map +0 -7
  214. package/pb_public/assets/profile-3R6S5QYS.js +0 -2
  215. package/pb_public/assets/profile-3R6S5QYS.js.map +0 -7
  216. package/pb_public/assets/search-WCHOGAJQ.js +0 -2
  217. package/pb_public/assets/search-WCHOGAJQ.js.map +0 -7
  218. package/pb_public/assets/stats-A2TBRUI6.css +0 -2
  219. package/pb_public/assets/stats-A2TBRUI6.css.map +0 -7
  220. package/pb_public/assets/stats-GTO2H6PG.js.map +0 -7
  221. package/pb_public/assets/user-search-3HQOCQWL.js +0 -2
  222. package/pb_public/assets/viewer-P7GYCBYM.css +0 -2
  223. /package/pb_public/assets/{access-UK3L54NR.js.map → access-23A7N3OD.js.map} +0 -0
  224. /package/pb_public/assets/{invite-OGT5E2MZ.js.map → invite-VGT2DI2L.js.map} +0 -0
  225. /package/pb_public/assets/{login-TK6K4WGB.js.map → login-TN6R7N2U.js.map} +0 -0
  226. /package/pb_public/assets/{media-WZ4653L5.js.map → media-VCJWBQJZ.js.map} +0 -0
  227. /package/pb_public/assets/{mention-suggest-ODJD2IC5.js.map → mention-suggest-K3UUHR4D.js.map} +0 -0
  228. /package/pb_public/assets/{user-search-3HQOCQWL.js.map → user-search-GUNMIBSB.js.map} +0 -0
  229. /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 room list with unread counts on the left; messages with avatars, a reply, an @mention of you, a photo and emoji reactions on the right" src="docs/screenshot-light.png">
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 are private to whoever can read the message
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 integration](#telegram-integration)
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](#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
- Design: [`docs/DESIGN.md`](docs/DESIGN.md) · Android app: [`docs/ANDROID.md`](docs/ANDROID.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)
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`). The settings of [Deploying](#deploying) (`TRUSTED_PROXY` behind a reverse proxy, …)
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)
@@ -126,12 +130,14 @@ The PocketBase admin UI is at http://127.0.0.1:8090/_/ (create a superuser with
126
130
  | `npm run test:e2e` | Playwright end-to-end tests against the production build |
127
131
  | `npm run schema:snapshot` | Rewrite `docs/schema.snapshot.json` (every collection's API rules, fields and indexes, and the rate limits) after a migration changes them; `test:int` fails while it is out of date |
128
132
  | `npm run screenshots` | Rewrite the README screenshots (`docs/screenshot-*.png`, `docs/collections-*.png`): a throwaway server with made-up people, messages and collections, photographed in Chromium after `npm run build` |
133
+ | `npm run screenshots:cli` | Rewrite the console client's README screenshots (`docs/cli-*.svg`): a throwaway server with the same people and room, the client run in a terminal emulator and drawn as SVG (needs Go and `npm run setup`) |
129
134
  | `npm run check` | typecheck + lint + lint:sinks + test + test:int + build (what CI runs before e2e) |
130
135
  | `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
136
 
132
137
  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 typecheck, lint and build, then unit, integration and e2e side by side, e2e once
134
- per browser (Chromium, Firefox, WebKit).
138
+ 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,
139
+ build, Go, unit, component, integration (3 shards), e2e (2 shards per browser: Chromium, Firefox, WebKit), the speed
140
+ check, and the Android app's lint, tests and size. A final "CI passed" job is green only when all of them are.
135
141
 
136
142
  ## Project layout
137
143
 
@@ -151,150 +157,59 @@ android/ the Android app (docs/ANDROID.md): core/data (API, realtime, da
151
157
 
152
158
  ## Deploying
153
159
 
154
- ### systemd, in one command
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):
160
+ On a Linux server with Node 22+ and a domain pointing at it, one command installs Chirkle as a systemd service that
161
+ serves HTTPS itself (Let's Encrypt, on :80/:443):
158
162
 
159
163
  ```sh
160
164
  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
165
  ```
191
166
 
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
- ```
222
-
223
- Then deploy. The light way is to run the image GitHub builds: after CI passes on `master`,
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:
226
-
227
- ```sh
228
- dokku git:from-image chirkle ghcr.io/border-radius/chirkle:<commit> # each deploy needs a new tag: use the commit
229
- ```
230
-
231
- To follow `master`, run that from cron with the commit `git ls-remote https://github.com/border-radius/chirkle.git
232
- refs/heads/master` names; until its image exists (CI and the build take a few minutes, and a commit that fails CI
233
- gets none) `docker pull` of it fails, and the app keeps running what it has.
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
- ```
167
+ The documentation covers the rest:
241
168
 
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*.
169
+ - [Run it on a server](https://chirkle.com/docs/deploy/): the one-command install and its options, updating, uninstalling, and running the
170
+ server by hand
171
+ - [Docker](https://chirkle.com/docs/deploy/docker/) and [Dokku](https://chirkle.com/docs/deploy/dokku/), including running the image GitHub builds for every
172
+ commit on `master` and following it from cron
173
+ - [Behind a reverse proxy](https://chirkle.com/docs/deploy/reverse-proxy/): nginx and Caddy examples, and `TRUSTED_PROXY`
174
+ - [Administration](https://chirkle.com/docs/admin/): branding, invite-only signups, moderators, anonymous rooms, email, backups and S3,
175
+ rate limits, [link previews and video thumbnails](https://chirkle.com/docs/admin/previews-and-thumbnails/), metrics
176
+ - [Configuration reference](https://chirkle.com/docs/reference/configuration/): every environment variable, flag and setting in one place
271
177
 
272
178
  ## Android app
273
179
 
274
- In active development alongside the web client (it was frozen 2026-10-21..23): web features and fixes are ported to
275
- it ([`CLAUDE.md`](CLAUDE.md), [`android/PARITY.md`](android/PARITY.md)).
180
+ A native client for any server running Chirkle (Kotlin, Jetpack Compose), with several accounts at once on one server
181
+ or many, and notifications without Google services. Installing it, and what a server's admin can set up for it (room
182
+ links that open in the app, a minimum app version, a build for your own server):
183
+ [the Android app](https://chirkle.com/docs/android/) and [for admins](https://chirkle.com/docs/android/for-admins/).
276
184
 
277
- A native client for any server running Chirkle, with several accounts at once on one server or many (`android/`,
278
- design: [`docs/ANDROID.md`](docs/ANDROID.md), §17 for servers and accounts). It needs JDK 17+
279
- (21 recommended) and the Android SDK (`ANDROID_HOME`, or `sdk.dir` in `android/local.properties`); Gradle fetches the
280
- rest. Its tests start the server from `bin/`, so run `npm run setup` first.
185
+ To work on it (`android/`), you need JDK 17+ (21 recommended) and the Android SDK (`ANDROID_HOME`, or `sdk.dir` in
186
+ `android/local.properties`); Gradle fetches the rest. Its tests start the server from `bin/`, so run `npm run setup`
187
+ first.
281
188
 
282
189
  ```sh
283
190
  cd android
284
191
  ./gradlew assembleDebug # app/build/outputs/apk/debug: offers http://10.0.2.2:8090 (the dev server, from the emulator)
285
192
  ./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
193
  ```
288
194
 
289
- People choose their server when they log in or sign up (Change server), and add more accounts from their profile.
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).
195
+ Design: [`docs/ANDROID.md`](docs/ANDROID.md). What it has of the web app's features: [`android/PARITY.md`](android/PARITY.md).
196
+
197
+ ## Console client
198
+
199
+ `chirk` is Chirkle in a terminal: rooms, DMs, replies, mentions, reactions, search and pins, everything from the
200
+ keyboard, and an account made there too, with no browser. Images and video posters are previewed in the terminal
201
+ (kitty, Ghostty, foot, iTerm2, WezTerm, or as colored half blocks anywhere else), and Enter opens a file in a program
202
+ on your computer.
203
+
204
+ <picture>
205
+ <source media="(prefers-color-scheme: dark)" srcset="docs/cli-dark.svg">
206
+ <img alt="The console client in a terminal: the rooms on the left with unread dots and mention counts, and the design room on the right with a reply, an @mention of you, emoji reactions and a photo previewed under its file name" src="docs/cli-light.svg">
207
+ </picture>
208
+
209
+ One static binary per platform, attached to every [Release](https://github.com/border-radius/chirkle/releases)
210
+ (`chirk_<version>_<os>_<arch>.tar.gz`, `.zip` on Windows); `chirk update` replaces it with the latest. Run `chirk`,
211
+ give it your server's address and log in or sign up; `?` lists the keys. To work on it (`cli/`, Go), see
212
+ [`docs/CLI.md`](docs/CLI.md): its tests run against a real server.
298
213
 
299
214
  ## Releasing
300
215
 
@@ -305,77 +220,16 @@ Commit, push, then publish a GitHub Release with the new tag `v0.2.0`. The Relea
305
220
  stages `chirkle@0.2.0` on npm; approve it on npmjs.com (2FA) to publish it. Setup and details:
306
221
  [`docs/ANDROID.md` §28.7](docs/ANDROID.md#287-one-release-for-the-app-and-the-npm-package-2026-11-08).
307
222
 
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
223
  ## Telegram integration
322
224
 
323
- An optional bridge between rooms and Telegram groups ([`docs/DESIGN.md` §26](docs/design/26-telegram-bridge.md)). A bot sits in your
324
- groups; once a group is linked to a room, messages, replies, edits and files go both ways (deletes only from Chirkle
325
- to Telegram), and reactions too where the bot is a group admin. Telegram people show in the room under stand-in users ("Ann Lee (TG)") with their names and pictures;
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.
225
+ Link rooms to Telegram groups and channels through your own bot: messages, replies, edits and files go both ways, and
226
+ reactions too with the bot an admin. Set `TELEGRAM_BOT_TOKEN` and `TELEGRAM_WEBHOOK_URL`, add the bot to a group, and
227
+ link the group to a room in the admin UI. Setup, options and limits: [the Telegram bridge](https://chirkle.com/docs/telegram/).
349
228
 
350
229
  ## Linked instances
351
230
 
352
- Two or more servers running this app can share rooms and let their people write DMs to each other
353
- ([`docs/DESIGN.md` §33](docs/design/33-linked-instances.md)). Each room has a home server; the others keep a copy, and messages, edits,
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.
231
+ Chirkle servers can be paired by their admins to share rooms, public or private, and let their people DM each other.
232
+ Off by default. Setup, sharing, moderation and unpairing: [linked servers](https://chirkle.com/docs/linking/).
379
233
 
380
234
  ## License
381
235
 
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/release/darwin-amd64/chirkle-server
3
- size: 33843680 bytes
4
- sha256: d3cb6ef1f9413c1584e9875fc55dadbb38534dc3b3f24b6e36d05b39d78d5cf1
3
+ size: 34443616 bytes
4
+ sha256: 4605b4248ed6b240ed4563c307adf598928273eeb1c6c4994530a5f88c4a8be8
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "chirkle",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
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
- "homepage": "https://github.com/border-radius/chirkle#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/border-radius/chirkle/issues"
12
+ },
13
+ "homepage": "https://chirkle.com/",
11
14
  "keywords": [
12
15
  "chat",
13
- "pocketbase",
16
+ "messenger",
17
+ "team-chat",
18
+ "group-chat",
14
19
  "self-hosted",
15
- "realtime"
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": {
@@ -57,6 +69,7 @@
57
69
  "test:int": "vitest run --project integration",
58
70
  "test:e2e": "playwright test",
59
71
  "screenshots": "node --no-warnings scripts/screenshots.ts",
72
+ "screenshots:cli": "cd cli && CHIRKLE_SCREENSHOTS=docs go test -count=1 -run TestScreenshots ./internal/ui",
60
73
  "profile:web": "node --no-warnings scripts/profile-web.ts",
61
74
  "schema:snapshot": "vitest run --project integration -u tests/integration/schema.snapshot.test.ts",
62
75
  "check": "npm run typecheck && npm run lint && npm run lint:sinks && npm run test:go && npm test && npm run test:int && npm run build"
@@ -71,7 +84,7 @@
71
84
  "eventsource": "5.1.2",
72
85
  "happy-dom": "20.14.5",
73
86
  "playwright-core": "1.63.0",
74
- "pocketbase": "0.28.1",
87
+ "pocketbase": "0.29.0",
75
88
  "typescript": "7.0.2",
76
89
  "vitest": "5.0.2"
77
90
  },
@@ -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 { text: orig.getString("text"), deleted: orig.getBool("deleted"), reactions: reactionsOf(orig) };
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
- if (rec.getString("text") === orig.getString("text") && rec.getBool("deleted") === orig.getBool("deleted")) return;
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
- const listed = (Array.isArray(ev.message?.files) ? ev.message.files : []).slice(0, MAX_FILES);
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
- applyMessage(tx, peer, ev, uploads);
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(new DynamicModel({ id: "", name: "", items: 0, last_added: "", owner: "", owner_name: "", seen_at: "", n: 0 }));
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] ?? [],
@@ -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,