fedipod-server 0.28.1 → 0.30.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 (438) hide show
  1. package/README.md +38 -34
  2. package/config/server.json +22 -0
  3. package/dist/claims.js +3 -2
  4. package/dist/directory.d.ts +2 -0
  5. package/dist/door.d.ts +4 -0
  6. package/dist/door.js +31 -0
  7. package/dist/fedipod.d.ts +16 -0
  8. package/dist/fedipod.js +13 -0
  9. package/dist/front.d.ts +3 -0
  10. package/dist/front.js +94 -0
  11. package/dist/handler.d.ts +39 -101
  12. package/dist/handler.js +86 -617
  13. package/dist/handler.jsonld +6 -30
  14. package/dist/identities.d.ts +62 -0
  15. package/dist/identities.js +236 -0
  16. package/dist/mounts.d.ts +43 -0
  17. package/dist/mounts.js +123 -0
  18. package/dist/opt-in.d.ts +46 -0
  19. package/dist/opt-in.js +176 -0
  20. package/dist/store-pod.js +37 -0
  21. package/package.json +10 -18
  22. package/lib/client/c2s.mjs +0 -582
  23. package/lib/client/localapi.mjs +0 -87
  24. package/lib/client/masto/accounts.mjs +0 -309
  25. package/lib/client/masto/body.mjs +0 -156
  26. package/lib/client/masto/index.mjs +0 -206
  27. package/lib/client/masto/instance.mjs +0 -112
  28. package/lib/client/masto/media.mjs +0 -79
  29. package/lib/client/masto/oauth.mjs +0 -656
  30. package/lib/client/masto/render.mjs +0 -518
  31. package/lib/client/masto/statuses.mjs +0 -372
  32. package/lib/client/masto/timelines.mjs +0 -438
  33. package/lib/client/oidc-auth.mjs +0 -62
  34. package/lib/client/streaming.mjs +0 -154
  35. package/lib/client/webpush.mjs +0 -98
  36. package/lib/connections/acctfeed.mjs +0 -257
  37. package/lib/connections/atproto.mjs +0 -309
  38. package/lib/connections/bskyfeed.mjs +0 -243
  39. package/lib/connections/bskygroup.mjs +0 -162
  40. package/lib/connections/fediacct.mjs +0 -253
  41. package/lib/connections/import.mjs +0 -357
  42. package/lib/connections/tagfeed.mjs +0 -212
  43. package/lib/connections/vault.mjs +0 -114
  44. package/lib/core/as2.mjs +0 -206
  45. package/lib/core/contexts/activitystreams.json +0 -379
  46. package/lib/core/contexts/anno.json +0 -126
  47. package/lib/core/contexts/did-v1.json +0 -57
  48. package/lib/core/contexts/fep-5711.json +0 -36
  49. package/lib/core/contexts/gotosocial.json +0 -86
  50. package/lib/core/contexts/identity-v1.json +0 -152
  51. package/lib/core/contexts/index.mjs +0 -63
  52. package/lib/core/contexts/join-lemmy.json +0 -33
  53. package/lib/core/contexts/joinmastodon.json +0 -28
  54. package/lib/core/contexts/litepub-0.1.json +0 -60
  55. package/lib/core/contexts/map.json +0 -19
  56. package/lib/core/contexts/miscellany.json +0 -19
  57. package/lib/core/contexts/quotes.json +0 -18
  58. package/lib/core/contexts/schemaorg.json +0 -8845
  59. package/lib/core/contexts/security-data-integrity-v1.json +0 -78
  60. package/lib/core/contexts/security-data-integrity-v2.json +0 -81
  61. package/lib/core/contexts/security-multikey-v1.json +0 -35
  62. package/lib/core/contexts/security-v1.json +0 -74
  63. package/lib/core/contexts/webfinger.json +0 -10
  64. package/lib/core/deliver.mjs +0 -371
  65. package/lib/core/graphview.mjs +0 -327
  66. package/lib/core/intake/activities.mjs +0 -633
  67. package/lib/core/intake/activity.mjs +0 -318
  68. package/lib/core/intake/channel.mjs +0 -144
  69. package/lib/core/intake/group.mjs +0 -256
  70. package/lib/core/intake/index.mjs +0 -701
  71. package/lib/core/intake/notes.mjs +0 -360
  72. package/lib/core/intake/verify.mjs +0 -142
  73. package/lib/core/keys.mjs +0 -153
  74. package/lib/core/lease.mjs +0 -206
  75. package/lib/core/polls.mjs +0 -105
  76. package/lib/core/profile-page.mjs +0 -104
  77. package/lib/core/proof.mjs +0 -79
  78. package/lib/core/publisher/collections.mjs +0 -237
  79. package/lib/core/publisher/index.mjs +0 -500
  80. package/lib/core/publisher/notes.mjs +0 -453
  81. package/lib/core/publisher/questions.mjs +0 -239
  82. package/lib/core/publisher/restore.mjs +0 -224
  83. package/lib/core/shapes/activitystreams.ttl +0 -157
  84. package/lib/core/shapes/index.mjs +0 -132
  85. package/lib/core/shapes/shapes-text.mjs +0 -13
  86. package/lib/core/social.mjs +0 -531
  87. package/lib/core/storage.mjs +0 -176
  88. package/lib/core/store.mjs +0 -568
  89. package/lib/core/wire-quotes.mjs +0 -71
  90. package/lib/core/wire.mjs +0 -889
  91. package/lib/device/account.mjs +0 -87
  92. package/lib/device/admin/index.mjs +0 -13
  93. package/lib/device/admin/origins.mjs +0 -35
  94. package/lib/device/admin/routes/connections.mjs +0 -144
  95. package/lib/device/admin/routes/gateway.mjs +0 -199
  96. package/lib/device/admin/routes/lifecycle.mjs +0 -200
  97. package/lib/device/admin/routes/owner.mjs +0 -322
  98. package/lib/device/admin/routes/setup.mjs +0 -412
  99. package/lib/device/admin/routes/social.mjs +0 -188
  100. package/lib/device/admin/server.mjs +0 -95
  101. package/lib/device/admin/static.mjs +0 -247
  102. package/lib/device/admin/surface.mjs +0 -315
  103. package/lib/device/certs.mjs +0 -281
  104. package/lib/device/cli/commands/account.mjs +0 -586
  105. package/lib/device/cli/commands/run.mjs +0 -278
  106. package/lib/device/cli/commands/service.mjs +0 -221
  107. package/lib/device/cli/commands/setup.mjs +0 -447
  108. package/lib/device/cli/commands/state.mjs +0 -561
  109. package/lib/device/cli/context.mjs +0 -288
  110. package/lib/device/export-collections.mjs +0 -161
  111. package/lib/device/gateway-move.mjs +0 -58
  112. package/lib/device/home.mjs +0 -161
  113. package/lib/device/migrate.mjs +0 -115
  114. package/lib/device/ports.mjs +0 -27
  115. package/lib/device/remote.mjs +0 -54
  116. package/lib/device/setup.mjs +0 -459
  117. package/lib/device/update.mjs +0 -96
  118. package/lib/gateway/caches.mjs +0 -36
  119. package/lib/gateway/directory.mjs +0 -90
  120. package/lib/gateway/front-core.mjs +0 -970
  121. package/lib/gateway/gateway-core.mjs +0 -165
  122. package/lib/gateway/headers.mjs +0 -49
  123. package/lib/gateway/httpsig.mjs +0 -159
  124. package/lib/gateway/notices.mjs +0 -84
  125. package/lib/gateway/quiet.mjs +0 -189
  126. package/lib/pod/README.md +0 -61
  127. package/lib/pod/actor.mjs +0 -96
  128. package/lib/pod/collection.mjs +0 -77
  129. package/lib/pod/containers.mjs +0 -140
  130. package/lib/pod/discovery.mjs +0 -46
  131. package/lib/pod/featured.mjs +0 -18
  132. package/lib/pod/followers.mjs +0 -24
  133. package/lib/pod/following.mjs +0 -10
  134. package/lib/pod/http.mjs +0 -74
  135. package/lib/pod/inbox.mjs +0 -166
  136. package/lib/pod/links.mjs +0 -35
  137. package/lib/pod/media.mjs +0 -27
  138. package/lib/pod/notes.mjs +0 -80
  139. package/lib/pod/notifications.mjs +0 -89
  140. package/lib/pod/outbox.mjs +0 -18
  141. package/lib/pod/package.json +0 -19
  142. package/lib/pod/policy.mjs +0 -58
  143. package/lib/pod/private.mjs +0 -19
  144. package/lib/pod/root.mjs +0 -104
  145. package/lib/pod/state.mjs +0 -40
  146. package/lib/pod/transport.mjs +0 -525
  147. package/lib/pod/urls.mjs +0 -85
  148. package/lib/server/embed.mjs +0 -423
  149. package/lib/session/README.md +0 -137
  150. package/lib/session/demo.html +0 -94
  151. package/lib/session/fedi-account.mjs +0 -408
  152. package/lib/session/fedi-login.mjs +0 -123
  153. package/lib/session/oidc-session.mjs +0 -233
  154. package/lib/session/package.json +0 -49
  155. package/lib/shared/guard.mjs +0 -213
  156. package/lib/shared/links.mjs +0 -9
  157. package/lib/shared/safefetch.mjs +0 -235
  158. package/lib/shared/ua.mjs +0 -29
  159. package/phanpy/dist/404.html +0 -40
  160. package/phanpy/dist/_headers +0 -2
  161. package/phanpy/dist/apple-touch-icon.png +0 -0
  162. package/phanpy/dist/assets/ICONS-DIPJeU0C.js +0 -2
  163. package/phanpy/dist/assets/ICONS-DIPJeU0C.js.map +0 -1
  164. package/phanpy/dist/assets/ScheduledAtField-D-Abfo4J.js +0 -183
  165. package/phanpy/dist/assets/ScheduledAtField-D-Abfo4J.js.map +0 -1
  166. package/phanpy/dist/assets/Temml-CCjoacWt.woff2 +0 -0
  167. package/phanpy/dist/assets/__vite-browser-external-C7iut881.js +0 -2
  168. package/phanpy/dist/assets/__vite-browser-external-C7iut881.js.map +0 -1
  169. package/phanpy/dist/assets/boosts-carousel-BiOaNdMT.jpg +0 -0
  170. package/phanpy/dist/assets/catch-up-O5q5C75Z.png +0 -0
  171. package/phanpy/dist/assets/chunk-aKtaBQYM.js +0 -1
  172. package/phanpy/dist/assets/compose-CFEx7wb4.js +0 -2
  173. package/phanpy/dist/assets/compose-CFEx7wb4.js.map +0 -1
  174. package/phanpy/dist/assets/compose-ZJN5xSb4.js +0 -35
  175. package/phanpy/dist/assets/compose-ZJN5xSb4.js.map +0 -1
  176. package/phanpy/dist/assets/debug.module-YFQgwnIr.js +0 -52
  177. package/phanpy/dist/assets/debug.module-YFQgwnIr.js.map +0 -1
  178. package/phanpy/dist/assets/dom-p1YcJ5Rw.js +0 -2
  179. package/phanpy/dist/assets/dom-p1YcJ5Rw.js.map +0 -1
  180. package/phanpy/dist/assets/home-mobile-dark@2x-Dc-J8-SM.png +0 -0
  181. package/phanpy/dist/assets/home-mobile-light@2x-Bd3fod8m.png +0 -0
  182. package/phanpy/dist/assets/home-tablet-dark@2x-BgcNI8le.png +0 -0
  183. package/phanpy/dist/assets/home-tablet-light@2x-BW2RV9T6.png +0 -0
  184. package/phanpy/dist/assets/icons/add-circle-line-WD0mwORD.js +0 -1
  185. package/phanpy/dist/assets/icons/alert-line-CpFUMf9s.js +0 -1
  186. package/phanpy/dist/assets/icons/android-2-line-Bzxnrd3S.js +0 -1
  187. package/phanpy/dist/assets/icons/announcement-line-5nwaJFJm.js +0 -1
  188. package/phanpy/dist/assets/icons/arrow-down-circle-line-a7Id9-Iv.js +0 -1
  189. package/phanpy/dist/assets/icons/arrow-down-line-B8uzXzq6.js +0 -1
  190. package/phanpy/dist/assets/icons/arrow-left-line-CGrGT9C-.js +0 -1
  191. package/phanpy/dist/assets/icons/arrow-right-line-CE-HERfX.js +0 -1
  192. package/phanpy/dist/assets/icons/arrow-to-up-line-CvdQjmcy.js +0 -1
  193. package/phanpy/dist/assets/icons/arrow-up-circle-line-DEparSNF.js +0 -1
  194. package/phanpy/dist/assets/icons/arrow-up-line-C7yBeugc.js +0 -1
  195. package/phanpy/dist/assets/icons/arrows-right-line-BtbXmJGP.js +0 -1
  196. package/phanpy/dist/assets/icons/at-line-CF66Bznk.js +0 -1
  197. package/phanpy/dist/assets/icons/attachment-line-BY8It-l9.js +0 -1
  198. package/phanpy/dist/assets/icons/blockquote-line-BS6pU_hm.js +0 -1
  199. package/phanpy/dist/assets/icons/board-line-C0UWXyA6.js +0 -1
  200. package/phanpy/dist/assets/icons/bookmark-line-1CtX5JLF.js +0 -1
  201. package/phanpy/dist/assets/icons/building-5-line-Dd59MzbO.js +0 -1
  202. package/phanpy/dist/assets/icons/bus-2-line-6_dvA0GG.js +0 -1
  203. package/phanpy/dist/assets/icons/calendar-day-line-Crpl_fmu.js +0 -1
  204. package/phanpy/dist/assets/icons/calendar-month-line-vommts2C.js +0 -1
  205. package/phanpy/dist/assets/icons/calendar-time-add-line-BU_DTlQk.js +0 -1
  206. package/phanpy/dist/assets/icons/camera-line-Cv69MEei.js +0 -1
  207. package/phanpy/dist/assets/icons/celebrate-line-B8DvIoi0.js +0 -1
  208. package/phanpy/dist/assets/icons/chart-bar-line-FK-QOmtF.js +0 -1
  209. package/phanpy/dist/assets/icons/chart-line-line-BGcJAFWw.js +0 -1
  210. package/phanpy/dist/assets/icons/chat-3-line-YFK2-hwz.js +0 -1
  211. package/phanpy/dist/assets/icons/check-circle-line-DsAxFr5-.js +0 -1
  212. package/phanpy/dist/assets/icons/clipboard-line-BBp364gJ.js +0 -1
  213. package/phanpy/dist/assets/icons/close-circle-line-CICdiuGz.js +0 -1
  214. package/phanpy/dist/assets/icons/close-line-DYrFWcjv.js +0 -1
  215. package/phanpy/dist/assets/icons/cloud-line-tiQAbah8.js +0 -1
  216. package/phanpy/dist/assets/icons/code-line-fAl8iiV3.js +0 -1
  217. package/phanpy/dist/assets/icons/comment-2-line-CR3g7WeB.js +0 -1
  218. package/phanpy/dist/assets/icons/copy-2-line-CLW69yF5.js +0 -1
  219. package/phanpy/dist/assets/icons/delete-2-line-B8xmbr4n.js +0 -1
  220. package/phanpy/dist/assets/icons/document-3-line-DBGNhAg2.js +0 -1
  221. package/phanpy/dist/assets/icons/document-line-C7mb9sb7.js +0 -1
  222. package/phanpy/dist/assets/icons/down-line-BGqSSThd.js +0 -1
  223. package/phanpy/dist/assets/icons/edit-4-line-DcgGaEhx.js +0 -1
  224. package/phanpy/dist/assets/icons/emoji-2-line-D8YgnM-y.js +0 -1
  225. package/phanpy/dist/assets/icons/exit-line-Dc07BS-x.js +0 -1
  226. package/phanpy/dist/assets/icons/external-link-line-BvpSkmjO.js +0 -1
  227. package/phanpy/dist/assets/icons/eye-2-line-CiWXx-f_.js +0 -1
  228. package/phanpy/dist/assets/icons/eye-close-line-BgTaSJ4P.js +0 -1
  229. package/phanpy/dist/assets/icons/filter-2-line-B_mR2usy.js +0 -1
  230. package/phanpy/dist/assets/icons/filter-line-C_nm-3cU.js +0 -1
  231. package/phanpy/dist/assets/icons/flag-1-line-C2HB05I0.js +0 -1
  232. package/phanpy/dist/assets/icons/forbid-circle-line-D3LTT9yd.js +0 -1
  233. package/phanpy/dist/assets/icons/formula-line-DLrt2d6j.js +0 -1
  234. package/phanpy/dist/assets/icons/grid-line-CgUmEikf.js +0 -1
  235. package/phanpy/dist/assets/icons/group-line-C5fnX0wU.js +0 -1
  236. package/phanpy/dist/assets/icons/hand-finger-2-line-BGgxbuL9.js +0 -1
  237. package/phanpy/dist/assets/icons/hashtag-line-CyTEEXBb.js +0 -1
  238. package/phanpy/dist/assets/icons/heart-crack-line-BZddbO2C.js +0 -1
  239. package/phanpy/dist/assets/icons/heart-line-CJ7K47J4.js +0 -1
  240. package/phanpy/dist/assets/icons/history-2-line-kWWvFzqv.js +0 -1
  241. package/phanpy/dist/assets/icons/history-line-bGQiwbTH.js +0 -1
  242. package/phanpy/dist/assets/icons/home-3-line-fRU1zeLG.js +0 -1
  243. package/phanpy/dist/assets/icons/information-line-iNk6-sOY.js +0 -1
  244. package/phanpy/dist/assets/icons/keyboard-line-DsCyuQNz.js +0 -1
  245. package/phanpy/dist/assets/icons/layout-4-line-CZkOX52Z.js +0 -1
  246. package/phanpy/dist/assets/icons/layout-5-line-B_znt5wO.js +0 -1
  247. package/phanpy/dist/assets/icons/left-line-eUw0tya4.js +0 -1
  248. package/phanpy/dist/assets/icons/lightning-line-DaKoDdix.js +0 -1
  249. package/phanpy/dist/assets/icons/link-2-line-DCqLmMA7.js +0 -1
  250. package/phanpy/dist/assets/icons/list-check-line-BAxosBh9.js +0 -1
  251. package/phanpy/dist/assets/icons/lock-line-CPoaXeUW.js +0 -1
  252. package/phanpy/dist/assets/icons/mail-line-B0P8aa1L.js +0 -1
  253. package/phanpy/dist/assets/icons/moon-line-CEqNAToP.js +0 -1
  254. package/phanpy/dist/assets/icons/more-1-fill-Dw2e5xab.js +0 -1
  255. package/phanpy/dist/assets/icons/more-3-line-BIiVjYTz.js +0 -1
  256. package/phanpy/dist/assets/icons/notification-line-BZZq2Gtu.js +0 -1
  257. package/phanpy/dist/assets/icons/pencil-line-CKh8-A1v.js +0 -1
  258. package/phanpy/dist/assets/icons/photo-album-line-Bnfg2u40.js +0 -1
  259. package/phanpy/dist/assets/icons/pin-line-DpTolyhs.js +0 -1
  260. package/phanpy/dist/assets/icons/play-fill-B0-G_8lX.js +0 -1
  261. package/phanpy/dist/assets/icons/qrcode-2-line-B6SPCaHn.js +0 -1
  262. package/phanpy/dist/assets/icons/quill-pen-line-B6LUrnCP.js +0 -1
  263. package/phanpy/dist/assets/icons/quote-left-fill-hQZ1cj_6.js +0 -1
  264. package/phanpy/dist/assets/icons/radar-line-CKyroTth.js +0 -1
  265. package/phanpy/dist/assets/icons/react-line-CoIKhhtK.js +0 -1
  266. package/phanpy/dist/assets/icons/refresh-2-line-D0mTF97S.js +0 -1
  267. package/phanpy/dist/assets/icons/right-line-B3KWJaqc.js +0 -1
  268. package/phanpy/dist/assets/icons/rocket-line-4KZl537D.js +0 -1
  269. package/phanpy/dist/assets/icons/round-fill-C69NTrZ0.js +0 -1
  270. package/phanpy/dist/assets/icons/round-line-B9k_1uo-.js +0 -1
  271. package/phanpy/dist/assets/icons/route-line-B28ReHcE.js +0 -1
  272. package/phanpy/dist/assets/icons/rows-4-line-CrBniagM.js +0 -1
  273. package/phanpy/dist/assets/icons/scan-line-DSf74YdP.js +0 -1
  274. package/phanpy/dist/assets/icons/search-2-line-B6geIU1z.js +0 -1
  275. package/phanpy/dist/assets/icons/settings-3-line-azJwK47w.js +0 -1
  276. package/phanpy/dist/assets/icons/settings-6-line-C_5zc5YR.js +0 -1
  277. package/phanpy/dist/assets/icons/share-2-line-D5MxWjrm.js +0 -1
  278. package/phanpy/dist/assets/icons/share-forward-line-Cp61fZzZ.js +0 -1
  279. package/phanpy/dist/assets/icons/sparkles-2-line-DYYyXTaW.js +0 -1
  280. package/phanpy/dist/assets/icons/sparkles-line-C2hY1s6I.js +0 -1
  281. package/phanpy/dist/assets/icons/time-line-BF3eet1v.js +0 -1
  282. package/phanpy/dist/assets/icons/transfer-4-line-oisfvTBw.js +0 -1
  283. package/phanpy/dist/assets/icons/translate-line-BFWol2Ce.js +0 -1
  284. package/phanpy/dist/assets/icons/unlock-line-X_x5vwv3.js +0 -1
  285. package/phanpy/dist/assets/icons/upload-3-line-DgzwUJeW.js +0 -1
  286. package/phanpy/dist/assets/icons/user-4-line-BVSynZCp.js +0 -1
  287. package/phanpy/dist/assets/icons/user-add-2-line-BlGS5Q8q.js +0 -1
  288. package/phanpy/dist/assets/icons/user-add-line-BbXdHG4z.js +0 -1
  289. package/phanpy/dist/assets/icons/user-edit-line-BFAHOV0X.js +0 -1
  290. package/phanpy/dist/assets/icons/user-follow-line-BXux0wSd.js +0 -1
  291. package/phanpy/dist/assets/icons/user-star-line-DdYlpHLU.js +0 -1
  292. package/phanpy/dist/assets/icons/user-warning-line-Cj43j0_E.js +0 -1
  293. package/phanpy/dist/assets/icons/user-x-line-DIDgNlPH.js +0 -1
  294. package/phanpy/dist/assets/icons/volume-line-Bs390KQt.js +0 -1
  295. package/phanpy/dist/assets/icons/volume-mute-line-DzlzIqFZ.js +0 -1
  296. package/phanpy/dist/assets/icons/walk-line-yNXfB-md.js +0 -1
  297. package/phanpy/dist/assets/icons/world-2-line-CenkGIwj.js +0 -1
  298. package/phanpy/dist/assets/icons/zoom-in-line-CaENUphf.js +0 -1
  299. package/phanpy/dist/assets/icons/zoom-out-line-BDNk0EWo.js +0 -1
  300. package/phanpy/dist/assets/instances-BNPptnn-.json +0 -333
  301. package/phanpy/dist/assets/locales/ar-SA-CfheRbCu.js +0 -1
  302. package/phanpy/dist/assets/locales/ca-ES-DHRW86Tz.js +0 -1
  303. package/phanpy/dist/assets/locales/cs-CZ-CKoqEuA1.js +0 -1
  304. package/phanpy/dist/assets/locales/de-DE-ByRPMRFy.js +0 -1
  305. package/phanpy/dist/assets/locales/eo-UY-CPC7wLCS.js +0 -1
  306. package/phanpy/dist/assets/locales/es-ES-dJa0Fd9t.js +0 -1
  307. package/phanpy/dist/assets/locales/eu-ES-C3djlPR2.js +0 -1
  308. package/phanpy/dist/assets/locales/fa-IR-DTT490Ck.js +0 -1
  309. package/phanpy/dist/assets/locales/fi-FI-B23MCPuz.js +0 -1
  310. package/phanpy/dist/assets/locales/fr-FR-BcaQsO5C.js +0 -1
  311. package/phanpy/dist/assets/locales/gl-ES-BR-CVKBN.js +0 -1
  312. package/phanpy/dist/assets/locales/he-IL-CfheRbCu.js +0 -1
  313. package/phanpy/dist/assets/locales/hu-HU-CfheRbCu.js +0 -1
  314. package/phanpy/dist/assets/locales/it-IT-C1136UFV.js +0 -1
  315. package/phanpy/dist/assets/locales/ja-JP-CRZmRAhD.js +0 -1
  316. package/phanpy/dist/assets/locales/kab-Cz8xH_TT.js +0 -1
  317. package/phanpy/dist/assets/locales/ko-KR-CG9UiY4o.js +0 -1
  318. package/phanpy/dist/assets/locales/lt-LT-CJcI6sHZ.js +0 -1
  319. package/phanpy/dist/assets/locales/nb-NO-CfheRbCu.js +0 -1
  320. package/phanpy/dist/assets/locales/nl-NL-DxN4Yc1t.js +0 -1
  321. package/phanpy/dist/assets/locales/oc-FR-CfheRbCu.js +0 -1
  322. package/phanpy/dist/assets/locales/pl-PL-DkwGXf6P.js +0 -1
  323. package/phanpy/dist/assets/locales/pseudo-LOCALE-CQ4XxkQ0.js +0 -1
  324. package/phanpy/dist/assets/locales/pt-BR-nGL0HdFS.js +0 -1
  325. package/phanpy/dist/assets/locales/pt-PT-Cp17aj2z.js +0 -1
  326. package/phanpy/dist/assets/locales/ru-RU-0Y8cIoaK.js +0 -1
  327. package/phanpy/dist/assets/locales/th-TH-CfheRbCu.js +0 -1
  328. package/phanpy/dist/assets/locales/tok-CfheRbCu.js +0 -1
  329. package/phanpy/dist/assets/locales/tr-TR-CfheRbCu.js +0 -1
  330. package/phanpy/dist/assets/locales/uk-UA-C5E3dFBf.js +0 -1
  331. package/phanpy/dist/assets/locales/zh-CN-BHJi7_et.js +0 -1
  332. package/phanpy/dist/assets/locales/zh-TW-CfheRbCu.js +0 -1
  333. package/phanpy/dist/assets/main-BdqNbG-a.js +0 -26
  334. package/phanpy/dist/assets/main-BdqNbG-a.js.map +0 -1
  335. package/phanpy/dist/assets/mock-home-DGhR__He.js +0 -2
  336. package/phanpy/dist/assets/mock-home-DGhR__He.js.map +0 -1
  337. package/phanpy/dist/assets/multi-column-ROck0NVt.jpg +0 -0
  338. package/phanpy/dist/assets/multi-hashtag-timeline-DH5INVHi.jpg +0 -0
  339. package/phanpy/dist/assets/nested-comments-thread-hv59kZLc.jpg +0 -0
  340. package/phanpy/dist/assets/polyfill-force-H8sUkLGp.js +0 -2
  341. package/phanpy/dist/assets/polyfill-force-H8sUkLGp.js.map +0 -1
  342. package/phanpy/dist/assets/pwa-viewport-ogKbF51K.js +0 -20
  343. package/phanpy/dist/assets/pwa-viewport-ogKbF51K.js.map +0 -1
  344. package/phanpy/dist/assets/style-B1iLPTPR.css +0 -2
  345. package/phanpy/dist/assets/temml-DuyIQMei.js +0 -97
  346. package/phanpy/dist/assets/temml-DuyIQMei.js.map +0 -1
  347. package/phanpy/dist/assets/tinyld.light.node-DtbBhLYC.js +0 -2
  348. package/phanpy/dist/assets/tinyld.light.node-DtbBhLYC.js.map +0 -1
  349. package/phanpy/dist/assets/year-in-posts-B2lywqdx.png +0 -0
  350. package/phanpy/dist/assets/year-in-posts-DJv_star.js +0 -3
  351. package/phanpy/dist/assets/year-in-posts-DJv_star.js.map +0 -1
  352. package/phanpy/dist/compose/index.html +0 -20
  353. package/phanpy/dist/favicon.ico +0 -0
  354. package/phanpy/dist/index.html +0 -73
  355. package/phanpy/dist/logo-192.png +0 -0
  356. package/phanpy/dist/logo-512.png +0 -0
  357. package/phanpy/dist/logo-badge-72.png +0 -0
  358. package/phanpy/dist/logo-maskable-512.png +0 -0
  359. package/phanpy/dist/logo-monochrome-512.png +0 -0
  360. package/phanpy/dist/logo-monochrome-maskable-512.png +0 -0
  361. package/phanpy/dist/manifest.webmanifest +0 -1
  362. package/phanpy/dist/og-image-2.jpg +0 -0
  363. package/phanpy/dist/og-image.png +0 -0
  364. package/phanpy/dist/robots.txt +0 -2
  365. package/phanpy/dist/sw.js +0 -2
  366. package/phanpy/dist/sw.js.map +0 -1
  367. package/phanpy/dist/version.json +0 -1
  368. package/run-agent.mjs +0 -897
  369. package/vendor/gate.cjs +0 -138
  370. package/vendor/idp-grant.cjs +0 -394
  371. package/vendor/jfetch.cjs +0 -16
  372. package/web/admin/actors.js +0 -145
  373. package/web/admin/bar.css +0 -126
  374. package/web/admin/bar.js +0 -99
  375. package/web/admin/client/client.js +0 -66
  376. package/web/admin/client/index.html +0 -69
  377. package/web/admin/client-pick.js +0 -79
  378. package/web/admin/common.js +0 -23
  379. package/web/admin/connections.js +0 -112
  380. package/web/admin/gateway.js +0 -133
  381. package/web/admin/group.js +0 -258
  382. package/web/admin/index.html +0 -603
  383. package/web/admin/notices-bar.js +0 -90
  384. package/web/admin/oauth-signin.mjs +0 -37
  385. package/web/admin/record.js +0 -390
  386. package/web/admin/setup/index.html +0 -241
  387. package/web/admin/setup/setup.js +0 -326
  388. package/web/admin/tokens.css +0 -68
  389. package/web/admin/upkeep.js +0 -177
  390. package/web/admin/window.css +0 -55
  391. package/web/admin/window.js +0 -136
  392. package/web/app/README.md +0 -81
  393. package/web/app/admin-facade.mjs +0 -588
  394. package/web/app/agent.mjs +0 -663
  395. package/web/app/atproto-browser.mjs +0 -86
  396. package/web/app/authorize_interaction.html +0 -56
  397. package/web/app/authorize_interaction.js +0 -69
  398. package/web/app/boot.mjs +0 -576
  399. package/web/app/deliver-relay.mjs +0 -129
  400. package/web/app/dist/boot.js +0 -34218
  401. package/web/app/dist/boot.js.map +0 -7
  402. package/web/app/dist/sw.js +0 -72810
  403. package/web/app/dist/sw.js.map +0 -7
  404. package/web/app/fediacct-browser.mjs +0 -146
  405. package/web/app/gateway-move.mjs +0 -60
  406. package/web/app/idb-kv.mjs +0 -35
  407. package/web/app/index.html +0 -242
  408. package/web/app/keys-browser.mjs +0 -71
  409. package/web/app/keystore.mjs +0 -82
  410. package/web/app/oidc-session.mjs +0 -6
  411. package/web/app/pod-auth.mjs +0 -248
  412. package/web/app/pod-remote.mjs +0 -84
  413. package/web/app/shims/_globals.mjs +0 -2
  414. package/web/app/shims/fedify-sig.mjs +0 -77
  415. package/web/app/shims/node-crypto.mjs +0 -113
  416. package/web/app/shims/node-fs.mjs +0 -17
  417. package/web/app/shims/node-path.mjs +0 -19
  418. package/web/app/shims/node-url.mjs +0 -7
  419. package/web/app/shims/prelude.js +0 -58
  420. package/web/app/shims/safefetch.mjs +0 -58
  421. package/web/app/shims/shapes-text.mjs +0 -8
  422. package/web/app/shims/web-push.mjs +0 -14
  423. package/web/app/signup.mjs +0 -318
  424. package/web/app/sw-src.mjs +0 -220
  425. package/web/app/update.js +0 -70
  426. package/web/front/admin.html +0 -55
  427. package/web/front/admin.js +0 -89
  428. package/web/front/install.sh +0 -69
  429. package/web/front/new-account.html +0 -35
  430. package/web/front/new-account.js +0 -13
  431. package/web/front/notices.html +0 -69
  432. package/web/front/notices.js +0 -107
  433. package/web/front/run.html +0 -58
  434. package/web/front/run.js +0 -195
  435. package/web/front/solid-oidc-client.js +0 -6
  436. package/web/icons/forum.svg +0 -11
  437. package/web/icons/gateway.svg +0 -14
  438. package/web/icons/local.svg +0 -11
