@fedify/cli 1.8.12 → 2.0.0-dev.1761

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 (130) hide show
  1. package/deno.json +71 -0
  2. package/dist/cache.js +17 -0
  3. package/dist/deno.js +71 -0
  4. package/dist/docloader.js +52 -0
  5. package/dist/globals.js +49 -0
  6. package/dist/imagerenderer.js +105 -0
  7. package/dist/inbox/rendercode.js +57 -0
  8. package/dist/inbox/view.js +508 -0
  9. package/dist/inbox.js +315 -0
  10. package/dist/init/action/configs.js +81 -0
  11. package/dist/init/action/deps.js +52 -0
  12. package/dist/init/action/dir.js +16 -0
  13. package/dist/init/action/env.js +13 -0
  14. package/dist/init/action/install.js +22 -0
  15. package/dist/init/action/mod.js +39 -0
  16. package/dist/init/action/notice.js +62 -0
  17. package/dist/init/action/patch.js +141 -0
  18. package/dist/init/action/precommand.js +23 -0
  19. package/dist/init/action/recommend.js +24 -0
  20. package/dist/init/action/set.js +31 -0
  21. package/dist/init/action/templates.js +57 -0
  22. package/dist/init/action/utils.js +50 -0
  23. package/dist/init/ask/dir.js +82 -0
  24. package/dist/init/ask/kv.js +33 -0
  25. package/dist/init/ask/mod.js +16 -0
  26. package/dist/init/ask/mq.js +33 -0
  27. package/dist/init/ask/pm.js +49 -0
  28. package/dist/init/ask/wf.js +29 -0
  29. package/dist/init/command.js +25 -0
  30. package/dist/init/const.js +31 -0
  31. package/dist/init/json/biome.js +24 -0
  32. package/dist/init/json/kv.js +53 -0
  33. package/dist/init/json/mq.js +72 -0
  34. package/dist/init/json/pm.js +44 -0
  35. package/dist/init/json/rt.js +39 -0
  36. package/dist/init/json/vscode-settings-for-deno.js +53 -0
  37. package/dist/init/json/vscode-settings.js +49 -0
  38. package/dist/init/lib.js +129 -0
  39. package/dist/init/mod.js +5 -0
  40. package/dist/init/webframeworks.js +133 -0
  41. package/dist/kv.bun.js +17 -0
  42. package/dist/kv.node.js +17 -0
  43. package/dist/log.js +52 -0
  44. package/dist/lookup.js +287 -0
  45. package/dist/mod.js +34 -0
  46. package/dist/nodeinfo.js +261 -0
  47. package/dist/table.js +24 -0
  48. package/dist/tempserver.js +71 -0
  49. package/dist/tunnel.js +21 -0
  50. package/dist/utils.js +67 -0
  51. package/dist/webfinger/action.js +44 -0
  52. package/dist/webfinger/command.js +20 -0
  53. package/dist/webfinger/error.js +47 -0
  54. package/dist/webfinger/lib.js +45 -0
  55. package/dist/webfinger/mod.js +5 -0
  56. package/package.json +64 -24
  57. package/scripts/pack.ts +64 -0
  58. package/src/cache.ts +17 -0
  59. package/src/docloader.ts +67 -0
  60. package/src/globals.ts +43 -0
  61. package/src/imagerenderer.ts +149 -0
  62. package/src/inbox/entry.ts +10 -0
  63. package/src/inbox/rendercode.ts +68 -0
  64. package/src/inbox/view.tsx +598 -0
  65. package/src/inbox.tsx +535 -0
  66. package/src/init/action/configs.ts +88 -0
  67. package/src/init/action/deps.ts +93 -0
  68. package/src/init/action/dir.ts +11 -0
  69. package/src/init/action/env.ts +14 -0
  70. package/src/init/action/install.ts +59 -0
  71. package/src/init/action/mod.ts +66 -0
  72. package/src/init/action/notice.ts +101 -0
  73. package/src/init/action/patch.ts +212 -0
  74. package/src/init/action/precommand.ts +22 -0
  75. package/src/init/action/recommend.ts +38 -0
  76. package/src/init/action/set.ts +78 -0
  77. package/src/init/action/templates.ts +95 -0
  78. package/src/init/action/utils.ts +64 -0
  79. package/src/init/ask/dir.ts +98 -0
  80. package/src/init/ask/kv.ts +39 -0
  81. package/src/init/ask/mod.ts +23 -0
  82. package/src/init/ask/mq.ts +37 -0
  83. package/src/init/ask/pm.ts +58 -0
  84. package/src/init/ask/wf.ts +27 -0
  85. package/src/init/command.ts +64 -0
  86. package/src/init/const.ts +4 -0
  87. package/src/init/json/biome.json +17 -0
  88. package/src/init/json/kv.json +39 -0
  89. package/src/init/json/mq.json +95 -0
  90. package/src/init/json/pm.json +47 -0
  91. package/src/init/json/rt.json +42 -0
  92. package/src/init/json/vscode-settings-for-deno.json +43 -0
  93. package/src/init/json/vscode-settings.json +41 -0
  94. package/src/init/lib.ts +220 -0
  95. package/src/init/mod.ts +2 -0
  96. package/src/init/templates/defaults/federation.ts.tpl +23 -0
  97. package/src/init/templates/defaults/logging.ts.tpl +23 -0
  98. package/src/init/templates/express/app.ts.tpl +16 -0
  99. package/src/init/templates/express/index.ts.tpl +6 -0
  100. package/src/init/templates/hono/app.tsx.tpl +14 -0
  101. package/src/init/templates/hono/index/bun.ts.tpl +10 -0
  102. package/src/init/templates/hono/index/deno.ts.tpl +13 -0
  103. package/src/init/templates/hono/index/node.ts.tpl +14 -0
  104. package/src/init/templates/next/middleware.ts.tpl +45 -0
  105. package/src/init/templates/nitro/nitro.config.ts.tpl +5 -0
  106. package/src/init/templates/nitro/server/error.ts.tpl +3 -0
  107. package/src/init/templates/nitro/server/middleware/federation.ts.tpl +8 -0
  108. package/src/init/types.ts +88 -0
  109. package/src/init/webframeworks.ts +151 -0
  110. package/src/kv.bun.ts +12 -0
  111. package/src/kv.node.ts +11 -0
  112. package/src/log.ts +64 -0
  113. package/src/lookup.test.ts +182 -0
  114. package/src/lookup.ts +558 -0
  115. package/src/mod.ts +45 -0
  116. package/src/nodeinfo.test.ts +229 -0
  117. package/src/nodeinfo.ts +447 -0
  118. package/src/table.ts +17 -0
  119. package/src/tempserver.ts +87 -0
  120. package/src/tunnel.ts +32 -0
  121. package/src/utils.ts +136 -0
  122. package/src/webfinger/action.ts +50 -0
  123. package/src/webfinger/command.ts +59 -0
  124. package/src/webfinger/error.ts +47 -0
  125. package/src/webfinger/lib.ts +37 -0
  126. package/src/webfinger/mod.test.ts +79 -0
  127. package/src/webfinger/mod.ts +2 -0
  128. package/tsdown.config.ts +24 -0
  129. package/src/install.mjs +0 -189
  130. package/src/run.mjs +0 -22
