@kabmo-labs/kabmo 0.35.0 → 0.36.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 (216) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +435 -432
  3. package/dist/client/static/js/{CsvGrid-0amzgtd7.js → CsvGrid-1h3bcak7.js} +2 -2
  4. package/dist/client/static/js/{DocxView-bxjhzxe9.js → DocxView-ndca8jch.js} +2 -2
  5. package/dist/client/static/js/{DrawioView-7s1yqsf4.js → DrawioView-kpzd6y0b.js} +2 -2
  6. package/dist/client/static/js/{ImageView-ycfbn66h.js → ImageView-79prn3dg.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-tw1q1x0g.js → LayoutWrapper-v2wn2sb2.js} +2 -2
  8. package/dist/client/static/js/{Modal-wqjactyd.js → Modal-99j0zz3z.js} +16 -16
  9. package/dist/client/static/js/{PdfView-x6dmtwvr.js → PdfView-2rjd87ay.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-t85wq0me.js → SessionsView-t7f3s71b.js} +1 -1
  11. package/dist/client/static/js/{SheetView-n52nvz8s.js → SheetView-ehb976st.js} +13 -13
  12. package/dist/client/static/js/{SvgPreview-59z7syme.js → SvgPreview-de2bbba6.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-91gnt049.js → abnfDiagram-O67JEVCF-nx9jzn7m.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-aqft2erp.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-5b9qtff2.js → architectureDiagram-NJMV4G6O-170v67rr.js} +3 -3
  16. package/dist/client/static/js/{astro-31cbyw7b.js → astro-80bs6hvg.js} +1 -1
  17. package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-6f23fjkn.js → blockDiagram-BEXU5L5S-16q285n1.js} +2 -2
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-76t6d3am.js → c4Diagram-YGBWAQC7-rn3qt45h.js} +2 -2
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-f9tb19xm.js → classDiagram-v2-NBCMYWYE-r26wg74e.js} +1 -1
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-t6nwrbwj.js → cose-bilkent-JH36ORCC-82kwe7ha.js} +1 -1
  22. package/dist/client/static/js/cpp-y0t6mynx.js +1 -0
  23. package/dist/client/static/js/css-r2nhvzff.js +1 -0
  24. package/dist/client/static/js/cynefin-OW5HDTMX-v2sz60t6.js +1 -0
  25. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-69gc244j.js → cynefinDiagram-VND7K2PF-tcxdn6pa.js} +1 -1
  26. package/dist/client/static/js/{dagre-6A5THRUB-54bry3ey.js → dagre-6A5THRUB-g833ata3.js} +2 -2
  27. package/dist/client/static/js/{diagram-22UHCM2B-gfkebye6.js → diagram-22UHCM2B-f1fq8xec.js} +3 -3
  28. package/dist/client/static/js/{diagram-3UASUU5V-a1mr319f.js → diagram-3UASUU5V-6j2w016f.js} +1 -1
  29. package/dist/client/static/js/{diagram-ATOU4E4O-tkyk0qbe.js → diagram-ATOU4E4O-6t2qxsk4.js} +3 -3
  30. package/dist/client/static/js/{diagram-CDSNMT55-np0hc9m2.js → diagram-CDSNMT55-7abar8s7.js} +2 -2
  31. package/dist/client/static/js/{diagram-MLGK6HIB-nh06fshp.js → diagram-MLGK6HIB-s68rgy16.js} +1 -1
  32. package/dist/client/static/js/{diagram-MPIPVDR6-27q2veks.js → diagram-MPIPVDR6-azgkm6w8.js} +1 -1
  33. package/dist/client/static/js/{dockerfile-4rtt6c0f.js → dockerfile-47e33kqa.js} +1 -1
  34. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-x9p9jqe8.js → ebnfDiagram-ZINNZB2B-esrjz750.js} +1 -1
  35. package/dist/client/static/js/{elk-276RUBZZ-fw7waks3.js → elk-276RUBZZ-fhr4b4jj.js} +1 -1
  36. package/dist/client/static/js/{erDiagram-OPXOYQCR-fdfgzr5d.js → erDiagram-OPXOYQCR-5r3fmdnz.js} +4 -4
  37. package/dist/client/static/js/{erlang-trjm07as.js → erlang-bh5cbm8m.js} +1 -1
  38. package/dist/client/static/js/eventmodeling-NTZA5JFV-8qbefe4m.js +1 -0
  39. package/dist/client/static/js/flowDiagram-KWPJA3E3-krsvgcq7.js +1 -0
  40. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-2avbqgdr.js → ganttDiagram-FUAMR5RP-j4pf6rdn.js} +1 -1
  41. package/dist/client/static/js/gitGraph-4MIJSDKK-9bx1a38k.js +1 -0
  42. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-9jmc0a3g.js → gitGraphDiagram-X574FWY7-x5epk0gr.js} +2 -2
  43. package/dist/client/static/js/graphql-xnpp5gn9.js +1 -0
  44. package/dist/client/static/js/{index-nb8tp4mj.js → index-0b1kwsam.js} +8 -8
  45. package/dist/client/static/js/{index-43qpbxjv.js → index-1y9r4frb.js} +2 -2
  46. package/dist/client/static/js/{index-8x9ecxb0.js → index-3kgrcaq1.js} +1 -1
  47. package/dist/client/static/js/{index-a628fg4m.js → index-3vdmwpbh.js} +2 -2
  48. package/dist/client/static/js/{index-jc1yagmk.js → index-3zc1b0dv.js} +2 -2
  49. package/dist/client/static/js/{index-ee2p07eg.js → index-40ve7zzv.js} +1 -1
  50. package/dist/client/static/js/{index-xxtsm2rb.js → index-44qrckd2.js} +2 -2
  51. package/dist/client/static/js/{index-qqz6bcdd.js → index-55pqvh82.js} +2 -2
  52. package/dist/client/static/js/{index-kdkfyrja.js → index-5kjpacvd.js} +2 -2
  53. package/dist/client/static/js/{index-t6c0pd43.js → index-5rzk1226.js} +2 -2
  54. package/dist/client/static/js/{index-jmxqefe3.js → index-60ceydzn.js} +1 -1
  55. package/dist/client/static/js/{index-ek2e773p.js → index-63c6t75t.js} +1 -1
  56. package/dist/client/static/js/{index-6f6cmcbq.js → index-63jbb4kf.js} +2 -2
  57. package/dist/client/static/js/{index-8f9x7ev8.js → index-6xzfta4b.js} +1 -1
  58. package/dist/client/static/js/{index-ncrenheb.js → index-75haaj8g.js} +125 -125
  59. package/dist/client/static/js/{index-4vybd9e7.js → index-7r1hw2gd.js} +1 -1
  60. package/dist/client/static/js/{index-y3ms153k.js → index-8cy3x2y8.js} +2 -2
  61. package/dist/client/static/js/{index-7ct7qrsp.js → index-8e15fzax.js} +2 -2
  62. package/dist/client/static/js/{index-rkn0bxxt.js → index-97t3mv1v.js} +1 -1
  63. package/dist/client/static/js/{index-tp7yb3bv.js → index-982jyfsb.js} +2 -2
  64. package/dist/client/static/js/{index-py2k8std.js → index-9gf8b73w.js} +2 -2
  65. package/dist/client/static/js/{index-pzbssnsc.js → index-af24nes6.js} +2 -2
  66. package/dist/client/static/js/{index-w5373tg1.js → index-b48p8d1j.js} +2 -2
  67. package/dist/client/static/js/{index-w7tpgt46.js → index-be6gevq8.js} +1 -1
  68. package/dist/client/static/js/index-c09a5s1n.js +12 -0
  69. package/dist/client/static/js/{index-7q02xnvq.js → index-c1j0xb0w.js} +1 -1
  70. package/dist/client/static/js/{index-vnw3hbeg.js → index-ctgefatv.js} +27 -27
  71. package/dist/client/static/js/{index-2v1nmxwr.js → index-d2km9egp.js} +5 -5
  72. package/dist/client/static/js/index-dh1vd0d9.js +1 -0
  73. package/dist/client/static/js/{index-zh2jj56s.js → index-dmgawfhw.js} +2 -2
  74. package/dist/client/static/js/{index-k7q01ye4.js → index-h1e1abpt.js} +2 -2
  75. package/dist/client/static/js/{index-0v34a7wf.js → index-htt8qxm3.js} +1 -1
  76. package/dist/client/static/js/{index-a8ffattk.js → index-k1xt92h4.js} +2 -2
  77. package/dist/client/static/js/{index-p16scjt7.js → index-ktvbsj6w.js} +2 -2
  78. package/dist/client/static/js/{index-b8s3xraa.js → index-ky0prc71.js} +5 -5
  79. package/dist/client/static/js/{index-xs1m0bpt.js → index-mm1rf116.js} +1 -1
  80. package/dist/client/static/js/index-nws03exw.js +2 -0
  81. package/dist/client/static/js/{index-rbgemjsp.js → index-pyx8n25s.js} +3 -3
  82. package/dist/client/static/js/{index-3ecsp1rx.js → index-q5t4sy22.js} +3 -3
  83. package/dist/client/static/js/{index-rv89xpaf.js → index-r8pckaqe.js} +2 -2
  84. package/dist/client/static/js/{index-fvc0x6nx.js → index-sar2ggde.js} +3 -3
  85. package/dist/client/static/js/{index-sdby39w4.js → index-skm6k5w2.js} +3 -3
  86. package/dist/client/static/js/{index-whbtxmwh.js → index-v5t761a1.js} +2 -2
  87. package/dist/client/static/js/{index-8mwragbj.js → index-v8qd8ypc.js} +2 -2
  88. package/dist/client/static/js/{index-1wjp16f0.js → index-vtbbfwx0.js} +2 -2
  89. package/dist/client/static/js/{index-vq6wts05.js → index-w3n97x4b.js} +2 -2
  90. package/dist/client/static/js/{index-mc4nefs7.js → index-ydvfc9td.js} +1 -1
  91. package/dist/client/static/js/{index-9ketbkh6.js → index-ye450a7z.js} +1 -1
  92. package/dist/client/static/js/{index-7smwzkvq.js → index-z6g74h7g.js} +2 -2
  93. package/dist/client/static/js/{index-yq39qbs1.js → index-zdtsvnpq.js} +2 -2
  94. package/dist/client/static/js/{index-pc6eg8h2.js → index-zp73zexp.js} +2 -2
  95. package/dist/client/static/js/{index-pnt0vc59.js → index-zvfvqvn9.js} +2 -2
  96. package/dist/client/static/js/info-A6RAGUB7-j51t7jhh.js +1 -0
  97. package/dist/client/static/js/{infoDiagram-VRGFBTTK-g2dky5xg.js → infoDiagram-VRGFBTTK-ktc8nb8g.js} +1 -1
  98. package/dist/client/static/js/ini-ygfyhprj.js +1 -0
  99. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-exrcjwp1.js → ishikawaDiagram-OU5B5YK6-n3dk6227.js} +1 -1
  100. package/dist/client/static/js/java-gm49vw59.js +1 -0
  101. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-pn752qa5.js → journeyDiagram-ZHPQQLJL-f0p1h8qn.js} +2 -2
  102. package/dist/client/static/js/jsx-ksxw1byz.js +1 -0
  103. package/dist/client/static/js/{julia-evn99h2m.js → julia-73zjh2w6.js} +1 -1
  104. package/dist/client/static/js/{kanban-definition-PNTS6WVX-v8nvr373.js → kanban-definition-PNTS6WVX-7jdt7dv1.js} +1 -1
  105. package/dist/client/static/js/lua-53gzb9bx.js +1 -0
  106. package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
  107. package/dist/client/static/js/{mermaid.core-egzv89zv.js → mermaid.core-e8rzrjt9.js} +6 -6
  108. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-t9njmv2w.js → mindmap-definition-NLK3R4M7-7shv6ge0.js} +2 -2
  109. package/dist/client/static/js/one-dark-pro-39bt34v9.js +1 -0
  110. package/dist/client/static/js/one-light-xec0sehr.js +1 -0
  111. package/dist/client/static/js/packet-AYTQ26CC-n83gfj2g.js +1 -0
  112. package/dist/client/static/js/{pegDiagram-GJSIUBJH-zhycy2b7.js → pegDiagram-GJSIUBJH-17ak2zx3.js} +1 -1
  113. package/dist/client/static/js/{perl-506fy8m8.js → perl-8z46dmze.js} +1 -1
  114. package/dist/client/static/js/{php-axtsvxck.js → php-6qvnp2t6.js} +1 -1
  115. package/dist/client/static/js/pie-WAS4IAKB-5c5pctwz.js +1 -0
  116. package/dist/client/static/js/{pieDiagram-5QR66LMP-sgctvma2.js → pieDiagram-5QR66LMP-at4x1g4q.js} +1 -1
  117. package/dist/client/static/js/properties-2tcybqjk.js +1 -0
  118. package/dist/client/static/js/python-qph3dntq.js +1 -0
  119. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-kzzhdcph.js → quadrantDiagram-O4NWA36T-apzhwrn4.js} +1 -1
  120. package/dist/client/static/js/r-gd26x93y.js +1 -0
  121. package/dist/client/static/js/radar-RG4KPBEZ-52e5n99a.js +1 -0
  122. package/dist/client/static/js/railroad-74A4TZTK-44nqxxpy.js +1 -0
  123. package/dist/client/static/js/railroad-abnf-HS5TGJTU-25jxgwg7.js +1 -0
  124. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-64pqpf2y.js +1 -0
  125. package/dist/client/static/js/railroad-peg-WCYAUIDC-0p5sxzpx.js +1 -0
  126. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nzjffwxm.js → railroadDiagram-XR7U4H2S-rw8cj5f3.js} +1 -1
  127. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-tz4xxn4d.js → requirementDiagram-PLB6GJNP-qyrse7mb.js} +1 -1
  128. package/dist/client/static/js/{ruby-qp7zfk2m.js → ruby-qy8mhstq.js} +1 -1
  129. package/dist/client/static/js/{rust-fz913fvw.js → rust-fpshqnk0.js} +1 -1
  130. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2wcb0xr6.js → sankeyDiagram-IPEJSGJF-254qr59q.js} +2 -2
  131. package/dist/client/static/js/{sass-gnk9vsyp.js → sass-kbwea482.js} +1 -1
  132. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-vqgebfns.js → sequenceDiagram-PO4LG4MO-y9xjxfc5.js} +5 -5
  133. package/dist/client/static/js/{sizeCapture-INFHLROL-xc314tes.js → sizeCapture-INFHLROL-sc5e60t3.js} +1 -1
  134. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-8bd9b1h8.js → stateDiagram-v2-GCMORJYK-r134s4xr.js} +2 -2
  135. package/dist/client/static/js/{svelte-brpgzrtv.js → svelte-mwtx07d9.js} +1 -1
  136. package/dist/client/static/js/{swimlanes-2SLR337P-t6hbdzcw.js → swimlanes-2SLR337P-xc7rbawt.js} +1 -1
  137. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-kdcdamkj.js +8 -0
  138. package/dist/client/static/js/{timeline-definition-EJHVYXUP-2txxasx5.js → timeline-definition-EJHVYXUP-cgjd8shk.js} +2 -2
  139. package/dist/client/static/js/treeView-Q6P3EWNA-8j14nnd1.js +1 -0
  140. package/dist/client/static/js/treemap-WGGIJYW6-esf993kk.js +1 -0
  141. package/dist/client/static/js/tsx-nm94hed6.js +1 -0
  142. package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
  143. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-3x353hn4.js → usecaseDiagram-POWQR4AR-9qsmjhm6.js} +2 -2
  144. package/dist/client/static/js/{vennDiagram-UO4OBE2U-cerpss8e.js → vennDiagram-UO4OBE2U-4grw9awx.js} +1 -1
  145. package/dist/client/static/js/{vue-apnkw9qy.js → vue-j8vb9d7r.js} +1 -1
  146. package/dist/client/static/js/wardley-WFR3VGLG-v4dxm2sb.js +1 -0
  147. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-cx6jfsbf.js → wardleyDiagram-VNRHLVJA-8gxy0wat.js} +1 -1
  148. package/dist/client/static/js/xml-0py2vkw7.js +1 -0
  149. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-tgn23xj1.js → xychartDiagram-PMCCYNJV-5sh7tdrx.js} +2 -2
  150. package/dist/client/static/js/yaml-vghdz0f0.js +1 -0
  151. package/package.json +1 -1
  152. package/src/client/components/settings/categories/ConnectSettings.tsx +8 -1
  153. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.test.tsx +84 -0
  154. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.tsx +68 -0
  155. package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +49 -49
  156. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +12 -8
  157. package/src/client/components/settings/categories/connect-settings/QrCode.tsx +19 -2
  158. package/src/client/hooks/connect/use-connect-status.ts +44 -19
  159. package/src/client/hooks/connect/use-pairing.ts +5 -0
  160. package/src/client/lib/notifications/watch.ts +4 -1
  161. package/src/server/lib/connect/cloudflared-config.server.ts +236 -0
  162. package/src/server/lib/connect/cloudflared-config.test.ts +245 -0
  163. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +116 -15
  164. package/src/server/lib/connect/cloudflared.server.ts +53 -66
  165. package/src/server/lib/connect/pairing.server.ts +33 -0
  166. package/src/server/lib/connect/qr-png.server.test.ts +93 -0
  167. package/src/server/lib/connect/qr-png.server.ts +119 -0
  168. package/src/server/lib/connect/status.server.ts +10 -4
  169. package/src/server/routes/connect/index.ts +2 -0
  170. package/src/server/routes/connect/pair-qr.test.ts +72 -0
  171. package/src/server/routes/connect/pair-qr.ts +44 -0
  172. package/src/server/routes/connect/pair.ts +8 -2
  173. package/src/server/routes/connect/tunnels.test.ts +141 -0
  174. package/src/server/routes/connect/tunnels.ts +32 -7
  175. package/src/server/routes/notifications/stream.ts +11 -2
  176. package/src/shared/lib/connect/types.ts +7 -0
  177. package/dist/client/static/js/architecture-7GRP2DOG-bajpnvy7.js +0 -1
  178. package/dist/client/static/js/bash-0h36tk0k.js +0 -1
  179. package/dist/client/static/js/cpp-4wp9sy20.js +0 -1
  180. package/dist/client/static/js/css-c9nsbkh6.js +0 -1
  181. package/dist/client/static/js/cynefin-OW5HDTMX-8q9e90m8.js +0 -1
  182. package/dist/client/static/js/eventmodeling-NTZA5JFV-kn4hsm3p.js +0 -1
  183. package/dist/client/static/js/flowDiagram-KWPJA3E3-ah8cvps1.js +0 -1
  184. package/dist/client/static/js/gitGraph-4MIJSDKK-hvavh16n.js +0 -1
  185. package/dist/client/static/js/graphql-hbkmxsty.js +0 -1
  186. package/dist/client/static/js/index-btr2w8cq.js +0 -12
  187. package/dist/client/static/js/index-dfzrpy54.js +0 -2
  188. package/dist/client/static/js/index-sbd5e816.js +0 -1
  189. package/dist/client/static/js/info-A6RAGUB7-fmjz8qwg.js +0 -1
  190. package/dist/client/static/js/ini-72yrpvd4.js +0 -1
  191. package/dist/client/static/js/java-ab5tb2ra.js +0 -1
  192. package/dist/client/static/js/jsx-25zj9j3k.js +0 -1
  193. package/dist/client/static/js/lua-j5w0c9wm.js +0 -1
  194. package/dist/client/static/js/markdown-j6hn4377.js +0 -1
  195. package/dist/client/static/js/one-dark-pro-bm3r4js7.js +0 -1
  196. package/dist/client/static/js/one-light-e07dt7sy.js +0 -1
  197. package/dist/client/static/js/packet-AYTQ26CC-cwr6n1cm.js +0 -1
  198. package/dist/client/static/js/pie-WAS4IAKB-h1ebfzgt.js +0 -1
  199. package/dist/client/static/js/properties-q8njes42.js +0 -1
  200. package/dist/client/static/js/python-vqxc7181.js +0 -1
  201. package/dist/client/static/js/r-0k5eej8m.js +0 -1
  202. package/dist/client/static/js/radar-RG4KPBEZ-k7p1m364.js +0 -1
  203. package/dist/client/static/js/railroad-74A4TZTK-d08dw3t0.js +0 -1
  204. package/dist/client/static/js/railroad-abnf-HS5TGJTU-txnjycgk.js +0 -1
  205. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-p0r3cv6w.js +0 -1
  206. package/dist/client/static/js/railroad-peg-WCYAUIDC-sryk900a.js +0 -1
  207. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-c1czc7kv.js +0 -8
  208. package/dist/client/static/js/treeView-Q6P3EWNA-77kj68p1.js +0 -1
  209. package/dist/client/static/js/treemap-WGGIJYW6-rw94xc82.js +0 -1
  210. package/dist/client/static/js/tsx-yd5wt250.js +0 -1
  211. package/dist/client/static/js/typescript-v7z7crfe.js +0 -1
  212. package/dist/client/static/js/wardley-WFR3VGLG-18xe4fhz.js +0 -1
  213. package/dist/client/static/js/xml-94fhzrfs.js +0 -1
  214. package/dist/client/static/js/yaml-s8af9rnw.js +0 -1
  215. package/src/client/components/settings/categories/connect-settings/qr-image.ts +0 -76
  216. package/src/server/lib/connect/cloudflared.server.test.ts +0 -65
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /api/connect/pair/qr.png` — the download a host's own machinery fetches.
8
+ *
9
+ * The route exists because a download cannot run the page's renderer: Android's
10
+ * `DownloadManager`, iOS's `WKDownload` and the desktop shells all fetch an
11
+ * `http` URL with the session cookie and hand the bytes to the user. A `blob:`
12
+ * URL the page built is exactly what those paths ignore, which is what made the
13
+ * button do nothing in the shell.
14
+ *
15
+ * The cases pin the two halves of that contract: a live code answers a real PNG
16
+ * with an attachment name, and a code that expired or was redeemed answers a
17
+ * sentence instead of an empty image.
18
+ */
19
+
20
+ import { afterEach, describe, expect, test } from 'bun:test';
21
+ import { loader } from '@/server/routes/connect/pair-qr';
22
+ import { attachPairingQr, createPairing, resetPairings } from '@/server/lib/connect/pairing.server';
23
+ import { qrPng } from '@/server/lib/connect/qr-png.server';
24
+ import { qrMatrix } from '@/server/lib/connect/qr.server';
25
+
26
+ const CANDIDATES = [{ kind: 'lan' as const, url: 'http://192.168.18.76:3000' }];
27
+ const PNG = qrPng(qrMatrix('https://kabmo.example/pair#abc'));
28
+
29
+ async function download(pairingId: string) {
30
+ const url = new URL('http://localhost/api/connect/pair/qr.png');
31
+ url.searchParams.set('pairingId', pairingId);
32
+ return loader({ request: new Request(url) } as never);
33
+ }
34
+
35
+ afterEach(() => {
36
+ resetPairings();
37
+ });
38
+
39
+ describe('pairing QR download', () => {
40
+ test('serves the PNG as an attachment named for the file the user gets', async () => {
41
+ const { pairingId } = createPairing(CANDIDATES);
42
+ attachPairingQr(pairingId, PNG);
43
+
44
+ const response = await download(pairingId);
45
+ expect(response.status).toBe(200);
46
+ expect(response.headers.get('content-type')).toBe('image/png');
47
+ expect(response.headers.get('content-disposition')).toBe('attachment; filename="kabmo-pairing-qr.png"');
48
+ expect(response.headers.get('cache-control')).toBe('no-store');
49
+ expect(new Uint8Array(await response.arrayBuffer())).toEqual(PNG);
50
+ });
51
+
52
+ test('answers an explanation once the code is gone, never an empty file', async () => {
53
+ const { pairingId } = createPairing(CANDIDATES);
54
+ attachPairingQr(pairingId, PNG);
55
+ resetPairings();
56
+
57
+ const response = await download(pairingId);
58
+ expect(response.status).toBe(410);
59
+ expect(await response.text()).toContain('expired');
60
+ });
61
+
62
+ test('a code that was never drawn has nothing to download', async () => {
63
+ const { pairingId } = createPairing(CANDIDATES);
64
+ const response = await download(pairingId);
65
+ expect(response.status).toBe(410);
66
+ });
67
+
68
+ test('a missing pairing id is refused rather than reading the store', async () => {
69
+ const response = await download('');
70
+ expect(response.status).toBe(410);
71
+ });
72
+ });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /api/connect/pair/qr.png?pairingId=…` — the current pairing code as a
8
+ * downloadable PNG.
9
+ *
10
+ * A real HTTP response rather than a Blob the page builds, because a DOWNLOAD is
11
+ * not something every host can do from JavaScript: Android's shell hands an
12
+ * `http` URL to `DownloadManager` (and silently ignores a `blob:` one), iOS's
13
+ * shell turns a non-renderable response into a `WKDownload`, and the desktop
14
+ * shells hand the file to their webview's own download path. A PNG served from
15
+ * this origin is the one shape all of them agree on, and it also means the file
16
+ * the user opens is a real image rather than an SVG their viewer cannot show.
17
+ *
18
+ * Gated like every other API route. The requesting host carries the console's
19
+ * session cookie — `DownloadManager` and `WKDownload` both do — so the image is
20
+ * not readable without the session that minted it.
21
+ */
22
+
23
+ import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
24
+ import { pairingQr } from '@/server/lib/connect/pairing.server';
25
+
26
+ export async function loader({ request }: LoaderFunctionArgs) {
27
+ const pairingId = new URL(request.url).searchParams.get('pairingId') ?? '';
28
+ const png = pairingId === '' ? null : pairingQr(pairingId);
29
+ if (!png) {
30
+ return new Response('This pairing code has expired or was already used.', {
31
+ status: 410,
32
+ headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'no-store' },
33
+ });
34
+ }
35
+ return new Response(png, {
36
+ status: 200,
37
+ headers: {
38
+ 'content-type': 'image/png',
39
+ 'content-disposition': 'attachment; filename="kabmo-pairing-qr.png"',
40
+ 'content-length': String(png.byteLength),
41
+ 'cache-control': 'no-store',
42
+ },
43
+ });
44
+ }
@@ -21,10 +21,11 @@
21
21
  import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/remix-compat';