package/dist/handler.js CHANGED
@@ -1,77 +1,58 @@
1
1
  "use strict";
2
2
  // handler.ts — the CSS HttpHandler. Thin by design: claim only the front's
3
- // routes (canHandle), adapt Node↔WHATWG, and hand off to the same FediPod core
4
- // the standalone gateway runs (routeFront). All the logic lives elsewhere and
5
- // tests without CSS; this file is the wiring CSS needs.
3
+ // routes and the identities' (canHandle), and hand each request to the part
4
+ // that answers it: an identity's own surface, the door for a delivery to its
5
+ // inbox, or the Gateway's front. The state every part shares lives here; the
6
+ // parts are mounts.ts (which pod a request belongs to), identities.ts
7
+ // (starting and stopping them), opt-in.ts (what an owner asks), door.ts and
8
+ // front.ts.
6
9
  //
7
10
  // componentsjs-generator reads FediPodServerArgs to emit one component
8
11
  // parameter per field, so the config injects each by name.
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
9
45
  Object.defineProperty(exports, "__esModule", { value: true });
10
46
  exports.FediPodServerHandler = void 0;
11
- const node_fs_1 = require("node:fs");
12
- const node_path_1 = require("node:path");
13
- const node_crypto_1 = require("node:crypto");
14
47
  const community_server_1 = require("@solid/community-server");