@@ -0,0 +1,598 @@
1
+ /** @jsx react-jsx */
2
+ /** @jsxImportSource hono/jsx */
3
+ import type { LogRecord } from "@logtape/logtape";
4
+ import { getStatusText } from "@poppanator/http-constants";
5
+ import { type FC, Fragment, type PropsWithChildren } from "hono/jsx";
6
+ import { getSingletonHighlighter } from "shiki";
7
+ import util from "node:util";
8
+ import type { ActivityEntry } from "./entry.ts";
9
+ import {
10
+ renderActivity,
11
+ renderRawActivity,
12
+ renderRequest,
13
+ renderResponse,
14
+ } from "./rendercode.ts";
15
+
16
+ interface LayoutProps {
17
+ title?: string;
18
+ handle: string;
19
+ }
20
+
21
+ const Layout: FC<PropsWithChildren<LayoutProps>> = (
22
+ props: PropsWithChildren<LayoutProps>,
23
+ ) => {
24
+ return (
25
+ <html>
26
+ <head>
27
+ <meta charset="utf-8" />
28
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
29
+ <title>
30
+ {props.title == null
31
+ ? ""
32
+ // deno-lint-ignore jsx-curly-braces
33
+ : <Fragment>{props.title} &mdash;{" "}</Fragment>}Fedify Ephemeral
34
+ Inbox ({props.handle})
35
+ </title>
36
+ <link
37
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
38
+ rel="stylesheet"
39
+ integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
40
+ crossorigin="anonymous"
41
+ />
42
+ </head>
43
+ <body>
44
+ <header class="container mt-3 mb-3 text-center">
45
+ <svg
46
+ width="48"
47
+ height="48"
48
+ viewBox="0 0 112 112"
49
+ version="1.1"
50
+ id="svg5"
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ xmlns:svg="http://www.w3.org/2000/svg"
53
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
54
+ xmlns:cc="http://creativecommons.org/ns#"
55
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
56
+ >
57
+ <defs id="defs5">
58
+ <clipPath
59
+ clipPathUnits="userSpaceOnUse"
60
+ id="clipPath8"
61
+ >
62
+ <ellipse
63
+ style="fill:#000000;stroke:#000000;stroke-width:3.02635;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
64
+ id="ellipse8"
65
+ cx="55.92646"
66
+ cy="56.073448"
67
+ transform="rotate(-0.07519647)"
68
+ rx="54.486828"
69
+ ry="54.486824"
70
+ />
71
+ </clipPath>
72
+ </defs>
73
+ <title id="title1">Fedify</title>
74
+ <ellipse
75
+ style="fill:#ffffff;stroke:none;stroke-width:3.02635;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
76
+ id="path8-2"
77
+ cx="55.92646"
78
+ cy="56.073448"
79
+ transform="rotate(-0.07519647)"
80
+ rx="54.486828"
81
+ ry="54.486824"
82
+ />
83
+ <g
84
+ id="g8"
85
+ clip-path="url(#clipPath8)"
86
+ >
87
+ <g id="g5">
88
+ <path
89
+ d="M 77.4624,78.9593 C 78.2802,68.3428 73.7143,58.8833 71.3291,55.4806 L 87.6847,48.335 c 4.9066,1.6333 6.474,17.3537 6.6444,25.0098 0,0 -3.5778,0.5104 -5.6222,2.0416 -2.085,1.5616 -5.6222,5.1041 -11.2445,3.5729 z"
90
+ fill="#ffffff"
91
+ stroke="#84b5d9"
92
+ stroke-width="3"
93
+ stroke-linecap="round"
94
+ id="path1"
95
+ />
96
+ <path
97
+ d="M 7.06239,52.159 C -5.55748,54.1782 -12.682,66.0659 -17.661,73.2769 c -0.8584,13.3918 -0.6181,41.1021 7.211,44.8111 7.82906,3.709 26.9553,1.545 35.5398,0 v 4.121 c 1.3736,0.515 5.0477,1.648 8.7562,2.06 3.7085,0.412 6.696,-1.202 7.7261,-2.06 v -9.787 c 0.5151,-0.343 2.9874,-1.957 8.7562,-5.666 7.211,-4.635 11.3315,-16.482 9.7863,-24.7229 -1.1589,-6.181 3.6055,-18.5427 6.1809,-26.7838 9.7863,2.0601 22.148,-1.0301 23.1781,-14.9369 C 90.1205,31.5801 80.7174,19.9868 63.2051,25.3752 45.6927,30.7636 48.268,52.159 41.5721,59.37 35.3913,53.1891 23.5446,49.5219 7.06239,52.159 Z"
98
+ fill="#bae6fd"
99
+ stroke="#0c4a6e"
100
+ stroke-width="3"
101
+ stroke-linecap="round"
102
+ id="path3"
103
+ />
104
+ <path
105
+ d="M 66.2955,55.2493 C 64.5786,54.7342 60.9387,53.6011 60.1146,53.189"
106
+ stroke="#0284c7"
107
+ stroke-opacity="0.37"
108
+ stroke-width="3"
109
+ stroke-linecap="round"
110
+ id="path4"
111
+ style="opacity:1;fill:none;stroke-width:3;stroke-linejoin:miter;stroke-dasharray:none;paint-order:normal"
112
+ />
113
+ <path
114
+ d="m 41.5721,59.3698 c -0.6868,0.8585 -2.6784,2.7814 -5.1507,3.6055"
115
+ stroke="#0284c7"
116
+ stroke-opacity="0.37"
117
+ stroke-width="3"
118
+ stroke-linecap="round"
119
+ id="path5"
120
+ style="fill:none"
121
+ />
122
+ <circle
123
+ cx="68.870796"
124
+ cy="42.8876"
125
+ r="2.0602801"
126
+ fill="#000000"
127
+ id="circle5"
128
+ />
129
+ </g>
130
+ <g
131
+ id="g2"
132
+ transform="matrix(0.08160718,0,0,0.08160718,76.994732,53.205469)"
133
+ style="display:inline"
134
+ >
135
+ <path
136
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#a730b8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
137
+ d="m 181.13086,275.13672 a 68.892408,68.892408 0 0 1 -29.46484,29.32812 l 161.75781,162.38868 38.99805,-19.76368 z m 213.36328,214.1875 -38.99805,19.76367 81.96289,82.2832 a 68.892409,68.892409 0 0 1 29.47071,-29.33203 z"
138
+ id="path9722"
139
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
140
+ />
141
+ <path
142
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#5496be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
143
+ d="m 581.64648,339.39062 -91.57617,46.41016 6.75196,43.18945 103.61523,-52.51367 A 68.892409,68.892409 0 0 1 581.64648,339.39062 Z M 436.9082,412.74219 220.38281,522.47656 a 68.892408,68.892408 0 0 1 18.79492,37.08985 L 443.66016,455.93359 Z"
144
+ id="path9729"
145
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
146
+ />
147
+ <path
148
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ce3d1a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
149
+ d="M 367.27539,142.4375 262.79492,346.4082 293.64258,377.375 404.26562,161.41797 A 68.892408,68.892408 0 0 1 367.27539,142.4375 Z m -131.6543,257.02148 -52.92187,103.31446 a 68.892409,68.892409 0 0 1 36.98633,18.97851 l 46.78125,-91.32812 z"
150
+ id="path9713"
151
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
152
+ />
153
+ <path
154
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#d0188f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
155
+ d="m 150.76758,304.91797 a 68.892408,68.892408 0 0 1 -34.41602,7.19531 68.892408,68.892408 0 0 1 -6.65039,-0.69531 l 30.90235,197.66211 a 68.892409,68.892409 0 0 1 34.41601,-7.19531 68.892409,68.892409 0 0 1 6.64649,0.69531 z"
156
+ id="path1015"
157
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
158
+ />
159
+ <path
160
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#5b36e9;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
161
+ d="m 239.3418,560.54492 a 68.892408,68.892408 0 0 1 0.7207,13.87696 68.892408,68.892408 0 0 1 -7.26758,27.17968 l 197.62891,31.71289 a 68.892409,68.892409 0 0 1 -0.72266,-13.8789 68.892409,68.892409 0 0 1 7.26953,-27.17774 z"
162
+ id="path1674"
163
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
164
+ />
165
+ <path
166
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#30b873;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
167
+ d="m 601.13281,377.19922 -91.21875,178.08203 a 68.892408,68.892408 0 0 1 36.99414,18.98242 L 638.125,396.18359 a 68.892409,68.892409 0 0 1 -36.99219,-18.98437 z"
168
+ id="path1676"
169
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
170
+ />
171
+ <path
172
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ebe305;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
173
+ d="m 476.72266,125.33008 a 68.892408,68.892408 0 0 1 -29.47071,29.33203 l 141.26563,141.81055 a 68.892409,68.892409 0 0 1 29.46875,-29.33204 z"
174
+ id="path1678"
175
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
176
+ />
177
+ <path
178
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#f47601;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
179
+ d="m 347.78711,104.63086 -178.57617,90.49805 a 68.892409,68.892409 0 0 1 18.79297,37.08593 l 178.57421,-90.50195 a 68.892408,68.892408 0 0 1 -18.79101,-37.08203 z"
180
+ id="path1680"
181
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
182
+ />
183
+ <path
184
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#57c115;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
185
+ d="m 446.92578,154.82617 a 68.892408,68.892408 0 0 1 -34.98242,7.48242 68.892408,68.892408 0 0 1 -6.0293,-0.63281 l 15.81836,101.29102 43.16211,6.92578 z m -16,167.02735 37.40039,239.48242 a 68.892409,68.892409 0 0 1 33.91406,-6.94336 68.892409,68.892409 0 0 1 7.20704,0.79101 L 474.08984,328.77734 Z"
186
+ id="path9758"
187
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
188
+ />
189
+ <path
190
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#dbb210;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
191
+ d="m 188.13086,232.97461 a 68.892408,68.892408 0 0 1 0.75781,14.0957 68.892408,68.892408 0 0 1 -7.16015,26.98242 l 101.36914,16.28125 19.92382,-38.9082 z m 173.73633,27.90039 -19.92578,38.91211 239.51367,38.4668 a 68.892409,68.892409 0 0 1 -0.69531,-13.71875 68.892409,68.892409 0 0 1 7.34961,-27.32422 z"
192
+ id="path9760"
193
+ transform="matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
194
+ />
195
+ <circle
196
+ style="fill:#ffca00;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784"
197
+ id="path817"
198
+ cx="106.26596"
199
+ cy="51.535553"
200
+ r="16.570711"
201
+ transform="rotate(3.1178174)"
202
+ />
203
+ <circle
204
+ id="path819"
205
+ style="fill:#64ff00;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784"
206
+ cx="171.42836"
207
+ cy="110.19328"
208
+ r="16.570711"
209
+ transform="rotate(3.1178174)"
210
+ />
211
+ <circle
212
+ id="path823"
213
+ style="fill:#00a3ff;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784"
214
+ cx="135.76379"
215
+ cy="190.27704"
216
+ r="16.570711"
217
+ transform="rotate(3.1178174)"
218
+ />
219
+ <circle
220
+ style="fill:#9500ff;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784"
221
+ id="path825"
222
+ cx="48.559471"
223
+ cy="181.1138"
224
+ r="16.570711"
225
+ transform="rotate(3.1178174)"
226
+ />
227
+ <circle
228
+ id="path827"
229
+ style="fill:#ff0000;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784"
230
+ cx="30.328812"
231
+ cy="95.366837"
232
+ r="16.570711"
233
+ transform="rotate(3.1178174)"
234
+ />
235
+ </g>
236
+ </g>
237
+ <circle
238
+ style="opacity:1;fill:none;stroke:#84b5d9;stroke-width:4.91342;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
239
+ id="path8"
240
+ cx="55.926456"
241
+ cy="56.073448"
242
+ transform="rotate(-0.07519625)"
243
+ r="53.543289"
244
+ />
245
+ </svg>
246
+
247
+ <h1 class="h5">Fedify Ephemeral Inbox</h1>
248
+ <p class="text-body-secondary" style="user-select: all;">
249
+ {props.handle}
250
+ </p>
251
+ </header>
252
+ <main class="container mt-3 mb-3">
253
+ {props.children}
254
+ </main>
255
+ </body>
256
+ </html>
257
+ );
258
+ };
259
+
260
+ interface TabProps {
261
+ active?: boolean;
262
+ disabled?: boolean;
263
+ label: string;
264
+ badge?: string | number;
265
+ href: string;
266
+ }
267
+
268
+ const Tab: FC<TabProps> = (
269
+ { active, disabled, label, badge, href }: TabProps,
270
+ ) => {
271
+ return (
272
+ <li class="nav-item">
273
+ {active
274
+ ? (
275
+ <span class="nav-link active" style="cursor: default;">
276
+ {label}
277
+ {badge != null
278
+ ? (
279
+ <Fragment>
280
+ {" "}
281
+ <span class="badge text-bg-secondary">{badge}</span>
282
+ </Fragment>
283
+ )
284
+ : undefined}
285
+ </span>
286
+ )
287
+ : disabled
288
+ ? <span class="nav-link disabled">{label}</span>
289
+ : (
290
+ <a class="nav-link" href={href}>
291
+ {label}
292
+ {badge != null
293
+ ? (
294
+ <Fragment>
295
+ {" "}
296
+ <span class="badge text-bg-secondary">{badge}</span>
297
+ </Fragment>
298
+ )
299
+ : undefined}
300
+ </a>
301
+ )}
302
+ </li>
303
+ );
304
+ };
305
+
306
+ // deno-lint-ignore no-empty-interface
307
+ interface TabListProps {
308
+ }
309
+
310
+ const TabList: FC<PropsWithChildren<TabListProps>> = (
311
+ { children }: PropsWithChildren<TabListProps>,
312
+ ) => {
313
+ return (
314
+ <ul class="nav nav-tabs">
315
+ {children}
316
+ </ul>
317
+ );
318
+ };
319
+
320
+ interface CodeBlockProps {
321
+ language: string;
322
+ code: string;
323
+ }
324
+
325
+ const highlighter = await getSingletonHighlighter();
326
+ await highlighter.loadTheme("github-light");
327
+ await highlighter.loadLanguage("http");
328
+ await highlighter.loadLanguage("json");
329
+
330
+ const CodeBlock: FC<CodeBlockProps> = ({ language, code }: CodeBlockProps) => {
331
+ const result = highlighter.codeToHtml(code, {
332
+ lang: language,
333
+ theme: "github-light",
334
+ });
335
+ return <div dangerouslySetInnerHTML={{ __html: result }} class="m-3" />;
336
+ };
337
+
338
+ interface LogProps {
339
+ log: LogRecord;
340
+ }
341
+
342
+ const Log: FC<LogProps> = (
343
+ { log: { timestamp, category, level, message } }: LogProps,
344
+ ) => {
345
+ const listClass = level === "debug"
346
+ ? "list-group-item-light"
347
+ : level === "info"
348
+ ? ""
349
+ : level === "warning"
350
+ ? "list-group-item-warning"
351
+ : "list-group-item-danger";
352
+ const time = Temporal.Instant.fromEpochMilliseconds(timestamp);
353
+ return (
354
+ <li class={"list-group-item " + listClass}>
355
+ <div class="d-flex w-100 justify-content-between">
356
+ <p class="mb-1" style="white-space: pre-wrap; word-break: break-word;">
357
+ {message.map((m, i) =>
358
+ i % 2 == 0 ? m : (
359
+ <code key={i}>
360
+ {typeof m === "string" ? m : util.inspect(m)}
361
+ </code>
362
+ )
363
+ )}
364
+ </p>
365
+ <time
366
+ class="text-body-secondary"
367
+ datetime={time.toString()}
368
+ style="flex-shrink: 0;"
369
+ >
370
+ <small>{time.toLocaleString()}</small>
371
+ </time>
372
+ </div>
373
+ <small class="text-body-secondary">
374
+ {category.map((c, i) =>
375
+ // deno-lint-ignore jsx-curly-braces
376
+ i < 1 ? c : <Fragment key={i.toString()}>{" "}/ {c}</Fragment>
377
+ )}
378
+ </small>
379
+ </li>
380
+ );
381
+ };
382
+
383
+ interface LogListProps {
384
+ logs: LogRecord[];
385
+ }
386
+
387
+ const LogList: FC<LogListProps> = ({ logs }: LogListProps) => {
388
+ return (
389
+ <ul class="list-group mt-3">
390
+ {logs.map((log) => <Log key={log.timestamp} log={log} />)}
391
+ </ul>
392
+ );
393
+ };
394
+
395
+ type ActivityEntryTabPage =
396
+ | "request"
397
+ | "response"
398
+ | "raw-activity"
399
+ | "compact-activity"
400
+ | "expanded-activity"
401
+ | "logs";
402
+
403
+ interface ActivityEntryViewProps {
404
+ entry: ActivityEntry;
405
+ tabPage: ActivityEntryTabPage;
406
+ }
407
+
408
+ const ActivityEntryView: FC<ActivityEntryViewProps> = async (
409
+ { tabPage, entry: { activity, request, response, logs } }:
410
+ ActivityEntryViewProps,
411
+ ) => {
412
+ return (
413
+ <div>
414
+ <TabList>
415
+ <Tab
416
+ label="Request"
417
+ href="?tab=request"
418
+ active={tabPage === "request"}
419
+ />
420
+ <Tab
421
+ label="Response"
422
+ href="?tab=response"
423
+ disabled={response == null}
424
+ active={tabPage === "response"}
425
+ />
426
+ <Tab
427
+ label="Raw Activity"
428
+ href="?tab=raw-activity"
429
+ disabled={activity == null}
430
+ active={tabPage === "raw-activity"}
431
+ />
432
+ <Tab
433
+ label="Compact Activity"
434
+ href="?tab=compact-activity"
435
+ disabled={activity == null}
436
+ active={tabPage === "compact-activity"}
437
+ />
438
+ <Tab
439
+ label="Expanded Activity"
440
+ href="?tab=expanded-activity"
441
+ disabled={activity == null}
442
+ active={tabPage === "expanded-activity"}
443
+ />
444
+ <Tab
445
+ label="Logs"
446
+ href="?tab=logs"
447
+ badge={logs.length}
448
+ active={tabPage === "logs"}
449
+ />
450
+ </TabList>
451
+ {tabPage === "request" && (
452
+ <div class="tab-page">
453
+ <CodeBlock
454
+ code={await renderRequest(request)}
455
+ language="http"
456
+ />
457
+ </div>
458
+ )}
459
+ {tabPage === "response" && response != null && (
460
+ <div class="tab-page">
461
+ <CodeBlock
462
+ code={await renderResponse(response)}
463
+ language="http"
464
+ />
465
+ </div>
466
+ )}
467
+ {tabPage === "raw-activity" && (
468
+ <div class="tab-page">
469
+ <CodeBlock
470
+ code={await renderRawActivity(request)}
471
+ language="json"
472
+ />
473
+ </div>
474
+ )}
475
+ {tabPage === "compact-activity" && activity != null && (
476
+ <div class="tab-page">
477
+ <CodeBlock
478
+ code={await renderActivity(activity, false)}
479
+ language="json"
480
+ />
481
+ </div>
482
+ )}
483
+ {tabPage === "expanded-activity" && activity != null && (
484
+ <div class="tab-page">
485
+ <CodeBlock
486
+ code={await renderActivity(activity, true)}
487
+ language="json"
488
+ />
489
+ </div>
490
+ )}
491
+ {tabPage === "logs" && (
492
+ <div class="tab-page">
493
+ <LogList logs={logs} />
494
+ </div>
495
+ )}
496
+ </div>
497
+ );
498
+ };
499
+
500
+ export interface ActivityEntryPageProps extends ActivityEntryViewProps {
501
+ handle: string;
502
+ idx: number;
503
+ }
504
+
505
+ export const ActivityEntryPage: FC<ActivityEntryPageProps> = (
506
+ { handle, idx, entry, tabPage }: ActivityEntryPageProps,
507
+ ) => {
508
+ return (
509
+ <Layout handle={handle} title={`Request #${idx}`}>
510
+ <nav aria-label="breadcrumb">
511
+ <ol class="breadcrumb">
512
+ <li class="breadcrumb-item">
513
+ <a href="/r">Inbox</a>
514
+ </li>
515
+ <li class="breadcrumb-item active" aria-current="page">
516
+ Request #{idx} (<time datetime={entry.timestamp.toString()}>
517
+ {entry.timestamp.toLocaleString()}
518
+ </time>)
519
+ </li>
520
+ </ol>
521
+ </nav>
522
+
523
+ <ActivityEntryView entry={entry} tabPage={tabPage} />
524
+ </Layout>
525
+ );
526
+ };
527
+
528
+ export interface ActivityListProps {
529
+ entries: ActivityEntry[];
530
+ }
531
+
532
+ const ActivityList: FC<ActivityListProps> = (
533
+ { entries }: ActivityListProps,
534
+ ) => {
535
+ return (
536
+ <div class="list-group">
537
+ {entries.map((entry, i) => {
538
+ const failed = entry.activity == null || entry.response == null ||
539
+ !entry.response.ok || entry.request.method !== "POST";
540
+ const itemClass = failed ? "list-group-item-danger" : "";
541
+ const url = new URL(entry.request.url);
542
+ return (
543
+ <a
544
+ class={"list-group-item list-group-item-action d-flex w-100 justify-content-between " +
545
+ itemClass}
546
+ href={`/r/${i}`}
547
+ >
548
+ <span>
549
+ Request #{i}:{" "}
550
+ <code>{entry.request.method} {url.pathname + url.search}</code>
551
+ {entry.activity == null ? "" : (
552
+ <Fragment>
553
+ {} &middot; <code>{entry.activity.constructor.name}</code>
554
+ </Fragment>
555
+ )}
556
+ {entry.response == null ? "" : (
557
+ <Fragment>
558
+ {} &rarr;{" "}
559
+ <code>
560
+ {entry.response.status} {entry.response.statusText === ""
561
+ ? getStatusText(entry.response.status)
562
+ : entry.response.statusText}
563
+ </code>
564
+ </Fragment>
565
+ )}
566
+ </span>
567
+ <time
568
+ class="text-body-secondary"
569
+ timestamp={entry.timestamp.toString()}
570
+ >
571
+ <small>{entry.timestamp.toLocaleString()}</small>
572
+ </time>
573
+ </a>
574
+ );
575
+ }).reverse()}
576
+ </div>
577
+ );
578
+ };
579
+
580
+ export interface ActivityListPageProps extends ActivityListProps {
581
+ handle: string;
582
+ }
583
+
584
+ export const ActivityListPage: FC<ActivityListPageProps> = (
585
+ { handle, entries }: ActivityListPageProps,
586
+ ) => {
587
+ return (
588
+ <Layout handle={handle}>
589
+ <nav aria-label="breadcrumb">
590
+ <ol class="breadcrumb">
591
+ <li class="breadcrumb-item active" aria-current="page">Inbox</li>
592
+ </ol>
593
+ </nav>
594
+
595
+ <ActivityList entries={entries} />
596
+ </Layout>
597
+ );
598
+ };