22
22
  import { connectIdentity } from '@/server/lib/connect/identity.server';
23
23
  import { connectStatus } from '@/server/lib/connect/status.server';
24
- import { createPairing, consumePairing } from '@/server/lib/connect/pairing.server';
24
+ import { createPairing, attachPairingQr, consumePairing } from '@/server/lib/connect/pairing.server';
25
25
  import { mintDeviceToken, touchDevice, DEVICE_COOKIE } from '@/server/lib/connect/devices.server';
26
26
  import { isSecureRequest } from '@/server/lib/auth/token';
27
27
  import { qrMatrix } from '@/server/lib/connect/qr.server';
28
+ import { qrPng } from '@/server/lib/connect/qr-png.server';
28
29
  import { encodePairingFragment, encodePairingPayload, PAIRING_VERSION } from '@/shared/lib/connect/payload';
29
30
  import { ROUTE_TIER } from '@/shared/lib/connect/tier';
30
31
  import type { ConnectCandidate, ConnectRouteKind } from '@/shared/lib/connect/types';
@@ -143,6 +144,10 @@ export async function action({ request }: ActionFunctionArgs) {
143
144
  // LAN, because the LAN origin is not a secure context.
144
145
  const best = [...candidates].sort((left, right) => ROUTE_TIER[left.kind] - ROUTE_TIER[right.kind])[0];
145
146
  const webLink = `${best.url}/pair#${encodePairingFragment(payload)}`;
147
+ const qr = qrMatrix(webLink);
148
+ // Drawn once, here: the download is an HTTP GET from a host's own download
149
+ // machinery, which cannot run this page's renderer to draw it later.
150
+ attachPairingQr(pairing.pairingId, qrPng(qr));
146
151
 
147
152
  return json(
148
153
  {
@@ -150,8 +155,9 @@ export async function action({ request }: ActionFunctionArgs) {
150
155
  expiresAt: pairing.expiresAt,
151
156
  link,
152
157
  webLink,
158
+ qrUrl: `/api/connect/pair/qr.png?pairingId=${encodeURIComponent(pairing.pairingId)}`,
153
159
  candidates,
154
- qr: qrMatrix(webLink),
160
+ qr,
155
161
  },
156
162
  { headers: NO_STORE_HEADERS },
157
163
  );
@@ -0,0 +1,141 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The tunnels route's config action.
8
+ *
9
+ * The page sends a path, not a flag, because the server owns the "is this a
10
+ * runnable config?" question. The cases pin that contract: a missing file and a
11
+ * hostname-less file are refused with the reason, a good path is persisted and
12
+ * reported back in the same payload, and a running tunnel is stopped when the
13
+ * file underneath it changes — leaving it up would label the page with a path
14
+ * the process is not using.
15
+ */
16
+
17
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
18
+ import fs from 'fs';
19
+ import os from 'os';
20
+ import path from 'path';
21
+ import { action } from '@/server/routes/connect/tunnels';
22
+ import {
23
+ cloudflaredAlive,
24
+ runningTunnelUrl,
25
+ startCloudflared,
26
+ } from '@/server/lib/connect/cloudflared.server';
27
+ import type { ConnectStatus } from '@/shared/lib/connect/types';
28
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
29
+
30
+ const dirs: string[] = [];
31
+
32
+ function tempDir(): string {
33
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-cf-route-'));
34
+ dirs.push(dir);
35
+ return dir;
36
+ }
37
+
38
+ function writeConfig(): string {
39
+ const file = path.join(tempDir(), 'config.yml');
40
+ fs.writeFileSync(
41
+ file,
42
+ ['tunnel: t', 'ingress:', ' - hostname: kabmo.example.com', ' service: http://localhost:3000', ' - service: http_status:404', ''].join('\n'),
43
+ );
44
+ return file;
45
+ }
46
+
47
+ async function post(body: unknown) {
48
+ const request = new Request('http://localhost/api/connect/tunnels', {
49
+ method: 'POST',
50
+ headers: { 'content-type': 'application/json' },
51
+ body: JSON.stringify(body),
52
+ });
53
+ const response = await action({ request } as never);
54
+ return {
55
+ status: response.status,
56
+ body: (await response.json()) as { ok?: boolean; error?: string; status?: ConnectStatus },
57
+ };
58
+ }
59
+
60
+ let previousConfig: string | undefined;
61
+ let previousDataDir: string | undefined;
62
+
63
+ beforeEach(async () => {
64
+ previousConfig = Bun.env.CLOUDFLARED_CONFIG;
65
+ previousDataDir = Bun.env.KABMO_DATA_DIR;
66
+ Bun.env.KABMO_DATA_DIR = tempDir();
67
+ await isolateDb();
68
+ });
69
+
70
+ afterEach(async () => {
71
+ if (previousConfig === undefined) delete Bun.env.CLOUDFLARED_CONFIG;
72
+ else Bun.env.CLOUDFLARED_CONFIG = previousConfig;
73
+ if (previousDataDir === undefined) delete Bun.env.KABMO_DATA_DIR;
74
+ else Bun.env.KABMO_DATA_DIR = previousDataDir;
75
+ await releaseDb();
76
+ for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });
77
+ });
78
+
79
+ describe('POST /api/connect/tunnels config action', () => {
80
+ test('persists a runnable config path and reports it in the payload', async () => {
81
+ const file = writeConfig();
82
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: file });
83
+
84
+ expect(status).toBe(200);
85
+ expect(body.ok).toBe(true);
86
+ expect(body.status?.cloudflareConfigPath).toBe(path.resolve(file));
87
+ });
88
+
89
+ test('refuses a config that does not exist', async () => {
90
+ const missing = path.join(tempDir(), 'nope.yml');
91
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: missing });
92
+
93
+ expect(status).toBe(400);
94
+ expect(body.error).toContain(missing);
95
+ expect(body.status).toBeDefined();
96
+ });
97
+
98
+ test('refuses a config with no ingress hostname', async () => {
99
+ const file = path.join(tempDir(), 'config.yml');
100
+ fs.writeFileSync(file, 'tunnel: t\ningress:\n - service: http_status:404\n');
101
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: file });
102
+
103
+ expect(status).toBe(400);
104
+ expect(body.error).toContain('no ingress hostname');
105
+ });
106
+
107
+ test('refuses a config path for tailscale', async () => {
108
+ const { status, body } = await post({ provider: 'tailscale', action: 'config', path: writeConfig() });
109
+
110
+ expect(status).toBe(400);
111
+ expect(body.error).toBe('Only the Cloudflare tunnel takes a config path.');
112
+ });
113
+
114
+ test('refuses an unknown action', async () => {
115
+ const { status, body } = await post({ provider: 'cloudflare', action: 'restart' });
116
+
117
+ expect(status).toBe(400);
118
+ expect(body.error).toContain('Expected');
119
+ });
120
+
121
+ test.skipIf(process.platform === 'win32')('stops a running tunnel when the config path changes', async () => {
122
+ const first = writeConfig();
123
+ Bun.env.CLOUDFLARED_CONFIG = first;
124
+
125
+ const dir = tempDir();
126
+ const binary = path.join(dir, 'cloudflared');
127
+ fs.writeFileSync(binary, '#!/bin/sh\nexec sleep 30\n');
128
+ fs.chmodSync(binary, 0o755);
129
+
130
+ const port = Number(Bun.env.PORT) || 3000;
131
+ const started = await startCloudflared(binary, first, 'kabmo.example.com', port);
132
+ expect(started.ok).toBe(true);
133
+ expect(cloudflaredAlive(port)).toBe(true);
134
+
135
+ const { status } = await post({ provider: 'cloudflare', action: 'config', path: writeConfig() });
136
+
137
+ expect(status).toBe(200);
138
+ expect(cloudflaredAlive(port)).toBe(false);
139
+ expect(runningTunnelUrl(port)).toBeNull();
140
+ });
141
+ });
@@ -4,11 +4,12 @@
4
4
  */