15
48
  const claims_1 = require("./claims");
16
- const adapt_1 = require("./adapt");
17
49
  const store_css_1 = require("./store-css");
18
- const store_pod_1 = require("./store-pod");
19
50
  const directory_1 = require("./directory");
20
- /** The pod's path as a mount prefix: `''` for a host root, else `/aisha`. */
21
- function mountOf(podBase) {
22
- return new URL(podBase).pathname.replace(/\/+$/u, '');
23
- }
24
- /** Whether `a` is `b` or an ancestor path of `b` (both mount-shaped, no trailing slash). */
25
- function pathContains(a, b) {
26
- return a === b || b.startsWith(a + '/') || a === '';
27
- }
28
- // The JS front-core is FediPod's own ESM tree, reached at runtime. A real
29
- // dynamic import() built via Function keeps tsc from downleveling it to
30
- // require() — which cannot load an ESM module with top-level await under a
31
- // CommonJS build.
32
- //
33
- // Two layouts carry that tree: the published package ships its own copy of
34
- // lib/ beside dist/ (prepack puts it there), and a repo checkout reaches the
35
- // repo's lib/ three levels up. Prefer the package's own copy when it exists.
36
- const LIB_ROOT = (0, node_fs_1.existsSync)((0, node_path_1.join)(__dirname, '../lib/server/embed.mjs')) ? '../lib' : '../../../lib';
37
- const FRONT_CORE = `${LIB_ROOT}/gateway/front-core.mjs`;
38
- const EMBED = `${LIB_ROOT}/server/embed.mjs`;
39
- const esmImport = new Function('s', 'return import(s)');
40
- // The front's pages and the files they load, carried in the same two layouts
41
- // as lib/. A missing file is not fatal: the route it feeds answers 404.
42
- const WEB_ROOT = (0, node_fs_1.existsSync)((0, node_path_1.join)(__dirname, '../web/front/run.html'))
43
- ? (0, node_path_1.join)(__dirname, '../web/front') : (0, node_path_1.join)(__dirname, '../../../web/front');
44
- const webFile = (name) => {
45
- try {
46
- return (0, node_fs_1.readFileSync)((0, node_path_1.join)(WEB_ROOT, name), 'utf8');
47
- }
48
- catch {
49
- return null;
50
- }
51
- };
52
- // A pod that will not come up yet is usually a pod still being created by the
53
- // server that is booting. Keep asking, slower each time, up to a few minutes.
54
- const START_RETRY_MS = [2_000, 5_000, 15_000, 60_000, 300_000];
55
- /** The identity's name, from its pod URL. Mirrors handleFor in lib/embed.mjs. */
56
- function deriveHandle(podBase) {
57
- const u = new URL(podBase);
58
- const segments = u.pathname.split('/').filter((seg) => seg.length > 0);
59
- return segments.length > 0 ? segments[segments.length - 1] : u.hostname.split('.')[0];
60
- }
61
- /** The opt-in page's path: leading slash, no trailing one, the default when unset. */
62
- function normalizeRunPath(raw) {
63
- const said = String(raw ?? '').trim().replace(/\/+$/u, '');
64
- if (!said)
65
- return claims_1.DEFAULT_RUN_PATH;
66
- return said.startsWith('/') ? said : `/${said}`;
67
- }
68
- /** A door path always has both slashes, so claiming and stripping agree. */
69
- function normalizeUiPath(raw) {
70
- if (raw === '')
71
- return '';
72
- const path = raw ?? '/fp/';
73
- return `/${path.replace(/^\/+|\/+$/gu, '')}/`;
74
- }
51
+ const mounts_1 = require("./mounts");
52
+ const identities = __importStar(require("./identities"));
53
+ const optIn = __importStar(require("./opt-in"));
54
+ const door_1 = require("./door");
55
+ const front_1 = require("./front");
75
56
  class FediPodServerHandler extends community_server_1.HttpHandler {
76
57
  args;
77
58
  io;
@@ -86,6 +67,7 @@ class FediPodServerHandler extends community_server_1.HttpHandler {
86
67
  // request is matched to an identity by host AND mount, never host alone.
87
68
  claimed = new Map(); // pod base → claim
88
69
  agentHandles = new Map(); // handle → pod base
70
+ roots = new Map(); // pod base → where on it the account lives
89
71
  frontHost;
90
72
  uiPath;
91
73
  identities = new Map();
@@ -117,285 +99,18 @@ class FediPodServerHandler extends community_server_1.HttpHandler {
117
99
  this.frontHost = args.frontHost || new URL(args.frontOrigin).hostname;
118
100
  // One answer for both the claim and the route, so a server cannot answer
119
101
  // at one path and refuse at another.
120
- this.runPath = normalizeRunPath(args.runPath);
121
- this.uiPath = normalizeUiPath(args.agentUiPath);
102
+ this.runPath = (0, mounts_1.normalizeRunPath)(args.runPath);
103
+ this.uiPath = (0, mounts_1.normalizeUiPath)(args.agentUiPath);
122
104
  this.registry = args.agentRuntimeOptIn
123
105
  ? (0, directory_1.makeAgentRegistry)(this.io, absolute(args.agentRegistryContainer ?? '/.internal/fedipod/agents/'))
124
106
  : null;
125
107
  }
126
- /**
127
- * Whether this pod may become an identity here, and the claim it earns: a
128
- * real URL, a place no other identity already sits, and a handle no other
129
- * identity uses — two pods must never share <agentDataDir>/<handle>/.
130
- *
131
- * A HOST-ROOT or subdomain pod needs an origin of its own, and it may not be
132
- * the front's host: the whole surface answers at the origin root, so two of
133
- * them, or one sharing the front, would collide. A SUFFIX pod lives on a path
134
- * (`server/aisha/`), so it may share its host — with the front and with other
135
- * suffix pods — provided no claim already contains or nests under its path.
136
- */
137
- validateAgentPod(podBase) {
138
- let host;
139
- let mount;
140
- try {
141
- const u = new URL(podBase);
142
- host = u.host.toLowerCase();
143
- mount = mountOf(podBase);
144
- }
145
- catch {
146
- throw new Error(`not a pod URL: ${podBase}`);
147
- }
148
- if (mount === '') {
149
- // A pod at the root of its host: it owns the whole origin, so it cannot
150
- // share it with the front or with any other claim.
151
- if (host.split(':')[0] === String(this.frontHost).toLowerCase()) {
152
- throw new Error(`${podBase} is on the front's own host — give the identity its own origin, or host it on a path`);
153
- }
154
- for (const c of this.claimed.values()) {
155
- if (c.host === host) {
156
- throw new Error(`the host ${host} already carries an identity — a host-root identity needs an origin of its own`);
157
- }
158
- }
159
- }
160
- else {
161
- // A pod on a path: it owns only its subtree. Refuse anything that already
162
- // contains it or that it would contain, so no identity can answer under
163
- // another's path (and none straddles the front's own routes underneath).
164
- for (const c of this.claimed.values()) {
165
- if (c.host !== host)
166
- continue;
167
- if (pathContains(c.mount, mount) || pathContains(mount, c.mount)) {
168
- throw new Error(`${podBase} nests with the identity already at ${c.podBase} — a path pod owns only its own subtree`);
169
- }
170
- }
171
- }
172
- const handle = deriveHandle(podBase);
173
- const holder = this.agentHandles.get(handle);
174
- if (holder && holder !== podBase) {
175
- throw new Error(`the name ${handle} already belongs to ${holder} — two identities cannot share it`);
176
- }
177
- return { host, mount, podBase, handle };
178
- }
179
- /**
180
- * The claim a request belongs to, or null. A request matches when its host is
181
- * the claim's host and its path is at or under the claim's mount; the deepest
182
- * mount wins, so a suffix pod's own routes are never swallowed by a shallower
183
- * claim on the same host.
184
- */
185
- resolveClaim(host, pathname) {
186
- let best = null;
187
- for (const c of this.claimed.values()) {
188
- if (c.host !== host)
189
- continue;
190
- if (c.mount === '' || pathname === c.mount || pathname.startsWith(c.mount + '/')) {
191
- if (!best || c.mount.length > best.mount.length)
192
- best = c;
193
- }
194
- }
195
- return best;
196
- }
197
- /** A request path relative to a mount: `/aisha/ap/actor` under `/aisha` → `/ap/actor`. */
198
- stripMount(pathname, mount) {
199
- if (!mount)
200
- return pathname;
201
- return pathname.slice(mount.length) || '/';
202
- }
203
- /**
204
- * Start an agent for each opted-in pod. Runs before the server listens, so
205
- * the identities come up in the background and boot is never held on a pod.
206
- */
207
- async initialize() {
208
- if (!this.registry)
209
- return;
210
- const runs = this.runsIdentities();
211
- // The stock CSS CLI installs no signal handlers, so a SIGTERM (systemd
212
- // stop, docker stop, Ctrl+C) killed the process with agent state
213
- // unflushed and the lease held for its whole TTL. Flush first, bounded,
214
- // then re-raise so the process still dies the way it was asked to.
215
- if (runs && !this.onSignal) {
216
- this.onSignal = (signal) => {
217
- const timeout = new Promise((resolve) => { setTimeout(resolve, 5_000).unref?.(); });
218
- void Promise.race([this.finalize(), timeout]).then(() => {
219
- process.kill(process.pid, signal);
220
- });
221
- };
222
- process.once('SIGTERM', this.onSignal);
223
- process.once('SIGINT', this.onSignal);
224
- }
225
- // Identities run in the primary, and requests are answered by the workers,
226
- // so with more than one worker an identity federates but cannot be reached:
227
- // its client API, its owner pages and its live feed are in a process no
228
- // request arrives at. Said once, by the process that has them.
229
- if (runs && this.args.clusterManager && !this.args.clusterManager.isSingleThreaded()) {
230
- this.logger.warn('FediPod is running in a multi-worker server. Deliveries are picked up by the inbox '
231
- + 'sweep rather than as they land, and no identity can answer its client API, its live feed or its '
232
- + "owner's pages while requests are served by other processes. Run with --workers 1.");
233
- }
234
- // Awaited, and BEFORE the server listens: a pod whose owner opted in must
235
- // have its routes claimed from the first request after a restart, never
236
- // served briefly by LDP. A failed load must not fail the boot — the rows
237
- // persist, and the next start recovers them.
238
- const pods = [];
239
- try {
240
- const keys = await this.registry.listKeys();
241
- for (const key of keys) {
242
- const row = await this.registry.get(key);
243
- if (!row)
244
- continue;
245
- if (this.claimed.has(row.podBase) || this.identities.has(row.podBase))
246
- continue; // already claimed
247
- let claim;
248
- try {
249
- claim = this.validateAgentPod(row.podBase);
250
- }
251
- catch (e) {
252
- this.logger.error(`opted-in pod ${row.podBase} no longer valid: ${e.message}`);
253
- continue;
254
- }
255
- this.claimed.set(row.podBase, claim);
256
- this.agentHandles.set(row.handle, row.podBase);
257
- pods.push(row.podBase);
258
- }
259
- }
260
- catch (e) {
261
- this.logger.error(`could not read the opt-in registry — opted-in identities are absent this boot: ${e.message}`);
262
- }
263
- if (pods.length > 0) {
264
- this.logger.info(runs
265
- ? `FediPod agent enabled for ${pods.length} opted-in pod(s)`
266
- : `FediPod claimed the routes of ${pods.length} opted-in pod(s); they are run elsewhere`);
267
- }
268
- // Claimed everywhere, run in one place. A process that does not run them
269
- // must still not let a pod answer for a path that belongs to an identity.
270
- if (runs)
271
- for (const pod of pods)
272
- void this.startIdentity(pod);
273
- }
108
+ /** The shared state, for the parts beside this file. */
109
+ internals() { return this; }
110
+ /** Start an agent for each opted-in pod, before the server listens. */
111
+ initialize() { return identities.initialize(this); }
274
112
  /** Stop every identity: timers cleared, state written, lease let go. */
275
- async finalize() {
276
- this.stopping = true;
277
- if (this.onSignal) {
278
- process.removeListener('SIGTERM', this.onSignal);
279
- process.removeListener('SIGINT', this.onSignal);
280
- this.onSignal = null;
281
- }
282
- const running = [...this.identities.values()];
283
- this.identities.clear();
284
- this.surfaces.clear();
285
- this.doorSecrets.clear();
286
- this.starting.clear();
287
- await Promise.allSettled(running.map(async (identity) => {
288
- await identity.stop();
289
- this.logger.info(`FediPod agent @${identity.handle} stopped`);
290
- }));
291
- }
292
- /**
293
- * One identity's door secret, in its own pod's state. `agentDataDir` is
294
- * handed in as the place an identity set up before this kept it, so its
295
- * owner's existing door link survives the move.
296
- */
297
- async doorSecretFor(podBase, session, opts = {}) {
298
- const { ensureDoorSecret } = await esmImport(EMBED);
299
- return ensureDoorSecret(session ?? (0, store_pod_1.makeStoreSession)(this.args.resourceStore, podBase), podBase, {
300
- ...opts,
301
- dataDir: this.args.agentDataDir,
302
- handle: deriveHandle(podBase),
303
- log: (message) => { this.logger.info(`@${deriveHandle(podBase)}: ${message}`); },
304
- });
305
- }
306
- async startIdentity(podBase) {
307
- if (this.starting.has(podBase) || this.identities.has(podBase))
308
- return;
309
- this.starting.add(podBase);
310
- this.startCancelled.delete(podBase);
311
- const session = (0, store_pod_1.makeStoreSession)(this.args.resourceStore, podBase);
312
- try {
313
- for (let attempt = 0; !this.stopping && !this.startCancelled.has(podBase); attempt++) {
314
- try {
315
- const { startEmbeddedAgent } = await esmImport(EMBED);
316
- // The secret is in the map BEFORE the surface can exist, so the
317
- // gate's resolver never comes up empty — empty would mean gate-off.
318
- if (!this.doorSecrets.has(podBase)) {
319
- const door = await this.doorSecretFor(podBase, session);
320
- this.doorSecrets.set(podBase, door.secret);
321
- this.logger.info(`door secret for @${deriveHandle(podBase)} is in its pod at ${door.url}`);
322
- }
323
- const identity = await startEmbeddedAgent({
324
- podBase,
325
- dataDir: this.args.agentDataDir,
326
- session,
327
- resourceStore: this.args.resourceStore,
328
- webIdSuffix: this.args.agentWebIdSuffix ?? 'profile/card#me',
329
- pollSeconds: this.args.agentPollSeconds ?? null,
330
- autoAcceptFollows: this.args.agentAutoAcceptFollows !== false,
331
- gateToken: () => this.doorSecrets.get(podBase),
332
- uiPath: this.uiPath,
333
- log: (message) => {
334
- this.logger.info(message);
335
- },
336
- });
337
- // Stopped, or opted out, while this one was still coming up.
338
- if (this.stopping || this.startCancelled.has(podBase)) {
339
- await identity.stop();
340
- return;
341
- }
342
- this.identities.set(podBase, identity);
343
- this.surfaces.set(podBase, identity);
344
- this.logger.info(`FediPod agent @${identity.handle} running on ${podBase}`);
345
- // A suffix pod cannot answer WebFinger for itself — its host root is
346
- // the front's — so it is followable ONLY through the door's apex
347
- // dispatch. Front it whether or not auto-front is on: the row is the
348
- // whole of what makes @handle@host resolve to it.
349
- if (this.args.agentAutoFront || this.claimed.get(podBase)?.mount) {
350
- await this.frontIdentity(podBase, identity);
351
- }
352
- return;
353
- }
354
- catch (e) {
355
- const wait = START_RETRY_MS[Math.min(attempt, START_RETRY_MS.length - 1)];
356
- this.logger.warn(`FediPod agent for ${podBase} did not start: ${e.message} — retrying in ${Math.round(wait / 1000)}s`);
357
- await new Promise((resolve) => {
358
- setTimeout(resolve, wait).unref?.();
359
- });
360
- }
361
- }
362
- }
363
- finally {
364
- this.starting.delete(podBase);
365
- }
366
- }
367
- /**
368
- * When this server is also the door, give a running identity a
369
- * @handle@<frontHost> address: one inbox-only directory row so the
370
- * shared-domain handle resolves and the door can take verified delivery for
371
- * it. The row names the identity's own tree, which is where its inbox and
372
- * its actor are — the door writes deliveries there and the agent watches
373
- * that container. A row written by an attach belongs to its owner and is
374
- * left alone; one this server wrote itself is corrected. The identity keeps
375
- * its own ids on the pod; nothing is moved.
376
- */
377
- async frontIdentity(podBase, identity) {
378
- const { handle, podHome, actorUrl } = identity;
379
- try {
380
- const existing = await this.dir.lookup(handle);
381
- const row = (0, directory_1.frontRow)(existing, {
382
- handle, podHome, actorUrl,
383
- kind: identity.agent?.store?.getConfig?.()?.kind === 'group' ? 'group' : 'person',
384
- gatewayWebId: this.args.gatewayWebId ?? null,
385
- hmacSecret: (0, node_crypto_1.randomBytes)(32).toString('base64'),
386
- inboxOnly: true,
387
- }, podBase);
388
- if (!row)
389
- return;
390
- await this.dir.putDirectory(handle, row);
391
- this.logger.info(existing
392
- ? `FediPod: the door's record of @${handle} now names ${podHome}`
393
- : `FediPod: @${handle}@${this.frontHost} now resolves to ${podBase}`);
394
- }
395
- catch (e) {
396
- this.logger.warn(`FediPod: could not front @${handle}: ${e.message}`);
397
- }
398
- }
113
+ finalize() { return identities.finalize(this); }
399
114
  async canHandle({ request }) {
400
115
  const host = String(request.headers.host ?? '').toLowerCase();
401
116
  const pathname = new URL(request.url ?? '/', `https://${host}`).pathname;
@@ -409,22 +124,11 @@ class FediPodServerHandler extends community_server_1.HttpHandler {
409
124
  // starting, and then stop being served once it has. The path is matched
410
125
  // relative to the claim's mount, so a suffix pod's `/aisha/ap/actor` is
411
126
  // judged as `/ap/actor`.
412
- const c = this.resolveClaim(host, pathname);
413
- if (c && (0, claims_1.agentClaims)({ pathname: this.stripMount(pathname, c.mount), method: request.method }, this.uiPath))
127
+ const c = (0, mounts_1.resolveClaim)(this, host, pathname);
128
+ if (c && (0, claims_1.agentClaims)({ pathname: (0, mounts_1.stripMount)(pathname, c.mount), method: request.method }, this.uiPath))
414
129
  return;
415
130
  throw new Error('not a gateway route'); // reject → CSS's LDP handler takes it
416
131
  }
417
- /**
418
- * Whether identities run in this process. They run in one: the lease admits
419
- * a single drainer, and the state each one holds is in memory. With workers,
420
- * that process is the primary — which serves no requests, so every process
421
- * still has to know which hosts belong to an identity even though only one
422
- * of them can answer for it.
423
- */
424
- runsIdentities() {
425
- const cluster = this.args.clusterManager;
426
- return !cluster || cluster.isSingleThreaded() || cluster.isPrimary();
427
- }
428
132
  /**
429
133
  * The identity a request belongs to (matched by host and mount) and the
430
134
  * request path relative to that identity's mount, or null. The identity is
@@ -432,172 +136,23 @@ class FediPodServerHandler extends community_server_1.HttpHandler {
432
136
  * upgrade, which has only the request to go on.
433
137
  */
434
138
  matchIdentity(host, pathname = '/') {
435
- const c = this.resolveClaim(String(host ?? '').toLowerCase(), pathname);
139
+ const c = (0, mounts_1.resolveClaim)(this, String(host ?? '').toLowerCase(), pathname);
436
140
  if (!c)
437
141
  return null;
438
- return { identity: this.surfaces.get(c.podBase), rel: this.stripMount(pathname, c.mount) };
142
+ return { identity: this.surfaces.get(c.podBase), rel: (0, mounts_1.stripMount)(pathname, c.mount) };
439
143
  }
440
- /**
441
- * A pod owner, already proven to control podBase, asks this server to run
442
- * their identity. Returns { httpStatus, ...body }; the secret appears in the
443
- * reply and nowhere else. Re-opting-in rotates the secret — that is how a
444
- * lost one is recovered.
445
- */
446
- /**
447
- * The WebIDs behind the account session in the request, or none. The server
448
- * keeps that session in a `css-account` cookie; its own account API is what
449
- * says which WebIDs the session owns, and it takes the same cookie. Nothing
450
- * here trusts the cookie's presence — the account API does the deciding, and
451
- * the caller picks the WebID that owns the pod being claimed.
452
- */
453
- async webIdsFromSession(request) {
454
- const cookie = request.headers.get('cookie');
455
- if (!cookie || !/(?:^|;\s*)css-account=/u.test(cookie))
456
- return [];
457
- const base = this.args.frontOrigin.replace(/\/$/u, '');
458
- const asJson = { cookie, accept: 'application/json' };
459
- try {
460
- const index = await fetch(`${base}/.account/`, { headers: asJson });
461
- if (!index.ok)
462
- return [];
463
- const controls = (await index.json()).controls;
464
- const webIdLink = controls?.account?.webId;
465
- if (!webIdLink)
466
- return [];
467
- const linked = await fetch(webIdLink, { headers: asJson });
468
- if (!linked.ok)
469
- return [];
470
- const links = (await linked.json()).webIdLinks ?? {};
471
- return Object.keys(links);
472
- }
473
- catch {
474
- return [];
475
- }
144
+ /** What a pod owner asks of this server; see opt-in.ts. */
145
+ webIdsFromSession(request) {
146
+ return optIn.webIdsFromSession(this, request);
476
147
  }
477
- async optInPod({ podBase, webId }) {
478
- if (!this.registry)
479
- return { httpStatus: 501, error: 'this server does not offer runtime opt-in' };
480
- if (this.args.clusterManager && !this.args.clusterManager.isSingleThreaded()) {
481
- return { httpStatus: 503, error: 'runtime opt-in needs a single-worker server (--workers 1)' };
482
- }
483
- const base = podBase.endsWith('/') ? podBase : `${podBase}/`;
484
- const handle = deriveHandle(base);
485
- // Already running here from an earlier opt-in: proving pod
486
- // control again buys a fresh secret, nothing else.
487
- if (this.agentHandles.get(handle) === base) {
488
- const door = await this.doorSecretFor(base, undefined, { rotate: true });
489
- this.doorSecrets.set(base, door.secret);
490
- return { httpStatus: 201, ok: true, handle, host: new URL(base).host.toLowerCase(),
491
- doorSecret: door.secret, doorPath: this.uiPath, status: 'rotated' };
492
- }
493
- let claim;
494
- try {
495
- claim = this.validateAgentPod(base);
496
- }
497
- catch (e) {
498
- return { httpStatus: 409, error: e.message };
499
- }
500
- const { host } = claim;
501
- try {
502
- await this.registry.add({ podBase: base, handle, host, webId, optedInAt: new Date().toISOString() });
503
- }
504
- catch (e) {
505
- this.logger.error(`opt-in row for ${base} could not be written: ${e.message}`);
506
- return { httpStatus: 500, error: 'could not record the opt-in' };
507
- }
508
- // From this instant the pod's identity routes answer 503 instead of LDP,
509
- // until the agent registers its surface.
510
- this.claimed.set(base, claim);
511
- this.agentHandles.set(handle, base);
512
- const door = await this.doorSecretFor(base, undefined, { rotate: true });
513
- this.doorSecrets.set(base, door.secret);
514
- void this.startIdentity(base);
515
- this.logger.info(`runtime opt-in: @${handle} on ${base} (door secret in its pod at ${door.url})`);
516
- return { httpStatus: 201, ok: true, handle, host,
517
- doorSecret: door.secret, doorPath: this.uiPath, status: 'starting' };
518
- }
519
- /**
520
- * What a pod would be as an identity here, without changing anything: its
521
- * handle, the host its address carries, and whether it runs here already.
522
- */
523
- async describePod({ podBase }) {
524
- const base = podBase.endsWith('/') ? podBase : `${podBase}/`;
525
- const handle = deriveHandle(base);
526
- let host;
527
- try {
528
- host = this.validateAgentPod(base).host;
529
- }
530
- catch {
531
- host = new URL(base).host.toLowerCase();
532
- }
533
- const running = this.agentHandles.get(handle) === base;
534
- // The management page's door takes its key once in the address and keeps
535
- // the browser in with a cookie. Only the owner's own page ever asks for
536
- // this description, so the key rides on the link for a running account.
537
- // Read from the pod, where the key always is, rather than from what this
538
- // process happens to hold: an account still starting has none in memory.
539
- let key;
540
- if (running) {
541
- try {
542
- key = (await this.doorSecretFor(base)).secret;
543
- }
544
- catch {
545
- key = this.doorSecrets.get(base);
546
- }
547
- }
548
- const door = base.replace(/\/$/u, '') + this.uiPath;
549
- return { handle, host, address: `@${handle}@${host}`, running,
550
- manage: key ? `${door}?dk-token=${encodeURIComponent(key)}` : door };
148
+ optInPod(a) {
149
+ return optIn.optInPod(this, a);
551
150
  }
552
- /** The reverse: stop the identity and let the pod be plain LDP again. */
553
- async optOutPod({ podBase }) {
554
- if (!this.registry)
555
- return { httpStatus: 501, error: 'this server does not offer runtime opt-in' };
556
- const base = podBase.endsWith('/') ? podBase : `${podBase}/`;
557
- const host = new URL(base).host.toLowerCase();
558
- const key = (0, directory_1.agentKey)(host, base);
559
- const row = await this.registry.get(key);
560
- if (!row || row.podBase !== base)
561
- return { httpStatus: 404, error: 'this pod has not opted in' };
562
- this.claimed.delete(base); // routes fall to LDP now
563
- this.startCancelled.add(base); // a pending start stands down
564
- const identity = this.identities.get(base);
565
- this.identities.delete(base);
566
- this.surfaces.delete(base);
567
- this.agentHandles.delete(row.handle);
568
- this.doorSecrets.delete(base);
569
- if (identity)
570
- await identity.stop();
571
- await this.registry.remove(key);
572
- this.logger.info(`runtime opt-out: @${row.handle} on ${base} — the pod serves plain LDP again`);
573
- return { httpStatus: 200, ok: true, stopped: Boolean(identity) };
151
+ describePod(a) {
152
+ return optIn.describePod(this, a);
574
153
  }
575
- /**
576
- * A delivery to an identity's own inbox, verified here — the server that
577
- * stores the inbox is the one the request reached, so the signature is
578
- * checked while its headers exist and the receipt is written beside the
579
- * activity. The same door code the front runs; nothing is renamed.
580
- */
581
- async deliverAtDoor(identity, request, response) {
582
- const { deliverToInbox } = await esmImport(EMBED);
583
- let whatwg;
584
- try {
585
- // The pod's own origin: the signature covers the path and the Host header, and both are the pod's.
586
- whatwg = await (0, adapt_1.nodeToWhatwg)(request, new URL(identity.podHome).origin);
587
- }
588
- catch (e) {
589
- const status = e.statusCode === 413 ? 413 : 400;
590
- response.writeHead(status, { 'content-type': 'application/json' });
591
- response.end(JSON.stringify({ error: e.message }));
592
- return;
593
- }
594
- const out = await deliverToInbox(identity.agent, whatwg, {
595
- podPut: (url, body, ct) => this.podPut(url, body, ct),
596
- gatewayWebId: this.args.gatewayWebId ?? null,
597
- });
598
- this.logger.info(`FediPod: delivery for @${identity.handle} at the door — ${out.reason} (${out.status})`);
599
- response.writeHead(out.status, { 'content-type': 'application/json' });
600
- response.end(JSON.stringify({ reason: out.reason }));
154
+ optOutPod(a) {
155
+ return optIn.optOutPod(this, a);
601
156
  }
602
157
  async handle({ request, response }) {
603
158
  const host = String(request.headers.host ?? '').toLowerCase();
@@ -605,118 +160,32 @@ class FediPodServerHandler extends community_server_1.HttpHandler {
605
160
  // The front's own routes win first — its dispatch, WebFinger and API sit at
606
161
  // the apex above every suffix pod — so a claim is consulted only where the
607
162
  // front does not answer.
608
- const claimed = (0, claims_1.claims)({ host, pathname }, this.frontHost, this.runPath) ? null : this.resolveClaim(host, pathname);
609
- if (claimed) {
610
- const identity = this.surfaces.get(claimed.podBase);
611
- if (!identity) {
612
- // Claimed, but nothing here can answer for it. Saying which of the two
613
- // reasons it is beats letting the pod answer for a route that is not
614
- // the pod's, and beats telling a client to try again when trying again
615
- // will reach another process just as unable to help.
616
- if (!this.runsIdentities()) {
617
- response.writeHead(503, { 'content-type': 'application/json' });
618
- response.end(JSON.stringify({ error: 'this identity is not reachable on a server running more '
619
- + 'than one worker: it runs in the process that serves no requests. Run with --workers 1.' }));
620
- return;
621
- }
622
- response.writeHead(503, { 'content-type': 'application/json', 'retry-after': '5' });
623
- response.end(JSON.stringify({ error: 'this identity is still starting' }));
624
- return;
625
- }
626
- // This identity's own inbox path — <mount>/<root>/ap/inbox/, from its
627
- // actor, so it already carries the mount for a suffix pod.
628
- const inboxPath = new URL(identity.actorUrl).pathname.replace(/ap\/actor$/u, 'ap/inbox/');
629
- if (pathname === inboxPath && String(request.method).toUpperCase() === 'POST') {
630
- await this.deliverAtDoor(identity, request, response);
163
+ const claimed = (0, claims_1.claims)({ host, pathname }, this.frontHost, this.runPath) ? null : (0, mounts_1.resolveClaim)(this, host, pathname);
164
+ if (!claimed)
165
+ return (0, front_1.serveFront)(this, request, response);
166
+ const identity = this.surfaces.get(claimed.podBase);
167
+ if (!identity) {
168
+ // Claimed, but nothing here can answer for it. Saying which of the two
169
+ // reasons it is beats letting the pod answer for a route that is not
170
+ // the pod's, and beats telling a client to try again when trying again
171
+ // will reach another process just as unable to help.
172
+ if (!identities.runsIdentities(this)) {
173
+ response.writeHead(503, { 'content-type': 'application/json' });
174
+ response.end(JSON.stringify({ error: 'this identity is not reachable on a server running more '
175
+ + 'than one worker: it runs in the process that serves no requests. Run with --workers 1.' }));
631
176
  return;
632
177
  }
633
- await identity.surface.handler(request, response);
178
+ response.writeHead(503, { 'content-type': 'application/json', 'retry-after': '5' });
179
+ response.end(JSON.stringify({ error: 'this identity is still starting' }));
634
180
  return;
635
181
  }
636
- const { routeFront } = await esmImport(FRONT_CORE);
637
- let whatwg;
638
- try {
639
- whatwg = await (0, adapt_1.nodeToWhatwg)(request, this.args.frontOrigin);
640
- }
641
- catch (e) {
642
- const status = e.statusCode === 413 ? 413 : 400;
643
- response.writeHead(status, { 'content-type': 'application/json' });
644
- response.end(JSON.stringify({ error: e.message }));
645
- return;
182
+ // This identity's own inbox path — <mount>/<root>/ap/inbox/, from its
183
+ // actor, so it already carries the mount for a suffix pod.
184
+ const inboxPath = new URL(identity.actorUrl).pathname.replace(/ap\/actor$/u, 'ap/inbox/');
185
+ if (pathname === inboxPath && String(request.method).toUpperCase() === 'POST') {
186
+ return (0, door_1.deliverAtDoor)(this, identity, request, response);
646
187
  }
647
- const out = await routeFront(whatwg, {
648
- host: this.frontHost,
649
- frontOrigin: this.args.frontOrigin,
650
- // This server issued the session the reader is already using, so it can
651
- // read it rather than sending them to an identity provider that has just
652
- // told them who they are. Same-origin only; front-core decides that.
653
- webIdsFromSession: (req) => this.webIdsFromSession(req),
654
- gatewayWebId: this.args.gatewayWebId,
655
- offersPods: !!this.args.offersPods,
656
- signupPage: this.args.signupPage || webFile('new-account.html'),
657
- runPage: this.args.runPage || webFile('run.html'),
658
- runPath: this.runPath,
659
- adminPage: this.args.adminPage || webFile('admin.html'),
660
- // The notices page renders here too, and says the server keeps none:
661
- // a notices store is the Netlify front's, not this component's.
662
- noticesPage: webFile('notices.html'),
663
- // The opt-in and roster pages load the sign-in library, and the installer
664
- // command is handed out with it; without these the pages render but
665
- // cannot be used.
666
- authBundle: webFile('solid-oidc-client.js'),
667
- // Each page's own script — inline until 2026-09-09, so that the pages can
668
- // be served under `script-src 'self'` (see lib/front-core.mjs).
669
- pageScripts: {
670
- 'new-account.js': webFile('new-account.js'),
671
- 'run.js': webFile('run.js'),
672
- 'admin.js': webFile('admin.js'),
673
- 'notices.js': webFile('notices.js'),
674
- },
675
- installScript: webFile('install.sh'),
676
- lookup: (h) => this.dir.lookup(h),
677
- putDirectory: (h, rec) => this.dir.putDirectory(h, rec),
678
- podPut: (_handle, url, body, ct) => this.podPut(url, body, ct),
679
- // Reads for the public proxy. `this.io.read` goes STRAIGHT into the
680
- // resource store, which applies no access control of its own — so this is
681
- // the one place that has to say what may be read, and it says: only
682
- // inside the pod of the handle being served, and never a server-internal
683
- // tree. Without it a row could name any location and this would fetch it
684
- // (the directory, with every user's receipt secret, included).
685
- //
686
- // The front now refuses to attach such a row at all (podHomeProblem in
687
- // lib/front-core.mjs); this is the same refusal at the other end, because
688
- // a row can also arrive from a seed or an older deploy.
689
- podGet: async (url, opts) => {
690
- const denied = { status: 403, text: async () => '', headers: { get: () => null } };
691
- let target;
692
- try {
693
- target = new URL(url);
694
- }
695
- catch {
696
- return denied;
697
- }
698
- if (/(^|\/)\.internal(\/|$)/u.test(target.pathname))
699
- return denied;
700
- // Which pod asked: routeFront reads `rec.podHome + rest` and passes
701
- // that podHome here, so the confinement is a value on the call rather
702
- // than state on the handler. No podHome, no read.
703
- const home = opts?.podHome;
704
- if (!home || !url.startsWith(home))
705
- return denied;
706
- const raw = await this.io.read(url);
707
- return raw == null
708
- ? { status: 404, text: async () => '', headers: { get: () => null } }
709
- : { status: 200, text: async () => raw, headers: { get: () => null } };
710
- },
711
- agentControl: this.registry
712
- ? {
713
- optIn: (a) => this.optInPod(a),
714
- optOut: (a) => this.optOutPod(a),
715
- describe: (a) => this.describePod(a),
716
- }
717
- : undefined,
718
- });
719
- await (0, adapt_1.applyToNode)(response, out);
188
+ await identity.surface.handler(request, response);
720
189
  }
721
190
  }
722
191
  exports.FediPodServerHandler = FediPodServerHandler;