5
5
 
6
6
  /**
7
- * `POST /api/connect/tunnels` — start or stop one provider.
7
+ * `POST /api/connect/tunnels` — start or stop one provider, or point the
8
+ * Cloudflare row at a different config file.
8
9
  *
9
10
  * The response is the whole status payload rather than a boolean: the page has
10
- * to redraw the address list and the tunnel card together, and a second read
11
- * would let the two disagree for a frame.
11
+ * to redraw the address list, the tunnel card and the config path together, and
12
+ * a second read would let the two disagree for a frame.
12
13
  *
13
14
  * A refusal carries the provider's own sentence. "Tailscale refused: HTTPS is
14
15
  * not enabled for this tailnet" is actionable; `{ ok: false }` is not.
@@ -18,15 +19,21 @@ import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/re
18
19
  import { connectStatus, currentPort } from '@/server/lib/connect/status.server';
19
20
  import { findTailscale, startServe, stopServe } from '@/server/lib/connect/tailscale.server';
20
21
  import {
22
+ cloudflaredAlive,
21
23
  findCloudflared,
22
- readCloudflaredConfig,
23
24
  startCloudflared,
24
25
  stopCloudflared,
25
26
  } from '@/server/lib/connect/cloudflared.server';
27
+ import {
28
+ readCloudflaredConfig,
29
+ resolveCloudflaredConfigPath,
30
+ saveCloudflaredConfigPath,
31
+ } from '@/server/lib/connect/cloudflared-config.server';
26
32
 
27
33
  interface TunnelRequest {
28
34
  provider?: unknown;
29
35
  action?: unknown;
36
+ path?: unknown;
30
37
  }
31
38
 
32
39
  export async function action({ request }: ActionFunctionArgs) {
@@ -37,9 +44,16 @@ export async function action({ request }: ActionFunctionArgs) {
37
44
  const body = (await request.json().catch(() => null)) as TunnelRequest | null;
38
45
  const provider = body?.provider;
39
46
  const verb = body?.action;
40
- if ((provider !== 'tailscale' && provider !== 'cloudflare') || (verb !== 'start' && verb !== 'stop')) {
47
+ const knownVerb = verb === 'start' || verb === 'stop' || verb === 'config';
48
+ if ((provider !== 'tailscale' && provider !== 'cloudflare') || !knownVerb) {
49
+ return json(
50
+ { error: 'Expected { provider: "tailscale" | "cloudflare", action: "start" | "stop" | "config" }' },
51
+ { status: 400, headers: NO_STORE_HEADERS },
52
+ );
53
+ }
54
+ if (verb === 'config' && provider !== 'cloudflare') {
41
55
  return json(
42
- { error: 'Expected { provider: "tailscale" | "cloudflare", action: "start" | "stop" }' },
56
+ { error: 'Only the Cloudflare tunnel takes a config path.' },
43
57
  { status: 400, headers: NO_STORE_HEADERS },
44
58
  );
45
59
  }
@@ -57,8 +71,19 @@ export async function action({ request }: ActionFunctionArgs) {
57
71
  }
58
72
  } else if (verb === 'stop') {
59
73
  stopCloudflared(port);
74
+ } else if (verb === 'config') {
75
+ const before = await resolveCloudflaredConfigPath();
76
+ const saved = await saveCloudflaredConfigPath(body?.path);
77
+ if (!saved.ok) {
78
+ failure = saved.reason;
79
+ } else if (saved.path !== before && cloudflaredAlive(port)) {
80
+ // The running process holds the old file; leaving it up would make the
81
+ // page name a path the tunnel is not using.
82
+ stopCloudflared(port);
83
+ }
60
84
  } else {
61
- const presence = findCloudflared();
85
+ const configPath = await resolveCloudflaredConfigPath();
86
+ const presence = findCloudflared(configPath);
62
87
  const config = presence.configPath ? readCloudflaredConfig(presence.configPath) : null;
63
88
  if (presence.reason || !presence.binary || !presence.configPath || !config?.hostname) {
64
89
  failure = presence.reason ?? 'cloudflared is not configured.';
@@ -41,8 +41,17 @@ import {
41
41
  listNotificationEventsAfter,
42
42
  } from '@/server/lib/notifications/store.server';
43
43
 
44
- /** Long enough that a phone's radio sleeps between beats, short enough to notice a dead link. */
45
- const HEARTBEAT_MS = 25_000;
44
+ /**
45
+ * The comment frame that proves the stream is alive.
46
+ *
47
+ * 60 s, not 25: this stream has exactly one consumer — the Android watcher — and
48
+ * every beat is a radio wakeup on a phone that is otherwise asleep. 25 s woke it
49
+ * more than twice as often for the same liveness proof; 60 s lets it idle for
50
+ * most of the interval, and the shell's read timeout (150 s, two and a half
51
+ * beats) still notices a link that died. The page does not use this route: an
52
+ * open page has the realtime socket, whose own heartbeat is separate.
53
+ */
54
+ const HEARTBEAT_MS = 60_000;
46
55
 
47
56
  async function platformEnabled(platform: NotificationPlatform): Promise<boolean> {
48
57
  try {
@@ -81,6 +81,13 @@ export interface ConnectStatus {
81
81
  version: string;
82
82
  addresses: ConnectAddress[];
83
83
  tunnels: TunnelState[];
84
+ /**
85
+ * The cloudflared config the Cloudflare row reads and the start path runs.
86
+ *
87
+ * The page shows it because "which file am I using?" is the question a user
88
+ * with two configs cannot answer from the tunnel's state alone.
89
+ */
90
+ cloudflareConfigPath: string;
84
91
  devices: PairedDevice[];
85
92
  }
86
93
 
@@ -1 +0,0 @@
1
- import{df}from"./index-nb8tp4mj.js";export{df as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{fp}from"./index-43qpbxjv.js";export{fp as default};
@@ -1 +0,0 @@
1
- import{zl}from"./index-1wjp16f0.js";import"./index-9t82sx0w.js";export{zl as default};
@@ -1 +0,0 @@
1
- import{ad,is,oh,sh,lh,ch}from"./index-7smwzkvq.js";export{oh as css,ch as gss,is as keywords,lh as less,ad as mkCSS,sh as sCSS};
@@ -1 +0,0 @@
1
- import{af}from"./index-nb8tp4mj.js";export{af as createCynefinServices};
@@ -1 +0,0 @@
1
- import{pf}from"./index-nb8tp4mj.js";export{pf as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-vnw3hbeg.js";import"./index-k7q01ye4.js";import{ih}from"./index-b8s3xraa.js";export{ih as diagram};
@@ -1 +0,0 @@
1
- import{of}from"./index-nb8tp4mj.js";export{of as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{Df}from"./index-8mwragbj.js";import"./index-pnt0vc59.js";import"./index-jc1yagmk.js";import"./index-0j518hqm.js";import"./index-rv89xpaf.js";export{Df as default};