@celljs/ta-relay 4.24.0 → 4.25.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.
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/esm/common/index.d.ts +5 -0
- package/esm/common/index.js +5 -0
- package/esm/common/relay-accounts.d.ts +2 -0
- package/esm/common/relay-accounts.js +21 -0
- package/esm/common/relay-blobs.d.ts +2 -0
- package/esm/common/relay-blobs.js +1 -0
- package/esm/common/relay-content-origin.d.ts +44 -0
- package/esm/common/relay-content-origin.js +67 -0
- package/esm/common/relay-content.d.ts +2 -0
- package/esm/common/relay-content.js +12 -2
- package/esm/common/relay-friends.js +1 -1
- package/esm/common/relay-hub-util.js +1 -1
- package/esm/common/relay-hub.js +4 -4
- package/esm/common/relay-hubs-admins.js +3 -3
- package/esm/common/relay-hubs.js +5 -5
- package/esm/common/relay-info.d.ts +11 -1
- package/esm/common/relay-info.js +20 -2
- package/esm/common/relay-moderation-client.d.ts +32 -0
- package/esm/common/relay-moderation-client.js +51 -0
- package/esm/common/relay-moderation-door.d.ts +24 -0
- package/esm/common/relay-moderation-door.js +48 -0
- package/esm/common/relay-moderation-policy.d.ts +78 -0
- package/esm/common/relay-moderation-policy.js +59 -0
- package/esm/common/relay-moderation.d.ts +165 -0
- package/esm/common/relay-moderation.js +464 -0
- package/esm/common/relay-protocol.d.ts +5 -1
- package/esm/common/relay-protocol.js +4 -0
- package/esm/common/relay-room-app.d.ts +5 -0
- package/esm/common/relay-room-app.js +8 -0
- package/esm/node/relay-chat-files.js +1 -1
- package/esm/node/relay-server-accounts.d.ts +2 -0
- package/esm/node/relay-server-accounts.js +4 -0
- package/esm/node/relay-server-gate.d.ts +39 -0
- package/esm/node/relay-server-gate.js +124 -0
- package/esm/node/relay-server-web.d.ts +5 -0
- package/esm/node/relay-server-web.js +28 -0
- package/esm/node/relay-server.d.ts +9 -2
- package/esm/node/relay-server.js +40 -47
- package/esm/node/relay-store.d.ts +4 -0
- package/esm/node/relay-store.js +2 -0
- package/esm/viewer/viewer-i18n.d.ts +25 -0
- package/esm/viewer/viewer-i18n.js +132 -32
- package/esm/viewer/viewer-style.d.ts +1 -1
- package/esm/viewer/viewer-style.js +13 -0
- package/esm/viewer/viewer.js +127 -6
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +5 -0
- package/lib/common/relay-accounts.d.ts +2 -0
- package/lib/common/relay-accounts.js +21 -0
- package/lib/common/relay-blobs.d.ts +2 -0
- package/lib/common/relay-blobs.js +1 -0
- package/lib/common/relay-content-origin.d.ts +45 -0
- package/lib/common/relay-content-origin.js +71 -0
- package/lib/common/relay-content.d.ts +2 -0
- package/lib/common/relay-content.js +12 -2
- package/lib/common/relay-friends.js +1 -1
- package/lib/common/relay-hub-util.js +1 -1
- package/lib/common/relay-hub.js +4 -4
- package/lib/common/relay-hubs-admins.js +3 -3
- package/lib/common/relay-hubs.js +5 -5
- package/lib/common/relay-info.d.ts +11 -1
- package/lib/common/relay-info.js +20 -2
- package/lib/common/relay-moderation-client.d.ts +33 -0
- package/lib/common/relay-moderation-client.js +54 -0
- package/lib/common/relay-moderation-door.d.ts +25 -0
- package/lib/common/relay-moderation-door.js +51 -0
- package/lib/common/relay-moderation-policy.d.ts +79 -0
- package/lib/common/relay-moderation-policy.js +62 -0
- package/lib/common/relay-moderation.d.ts +166 -0
- package/lib/common/relay-moderation.js +468 -0
- package/lib/common/relay-protocol.d.ts +5 -1
- package/lib/common/relay-protocol.js +4 -0
- package/lib/common/relay-room-app.d.ts +5 -0
- package/lib/common/relay-room-app.js +8 -0
- package/lib/node/relay-chat-files.js +1 -1
- package/lib/node/relay-server-accounts.d.ts +2 -0
- package/lib/node/relay-server-accounts.js +4 -0
- package/lib/node/relay-server-gate.d.ts +40 -0
- package/lib/node/relay-server-gate.js +128 -0
- package/lib/node/relay-server-web.d.ts +6 -0
- package/lib/node/relay-server-web.js +31 -0
- package/lib/node/relay-server.d.ts +9 -2
- package/lib/node/relay-server.js +39 -46
- package/lib/node/relay-store.d.ts +4 -0
- package/lib/node/relay-store.js +2 -0
- package/lib/viewer/viewer-i18n.d.ts +25 -0
- package/lib/viewer/viewer-i18n.js +132 -32
- package/lib/viewer/viewer-style.d.ts +1 -1
- package/lib/viewer/viewer-style.js +13 -0
- package/lib/viewer/viewer.js +127 -6
- package/package.json +3 -3
- package/viewer/join.html +5 -5
- package/viewer/page.html +25 -12
- package/viewer/room.html +4 -4
|
@@ -13,14 +13,23 @@ const zh = {
|
|
|
13
13
|
open: '打开',
|
|
14
14
|
wrong: '口令不对,再试一次。',
|
|
15
15
|
busy: '口令错得太多了,请过几分钟再试。',
|
|
16
|
-
gone: '
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
gone: '这个链接已经失效',
|
|
17
|
+
goneHint: '分享已停止或已过期,请分享的人重新分享一次。',
|
|
18
|
+
offline: '分享的人的电脑没有运行 Ta',
|
|
19
|
+
offlineHint: '请对方打开电脑上的 Ta 后再试;想关机也能看,请对方重新分享并勾选“电脑关机也能打开”。',
|
|
20
|
+
self: '这是仅自己可见的分享',
|
|
21
|
+
selfHint: '只有分享的人能在自己的 Ta 里打开;想给别人看,请对方改成“拿到链接的人”重新分享。',
|
|
22
|
+
people: '这条链接只给指定的 Ta 好友',
|
|
23
|
+
peopleHint: '是其中一位就在你的 Ta 里打开;不是的话,请对方先加你为好友再分享。',
|
|
24
|
+
invalid: '链接不完整',
|
|
25
|
+
invalidHint: '请检查是否复制完整,# 后面的部分也要带上。',
|
|
26
|
+
timeout: '等了太久还没收到',
|
|
27
|
+
timeoutHint: '对方电脑可能在休眠或网络慢,稍后再试。',
|
|
28
|
+
large: '内容太大,浏览器打不开',
|
|
29
|
+
largeHint: '可以在 Ta 里打开,或请分享的人拆成小一点的文件再分享。',
|
|
30
|
+
failed: '打不开这个分享',
|
|
31
|
+
failedHint: '稍后再试;还不行就请分享的人重新分享。',
|
|
32
|
+
retry: '重试',
|
|
24
33
|
you: '你',
|
|
25
34
|
ta: 'Ta',
|
|
26
35
|
outputsOmitted: '分享时没有附上工具的输出。',
|
|
@@ -48,6 +57,22 @@ const zh = {
|
|
|
48
57
|
webSearch: '搜索网页',
|
|
49
58
|
script: '运行脚本',
|
|
50
59
|
use: '使用 {name}',
|
|
60
|
+
report: '举报',
|
|
61
|
+
reportTitle: '举报这个分享',
|
|
62
|
+
reportHint: '中继看不到分享的内容,举报后由中继的运营方核实;属实的会停止这条链接。',
|
|
63
|
+
reasonPhishing: '钓鱼或诈骗',
|
|
64
|
+
reasonMalware: '病毒或恶意软件',
|
|
65
|
+
reasonSexual: '色情内容',
|
|
66
|
+
reasonIllegal: '违法内容',
|
|
67
|
+
reasonHarassment: '骚扰或侵权',
|
|
68
|
+
reasonOther: '其他',
|
|
69
|
+
reportNote: '补充说明(可选)',
|
|
70
|
+
reportWithLink: '附上链接,方便运营方查看内容',
|
|
71
|
+
send: '提交',
|
|
72
|
+
cancel: '取消',
|
|
73
|
+
reportSent: '已收到举报,谢谢。',
|
|
74
|
+
reportFailed: '没能提交,请稍后再试。',
|
|
75
|
+
blocked: '这个链接已被中继的运营方停止',
|
|
51
76
|
};
|
|
52
77
|
const zhTw = {
|
|
53
78
|
openInTa: '在 Ta 中開啟',
|
|
@@ -63,14 +88,23 @@ const zhTw = {
|
|
|
63
88
|
open: '開啟',
|
|
64
89
|
wrong: '口令不對,再試一次。',
|
|
65
90
|
busy: '口令錯得太多了,請過幾分鐘再試。',
|
|
66
|
-
gone: '
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
91
|
+
gone: '這個連結已經失效',
|
|
92
|
+
goneHint: '分享已停止或已過期,請分享的人重新分享一次。',
|
|
93
|
+
offline: '分享的人的電腦沒有執行 Ta',
|
|
94
|
+
offlineHint: '請對方開啟電腦上的 Ta 後再試;想關機也能看,請對方重新分享並勾選「電腦關機也能開啟」。',
|
|
95
|
+
self: '這是僅自己可見的分享',
|
|
96
|
+
selfHint: '只有分享的人能在自己的 Ta 裡開啟;想給別人看,請對方改成「拿到連結的人」重新分享。',
|
|
97
|
+
people: '這條連結只給指定的 Ta 好友',
|
|
98
|
+
peopleHint: '是其中一位就在你的 Ta 裡開啟;不是的話,請對方先加你為好友再分享。',
|
|
99
|
+
invalid: '連結不完整',
|
|
100
|
+
invalidHint: '請檢查是否複製完整,# 後面的部分也要帶上。',
|
|
101
|
+
timeout: '等了太久還沒收到',
|
|
102
|
+
timeoutHint: '對方電腦可能在休眠或網路慢,稍後再試。',
|
|
103
|
+
large: '內容太大,瀏覽器打不開',
|
|
104
|
+
largeHint: '可以在 Ta 裡開啟,或請分享的人拆成小一點的檔案再分享。',
|
|
105
|
+
failed: '打不開這個分享',
|
|
106
|
+
failedHint: '稍後再試;還不行就請分享的人重新分享。',
|
|
107
|
+
retry: '重試',
|
|
74
108
|
you: '你',
|
|
75
109
|
ta: 'Ta',
|
|
76
110
|
outputsOmitted: '分享時沒有附上工具的輸出。',
|
|
@@ -98,6 +132,22 @@ const zhTw = {
|
|
|
98
132
|
webSearch: '搜尋網頁',
|
|
99
133
|
script: '執行指令碼',
|
|
100
134
|
use: '使用 {name}',
|
|
135
|
+
report: '檢舉',
|
|
136
|
+
reportTitle: '檢舉這個分享',
|
|
137
|
+
reportHint: '中繼看不到分享的內容,檢舉後由中繼的營運方核實;屬實的會停止這條連結。',
|
|
138
|
+
reasonPhishing: '釣魚或詐騙',
|
|
139
|
+
reasonMalware: '病毒或惡意軟體',
|
|
140
|
+
reasonSexual: '色情內容',
|
|
141
|
+
reasonIllegal: '違法內容',
|
|
142
|
+
reasonHarassment: '騷擾或侵權',
|
|
143
|
+
reasonOther: '其他',
|
|
144
|
+
reportNote: '補充說明(可選)',
|
|
145
|
+
reportWithLink: '附上連結,方便營運方檢視內容',
|
|
146
|
+
send: '送出',
|
|
147
|
+
cancel: '取消',
|
|
148
|
+
reportSent: '已收到檢舉,謝謝。',
|
|
149
|
+
reportFailed: '沒能送出,請稍後再試。',
|
|
150
|
+
blocked: '這個連結已被中繼的營運方停止',
|
|
101
151
|
};
|
|
102
152
|
const en = {
|
|
103
153
|
openInTa: 'Open in Ta',
|
|
@@ -113,14 +163,23 @@ const en = {
|
|
|
113
163
|
open: 'Open',
|
|
114
164
|
wrong: 'That password is wrong. Try again.',
|
|
115
165
|
busy: 'Too many wrong passwords. Try again in a few minutes.',
|
|
116
|
-
gone: 'This link no longer works
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
166
|
+
gone: 'This link no longer works',
|
|
167
|
+
goneHint: 'The share was stopped or ran out: ask the one who shared it to share it again.',
|
|
168
|
+
offline: 'The computer that shared it is not running Ta',
|
|
169
|
+
offlineHint: 'Ask them to open Ta on it and try again; to open it while that computer is off, they share it again with “Opens while this computer is off”.',
|
|
170
|
+
self: 'Only the one who shared this opens it',
|
|
171
|
+
selfHint: 'It opens only in their own Ta; to show it to others, they share it again for “Anyone with the link”.',
|
|
172
|
+
people: 'This link is for chosen Ta friends only',
|
|
173
|
+
peopleHint: 'If you are one of them, open it in your own Ta; if not, ask them to add you as a friend and share it again.',
|
|
174
|
+
invalid: 'This link is not whole',
|
|
175
|
+
invalidHint: 'Check that it was copied in full, the part after # too.',
|
|
176
|
+
timeout: 'It took too long to come',
|
|
177
|
+
timeoutHint: 'Their computer may be asleep or the network slow. Try again later.',
|
|
178
|
+
large: 'It is too large to open in a browser',
|
|
179
|
+
largeHint: 'Open it in Ta, or ask the one who shared it to share smaller files.',
|
|
180
|
+
failed: 'This share does not open',
|
|
181
|
+
failedHint: 'Try again later; if it still fails, ask the one who shared it to share it again.',
|
|
182
|
+
retry: 'Try again',
|
|
124
183
|
you: 'You',
|
|
125
184
|
ta: 'Ta',
|
|
126
185
|
outputsOmitted: 'The outputs of the tools were not shared.',
|
|
@@ -148,6 +207,22 @@ const en = {
|
|
|
148
207
|
webSearch: 'Search the web',
|
|
149
208
|
script: 'Run a script',
|
|
150
209
|
use: 'Use {name}',
|
|
210
|
+
report: 'Report',
|
|
211
|
+
reportTitle: 'Report this share',
|
|
212
|
+
reportHint: 'The relay cannot see what is shared: the operator of the relay looks into reports, and stops the link when it is so.',
|
|
213
|
+
reasonPhishing: 'Phishing or scam',
|
|
214
|
+
reasonMalware: 'Virus or malware',
|
|
215
|
+
reasonSexual: 'Sexual content',
|
|
216
|
+
reasonIllegal: 'Illegal content',
|
|
217
|
+
reasonHarassment: 'Harassment or infringement',
|
|
218
|
+
reasonOther: 'Other',
|
|
219
|
+
reportNote: 'More about it (optional)',
|
|
220
|
+
reportWithLink: 'Send the link, so the operator can see what it shares',
|
|
221
|
+
send: 'Send',
|
|
222
|
+
cancel: 'Cancel',
|
|
223
|
+
reportSent: 'Thanks, the report was sent.',
|
|
224
|
+
reportFailed: 'It could not be sent. Try again later.',
|
|
225
|
+
blocked: 'The operator of the relay stopped this link',
|
|
151
226
|
};
|
|
152
227
|
const ja = {
|
|
153
228
|
openInTa: 'Ta で開く',
|
|
@@ -163,14 +238,23 @@ const ja = {
|
|
|
163
238
|
open: '開く',
|
|
164
239
|
wrong: 'パスワードが違います。もう一度試してください。',
|
|
165
240
|
busy: 'パスワード入力を間違えすぎました。数分後にもう一度試してください。',
|
|
166
|
-
gone: '
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
241
|
+
gone: 'このリンクはもう有効ではありません',
|
|
242
|
+
goneHint: '共有が停止されたか期限切れです。共有した人にもう一度共有してもらってください。',
|
|
243
|
+
offline: '共有したコンピューターで Ta が動いていません',
|
|
244
|
+
offlineHint: '相手にそのコンピューターで Ta を開いてもらってから再度お試しください。オフでも開けるようにするには、「コンピューターがオフの場合でも開く」を選んで共有し直してもらってください。',
|
|
245
|
+
self: 'これは共有者だけが見られる共有です',
|
|
246
|
+
selfHint: '共有者が自分の Ta でのみ開けます。ほかの人に見せるには、「リンクを持っている人」で共有し直してもらってください。',
|
|
247
|
+
people: 'このリンクは指定された Ta 友だち専用です',
|
|
248
|
+
peopleHint: '対象の方は自分の Ta で開いてください。そうでない場合は、友だちに追加してから共有し直してもらってください。',
|
|
249
|
+
invalid: 'リンクが不完全です',
|
|
250
|
+
invalidHint: '# 以降も含めて全体がコピーされているか確認してください。',
|
|
251
|
+
timeout: '到着に時間がかかりすぎました',
|
|
252
|
+
timeoutHint: '相手のコンピューターがスリープ中か、ネットワークが遅い可能性があります。後で再度お試しください。',
|
|
253
|
+
large: 'ブラウザで開くには大きすぎます',
|
|
254
|
+
largeHint: 'Ta で開くか、共有した人に小さなファイルに分けて共有してもらってください。',
|
|
255
|
+
failed: 'この共有を開けません',
|
|
256
|
+
failedHint: '後で再度お試しください。それでも開けない場合は、共有した人に共有し直してもらってください。',
|
|
257
|
+
retry: '再試行',
|
|
174
258
|
you: 'あなた',
|
|
175
259
|
ta: 'Ta',
|
|
176
260
|
outputsOmitted: 'ツールの出力は共有されていません。',
|
|
@@ -198,6 +282,22 @@ const ja = {
|
|
|
198
282
|
webSearch: 'ウェブを検索',
|
|
199
283
|
script: 'スクリプトを実行',
|
|
200
284
|
use: '{name} を使用',
|
|
285
|
+
report: '報告',
|
|
286
|
+
reportTitle: 'この共有を報告',
|
|
287
|
+
reportHint: 'リレーは共有の内容を見られません。報告はリレーの運営者が確認し、事実ならこのリンクを停止します。',
|
|
288
|
+
reasonPhishing: 'フィッシング・詐欺',
|
|
289
|
+
reasonMalware: 'ウイルス・マルウェア',
|
|
290
|
+
reasonSexual: '性的なコンテンツ',
|
|
291
|
+
reasonIllegal: '違法なコンテンツ',
|
|
292
|
+
reasonHarassment: '嫌がらせ・権利侵害',
|
|
293
|
+
reasonOther: 'その他',
|
|
294
|
+
reportNote: '補足(任意)',
|
|
295
|
+
reportWithLink: 'リンクを添付して、運営者が内容を確認できるようにする',
|
|
296
|
+
send: '送信',
|
|
297
|
+
cancel: 'キャンセル',
|
|
298
|
+
reportSent: '報告を受け付けました。ありがとうございます。',
|
|
299
|
+
reportFailed: '送信できませんでした。あとでもう一度お試しください。',
|
|
300
|
+
blocked: 'このリンクはリレーの運営者により停止されました',
|
|
201
301
|
};
|
|
202
302
|
/** The words of each language of Ta, checked by scripts/check-i18n.ts. */
|
|
203
303
|
export const VIEWER_WORDS = { 'zh-CN': zh, 'zh-TW': zhTw, 'en-US': en, 'ja-JP': ja };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VIEWER_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--code:#f6f6f6;--accent:#16a34a;--warn:#d97706;--radius:14px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#2a2a2a;--code:#232323;--accent:#4ade80;--warn:#fbbf24}}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased}\n.top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.6) blur(12px);-webkit-backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid var(--line)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.top .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}\n.top button{flex:none}\nmain{max-width:760px;margin:0 auto;padding:28px 18px 40px}\nmain.wide{max-width:none;padding:0}\nh1.title{font-size:22px;line-height:1.35;margin:0 0 6px;letter-spacing:-.01em;word-break:break-word}\n.meta{color:var(--muted);font-size:13px;margin:0 0 22px;display:flex;flex-wrap:wrap;gap:4px 12px}\n.notes{color:var(--muted);font-size:12.5px;margin:-10px 0 22px;display:flex;flex-direction:column;gap:2px}\n.msg{margin:0 0 18px}\n.msg.user{display:flex;justify-content:flex-end}\n.msg.user .bubble{background:var(--bubble);border-radius:var(--radius) var(--radius) 4px var(--radius);padding:9px 14px;max-width:85%;white-space:pre-wrap;word-break:break-word}\n.msg.ta .text>:first-child{margin-top:0}.msg.ta .text>:last-child{margin-bottom:0}\n.text{word-break:break-word}\n.text p{margin:0 0 .75em}\n.text h2,.text h3,.text h4,.text h5,.text h6{margin:1.2em 0 .5em;line-height:1.35}\n.text h2{font-size:1.25em}.text h3{font-size:1.1em}.text h4,.text h5,.text h6{font-size:1em}\n.text ul,.text ol{margin:0 0 .75em;padding-left:1.4em}.text li{margin:.2em 0}\n.text blockquote{margin:0 0 .75em;padding:2px 0 2px 12px;border-left:3px solid var(--line);color:var(--muted)}\n.text a{color:inherit;text-decoration:underline;text-decoration-color:var(--faint);text-underline-offset:2px}\n.text code{font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--code);padding:1px 5px;border-radius:5px}\n.text pre{background:var(--code);border-radius:10px;padding:12px 14px;overflow:auto;margin:0 0 .85em}\n.text pre code{background:none;padding:0;font-size:12.5px;white-space:pre}\n.text hr{border:0;border-top:1px solid var(--line);margin:1.2em 0}\n.text .table{overflow:auto;margin:0 0 .85em}\n.text table{border-collapse:collapse;font-size:14px}\n.text th,.text td{border:1px solid var(--line);padding:5px 10px;text-align:left;vertical-align:top}\n.text th{background:var(--soft);font-weight:600}\n.tools{margin:4px 0 10px;display:flex;flex-direction:column;gap:1px}\n.tool{display:flex;align-items:baseline;gap:8px;color:var(--muted);font-size:13.5px;min-width:0;padding:2px 0}\n.tool .dot{width:6px;height:6px;border-radius:50%;background:var(--accent);flex:none;transform:translateY(-2px)}\n.tool.failed .dot{background:var(--faint)}\n.tool .verb{flex:none}\n.tool .target{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fg);opacity:.8}\n.tool .target.code{font:12.5px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}\ndetails.out{margin:0 0 6px 14px}\ndetails.out summary{cursor:pointer;color:var(--faint);font-size:12.5px;list-style:none}\ndetails.out summary::-webkit-details-marker{display:none}\ndetails.out pre{margin:6px 0 0;background:var(--code);border-radius:8px;padding:10px 12px;max-height:280px;overflow:auto;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-word}\n.err{color:var(--warn);font-size:13.5px}\n.card{max-width:380px;margin:12vh auto 0;padding:28px 24px;border:1px solid var(--line);border-radius:18px;text-align:center}\n.card h2{font-size:17px;margin:12px 0 6px}\n.card p{color:var(--muted);font-size:13.5px;margin:0 0 16px}\n.card .icon{width:44px;height:44px;border-radius:50%;background:var(--soft);color:var(--muted);display:grid;place-items:center;margin:0 auto}\n.card form{display:flex;gap:8px}\n.card input{flex:1;min-width:0;font:inherit;padding:9px 12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);outline:none}\n.card input:focus{border-color:var(--muted)}\n.card .error{color:var(--warn);font-size:13px;margin:10px 0 0;min-height:1em}\nbutton{font:inherit;font-size:13.5px;padding:8px 14px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}\nbutton.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}\nbutton:disabled{opacity:.5;cursor:default}\n.spin{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--muted);border-radius:50%;margin:0 auto;animation:spin .8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:3s}}\n.agent-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;margin:8px 0 22px}\n.agent-face{width:64px;height:64px;border-radius:50%;background:var(--soft);color:#fff;display:grid;place-items:center;font-size:24px;font-weight:700;margin-bottom:8px;box-shadow:0 0 0 1px var(--line)}\n.agent-head h1.title{margin:0}.agent-head .meta{margin:0;justify-content:center}\n.agent-role{border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;background:var(--soft)}\n.agent-role>:first-child{margin-top:0}.agent-role>:last-child{margin-bottom:0}\n.agent .notes{margin:10px 0 0}\n.agent-hint{color:var(--muted);font-size:13.5px;text-align:center;margin:18px 0 0}\n.foot{max-width:760px;margin:0 auto;padding:18px 18px 40px;color:var(--faint);font-size:12.5px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px}\n.page{display:block;width:100%;height:calc(100vh - 48px);height:calc(100dvh - 48px);border:0;background:#fff}\n.file img{max-width:100%;border-radius:10px;display:block;margin:0 auto}\n.file pre{white-space:pre-wrap;word-break:break-word;background:var(--code);border-radius:10px;padding:14px;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}\n";
|
|
1
|
+
export declare const VIEWER_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--code:#f6f6f6;--accent:#16a34a;--warn:#d97706;--radius:14px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#2a2a2a;--code:#232323;--accent:#4ade80;--warn:#fbbf24}}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased}\n.top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.6) blur(12px);-webkit-backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid var(--line)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.top .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}\n.top button{flex:none}\nmain{max-width:760px;margin:0 auto;padding:28px 18px 40px}\nmain.wide{max-width:none;padding:0}\nh1.title{font-size:22px;line-height:1.35;margin:0 0 6px;letter-spacing:-.01em;word-break:break-word}\n.meta{color:var(--muted);font-size:13px;margin:0 0 22px;display:flex;flex-wrap:wrap;gap:4px 12px}\n.notes{color:var(--muted);font-size:12.5px;margin:-10px 0 22px;display:flex;flex-direction:column;gap:2px}\n.msg{margin:0 0 18px}\n.msg.user{display:flex;justify-content:flex-end}\n.msg.user .bubble{background:var(--bubble);border-radius:var(--radius) var(--radius) 4px var(--radius);padding:9px 14px;max-width:85%;white-space:pre-wrap;word-break:break-word}\n.msg.ta .text>:first-child{margin-top:0}.msg.ta .text>:last-child{margin-bottom:0}\n.text{word-break:break-word}\n.text p{margin:0 0 .75em}\n.text h2,.text h3,.text h4,.text h5,.text h6{margin:1.2em 0 .5em;line-height:1.35}\n.text h2{font-size:1.25em}.text h3{font-size:1.1em}.text h4,.text h5,.text h6{font-size:1em}\n.text ul,.text ol{margin:0 0 .75em;padding-left:1.4em}.text li{margin:.2em 0}\n.text blockquote{margin:0 0 .75em;padding:2px 0 2px 12px;border-left:3px solid var(--line);color:var(--muted)}\n.text a{color:inherit;text-decoration:underline;text-decoration-color:var(--faint);text-underline-offset:2px}\n.text code{font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--code);padding:1px 5px;border-radius:5px}\n.text pre{background:var(--code);border-radius:10px;padding:12px 14px;overflow:auto;margin:0 0 .85em}\n.text pre code{background:none;padding:0;font-size:12.5px;white-space:pre}\n.text hr{border:0;border-top:1px solid var(--line);margin:1.2em 0}\n.text .table{overflow:auto;margin:0 0 .85em}\n.text table{border-collapse:collapse;font-size:14px}\n.text th,.text td{border:1px solid var(--line);padding:5px 10px;text-align:left;vertical-align:top}\n.text th{background:var(--soft);font-weight:600}\n.tools{margin:4px 0 10px;display:flex;flex-direction:column;gap:1px}\n.tool{display:flex;align-items:baseline;gap:8px;color:var(--muted);font-size:13.5px;min-width:0;padding:2px 0}\n.tool .dot{width:6px;height:6px;border-radius:50%;background:var(--accent);flex:none;transform:translateY(-2px)}\n.tool.failed .dot{background:var(--faint)}\n.tool .verb{flex:none}\n.tool .target{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fg);opacity:.8}\n.tool .target.code{font:12.5px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}\ndetails.out{margin:0 0 6px 14px}\ndetails.out summary{cursor:pointer;color:var(--faint);font-size:12.5px;list-style:none}\ndetails.out summary::-webkit-details-marker{display:none}\ndetails.out pre{margin:6px 0 0;background:var(--code);border-radius:8px;padding:10px 12px;max-height:280px;overflow:auto;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-word}\n.err{color:var(--warn);font-size:13.5px}\n.card{max-width:380px;margin:12vh auto 0;padding:28px 24px;border:1px solid var(--line);border-radius:18px;text-align:center}\n.card h2{font-size:17px;margin:12px 0 6px}\n.card p{color:var(--muted);font-size:13.5px;margin:0 0 16px}\n.card .icon{width:44px;height:44px;border-radius:50%;background:var(--soft);color:var(--muted);display:grid;place-items:center;margin:0 auto}\n.card form{display:flex;gap:8px}\n.card input{flex:1;min-width:0;font:inherit;padding:9px 12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);outline:none}\n.card input:focus{border-color:var(--muted)}\n.card .actions{display:flex;gap:8px;justify-content:center}\n.card .actions a{font-size:13.5px;padding:8px 14px;border-radius:10px;background:var(--fg);color:var(--bg);text-decoration:none}\n.card .error{color:var(--warn);font-size:13px;margin:10px 0 0;min-height:1em}\nbutton{font:inherit;font-size:13.5px;padding:8px 14px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}\nbutton.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}\nbutton:disabled{opacity:.5;cursor:default}\n.spin{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--muted);border-radius:50%;margin:0 auto;animation:spin .8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:3s}}\n.agent-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;margin:8px 0 22px}\n.agent-face{width:64px;height:64px;border-radius:50%;background:var(--soft);color:#fff;display:grid;place-items:center;font-size:24px;font-weight:700;margin-bottom:8px;box-shadow:0 0 0 1px var(--line)}\n.agent-head h1.title{margin:0}.agent-head .meta{margin:0;justify-content:center}\n.agent-role{border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;background:var(--soft)}\n.agent-role>:first-child{margin-top:0}.agent-role>:last-child{margin-bottom:0}\n.agent .notes{margin:10px 0 0}\n.agent-hint{color:var(--muted);font-size:13.5px;text-align:center;margin:18px 0 0}\n.foot{max-width:760px;margin:0 auto;padding:18px 18px 40px;color:var(--faint);font-size:12.5px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px}\n.foot .report{align-self:flex-start;margin-top:6px;padding:0;border:0;background:none;color:var(--faint);font-size:12.5px;text-decoration:underline;text-underline-offset:2px}\n.report-dialog{position:fixed;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(0,0,0,.36)}\n.report-dialog form{width:100%;max-width:380px;background:var(--bg);color:var(--fg);border:1px solid var(--line);border-radius:16px;padding:20px;display:flex;flex-direction:column;gap:12px;box-shadow:0 12px 40px rgba(0,0,0,.18)}\n.report-dialog h2{margin:0;font-size:16px}\n.report-dialog p{margin:0;color:var(--faint);font-size:13px;line-height:1.5}\n.report-dialog .reasons{display:flex;flex-direction:column;gap:8px;font-size:14px}\n.report-dialog label{display:flex;align-items:center;gap:8px;cursor:pointer}\n.report-dialog textarea{font:inherit;font-size:14px;padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);resize:vertical}\n.report-dialog .actions{display:flex;justify-content:flex-end;gap:8px}\n.report-dialog .error{color:var(--warn);min-height:1em}\n.report-dialog .with-link{font-size:13px;color:var(--faint)}\n.page{display:block;width:100%;height:calc(100vh - 48px);height:calc(100dvh - 48px);border:0;background:#fff}\n.file img{max-width:100%;border-radius:10px;display:block;margin:0 auto}\n.file pre{white-space:pre-wrap;word-break:break-word;background:var(--code);border-radius:10px;padding:14px;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}\n";
|
|
@@ -52,6 +52,8 @@ details.out pre{margin:6px 0 0;background:var(--code);border-radius:8px;padding:
|
|
|
52
52
|
.card form{display:flex;gap:8px}
|
|
53
53
|
.card input{flex:1;min-width:0;font:inherit;padding:9px 12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);outline:none}
|
|
54
54
|
.card input:focus{border-color:var(--muted)}
|
|
55
|
+
.card .actions{display:flex;gap:8px;justify-content:center}
|
|
56
|
+
.card .actions a{font-size:13.5px;padding:8px 14px;border-radius:10px;background:var(--fg);color:var(--bg);text-decoration:none}
|
|
55
57
|
.card .error{color:var(--warn);font-size:13px;margin:10px 0 0;min-height:1em}
|
|
56
58
|
button{font:inherit;font-size:13.5px;padding:8px 14px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}
|
|
57
59
|
button.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}
|
|
@@ -67,6 +69,17 @@ button:disabled{opacity:.5;cursor:default}
|
|
|
67
69
|
.agent .notes{margin:10px 0 0}
|
|
68
70
|
.agent-hint{color:var(--muted);font-size:13.5px;text-align:center;margin:18px 0 0}
|
|
69
71
|
.foot{max-width:760px;margin:0 auto;padding:18px 18px 40px;color:var(--faint);font-size:12.5px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px}
|
|
72
|
+
.foot .report{align-self:flex-start;margin-top:6px;padding:0;border:0;background:none;color:var(--faint);font-size:12.5px;text-decoration:underline;text-underline-offset:2px}
|
|
73
|
+
.report-dialog{position:fixed;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(0,0,0,.36)}
|
|
74
|
+
.report-dialog form{width:100%;max-width:380px;background:var(--bg);color:var(--fg);border:1px solid var(--line);border-radius:16px;padding:20px;display:flex;flex-direction:column;gap:12px;box-shadow:0 12px 40px rgba(0,0,0,.18)}
|
|
75
|
+
.report-dialog h2{margin:0;font-size:16px}
|
|
76
|
+
.report-dialog p{margin:0;color:var(--faint);font-size:13px;line-height:1.5}
|
|
77
|
+
.report-dialog .reasons{display:flex;flex-direction:column;gap:8px;font-size:14px}
|
|
78
|
+
.report-dialog label{display:flex;align-items:center;gap:8px;cursor:pointer}
|
|
79
|
+
.report-dialog textarea{font:inherit;font-size:14px;padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);resize:vertical}
|
|
80
|
+
.report-dialog .actions{display:flex;justify-content:flex-end;gap:8px}
|
|
81
|
+
.report-dialog .error{color:var(--warn);min-height:1em}
|
|
82
|
+
.report-dialog .with-link{font-size:13px;color:var(--faint)}
|
|
70
83
|
.page{display:block;width:100%;height:calc(100vh - 48px);height:calc(100dvh - 48px);border:0;background:#fff}
|
|
71
84
|
.file img{max-width:100%;border-radius:10px;display:block;margin:0 auto}
|
|
72
85
|
.file pre{white-space:pre-wrap;word-break:break-word;background:var(--code);border-radius:10px;padding:14px;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}
|
package/esm/viewer/viewer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RELAY_AGENT_KIND, RelayAgentCards } from '../common/relay-card.js';
|
|
2
2
|
import { RelayContentError, RelayContentHandoff, RelayContentUtil } from '../common/relay-content.js';
|
|
3
3
|
import { RELAY_CONVERSATION_KIND } from '../common/relay-conversation.js';
|
|
4
|
+
import { RELAY_REPORT_PATH, RELAY_REPORT_REASONS } from '../common/relay-moderation.js';
|
|
4
5
|
import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
|
|
5
6
|
import { RELAY_FRAME_PATH } from '../common/relay-protocol.js';
|
|
6
7
|
import { RELAY_WEB_PATH } from '../common/relay-team.js';
|
|
@@ -277,6 +278,34 @@ function card(main, icon, title, hint) {
|
|
|
277
278
|
main.append(box);
|
|
278
279
|
return box;
|
|
279
280
|
}
|
|
281
|
+
const FAILURES = ['gone', 'offline', 'self', 'people', 'invalid', 'timeout', 'large', 'failed'];
|
|
282
|
+
/** What may open by itself a moment later. */
|
|
283
|
+
const RETRY = new Set(['offline', 'timeout', 'failed']);
|
|
284
|
+
/** What opens in Ta though not in a browser. */
|
|
285
|
+
const IN_TA = new Set(['self', 'people', 'large']);
|
|
286
|
+
function failed(main, reason) {
|
|
287
|
+
if (reason === 'busy') {
|
|
288
|
+
card(main, 'alert', t('busy'));
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const known = FAILURES.includes(reason) ? reason : 'failed';
|
|
292
|
+
const icon = known === 'offline' ? 'offline' : known === 'self' || known === 'people' ? 'self' : 'alert';
|
|
293
|
+
const box = card(main, icon, t(known), t(`${known}Hint`));
|
|
294
|
+
const actions = el('div');
|
|
295
|
+
actions.className = 'actions';
|
|
296
|
+
if (RETRY.has(known)) {
|
|
297
|
+
const retry = el('button', t('retry'));
|
|
298
|
+
retry.className = 'primary';
|
|
299
|
+
retry.addEventListener('click', () => location.reload());
|
|
300
|
+
actions.append(retry);
|
|
301
|
+
}
|
|
302
|
+
if (IN_TA.has(known)) {
|
|
303
|
+
actions.append(Object.assign(el('a', t('openInTa')), { href: RelayOpenInTa.link(location.href) }));
|
|
304
|
+
}
|
|
305
|
+
if (actions.childNodes.length) {
|
|
306
|
+
box.append(actions);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
280
309
|
function askPassword(main, error) {
|
|
281
310
|
const box = card(main, 'lock', t('passwordTitle'), t('passwordHint'));
|
|
282
311
|
const form = el('form');
|
|
@@ -323,13 +352,95 @@ function chrome(name) {
|
|
|
323
352
|
document.body.replaceChildren(top, main);
|
|
324
353
|
return main;
|
|
325
354
|
}
|
|
326
|
-
function footer(card) {
|
|
355
|
+
function footer(card, link) {
|
|
327
356
|
const foot = el('footer');
|
|
328
357
|
foot.className = 'foot';
|
|
329
358
|
// A card says how to add it above.
|
|
330
359
|
foot.append(...(card ? [] : [el('span', t('footer'))]), el('span', t('secure')));
|
|
360
|
+
if (link) {
|
|
361
|
+
const report = el('button', t('report'));
|
|
362
|
+
report.className = 'report';
|
|
363
|
+
report.addEventListener('click', () => reportForm(link));
|
|
364
|
+
foot.append(report);
|
|
365
|
+
}
|
|
331
366
|
document.body.append(foot);
|
|
332
367
|
}
|
|
368
|
+
const REASON_TEXT = {
|
|
369
|
+
phishing: 'reasonPhishing',
|
|
370
|
+
malware: 'reasonMalware',
|
|
371
|
+
sexual: 'reasonSexual',
|
|
372
|
+
illegal: 'reasonIllegal',
|
|
373
|
+
harassment: 'reasonHarassment',
|
|
374
|
+
other: 'reasonOther',
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* Reporting a link to the operator of the relay (docs/design/ta-link.md 2.10): its host and share go, never its key or
|
|
378
|
+
* what it shares, which the relay cannot read; the operator looks into it and may block the link.
|
|
379
|
+
*/
|
|
380
|
+
function reportForm(link) {
|
|
381
|
+
var _a;
|
|
382
|
+
(_a = document.querySelector('.report-dialog')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
383
|
+
const dialog = el('div');
|
|
384
|
+
dialog.className = 'report-dialog';
|
|
385
|
+
const box = el('form');
|
|
386
|
+
box.append(el('h2', t('reportTitle')), el('p', t('reportHint')));
|
|
387
|
+
const reasons = el('div');
|
|
388
|
+
reasons.className = 'reasons';
|
|
389
|
+
RELAY_REPORT_REASONS.forEach((reason, index) => {
|
|
390
|
+
const label = el('label');
|
|
391
|
+
const input = Object.assign(el('input'), { type: 'radio', name: 'reason', value: reason, checked: index === 0 });
|
|
392
|
+
label.append(input, el('span', t(REASON_TEXT[reason])));
|
|
393
|
+
reasons.append(label);
|
|
394
|
+
});
|
|
395
|
+
const note = Object.assign(el('textarea'), { placeholder: t('reportNote'), maxLength: 500, rows: 3 });
|
|
396
|
+
// The key goes only when the one who reports lets it: then the operator sees what is reported.
|
|
397
|
+
const withLink = Object.assign(el('input'), { type: 'checkbox', checked: link.access === 'link' || link.access === 'password' });
|
|
398
|
+
const linkRow = el('label');
|
|
399
|
+
linkRow.className = 'with-link';
|
|
400
|
+
linkRow.append(withLink, el('span', t('reportWithLink')));
|
|
401
|
+
const message = el('p');
|
|
402
|
+
message.className = 'error';
|
|
403
|
+
const cancel = Object.assign(el('button', t('cancel')), { type: 'button' });
|
|
404
|
+
cancel.addEventListener('click', () => dialog.remove());
|
|
405
|
+
const send = el('button', t('send'));
|
|
406
|
+
send.className = 'primary';
|
|
407
|
+
const actions = el('div');
|
|
408
|
+
actions.className = 'actions';
|
|
409
|
+
actions.append(cancel, send);
|
|
410
|
+
box.append(reasons, note, linkRow, message, actions);
|
|
411
|
+
box.addEventListener('submit', event => {
|
|
412
|
+
var _a;
|
|
413
|
+
var _b;
|
|
414
|
+
event.preventDefault();
|
|
415
|
+
const reason = (_b = (_a = box.querySelector('input[name=reason]:checked')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'other';
|
|
416
|
+
send.setAttribute('disabled', '');
|
|
417
|
+
void fetch(RELAY_REPORT_PATH, {
|
|
418
|
+
method: 'POST',
|
|
419
|
+
headers: { 'content-type': 'application/json' },
|
|
420
|
+
body: JSON.stringify({
|
|
421
|
+
host: link.host,
|
|
422
|
+
share: link.share,
|
|
423
|
+
reason,
|
|
424
|
+
note: note.value.trim() || undefined,
|
|
425
|
+
link: withLink.checked ? `${location.origin}${location.pathname}${location.hash}` : undefined,
|
|
426
|
+
}),
|
|
427
|
+
})
|
|
428
|
+
.then(response => {
|
|
429
|
+
if (!response.ok) {
|
|
430
|
+
throw new Error(String(response.status));
|
|
431
|
+
}
|
|
432
|
+
box.replaceChildren(el('h2', t('reportSent')));
|
|
433
|
+
setTimeout(() => dialog.remove(), 1600);
|
|
434
|
+
})
|
|
435
|
+
.catch(() => {
|
|
436
|
+
message.textContent = t('reportFailed');
|
|
437
|
+
send.removeAttribute('disabled');
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
dialog.addEventListener('click', event => event.target === dialog && dialog.remove());
|
|
441
|
+
dialog.append(box);
|
|
442
|
+
document.body.append(dialog);
|
|
443
|
+
}
|
|
333
444
|
/** Whether the relay serves Ta's web page (apps/ta-relay with its assets, `ta relay` given its files). */
|
|
334
445
|
async function richPage() {
|
|
335
446
|
var _a;
|
|
@@ -349,11 +460,18 @@ async function show() {
|
|
|
349
460
|
link = RelayContentUtil.parse(location.href);
|
|
350
461
|
}
|
|
351
462
|
catch (_b) {
|
|
352
|
-
|
|
463
|
+
failed(main, 'invalid');
|
|
353
464
|
return;
|
|
354
465
|
}
|
|
355
466
|
if (link.access === 'self' || link.access === 'people') {
|
|
356
|
-
|
|
467
|
+
failed(main, link.access);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
// Ta's own page of a conversation sends its "Report" here.
|
|
471
|
+
if (new URLSearchParams(location.search).has('report')) {
|
|
472
|
+
main.replaceChildren();
|
|
473
|
+
footer(true, link);
|
|
474
|
+
reportForm(link);
|
|
357
475
|
return;
|
|
358
476
|
}
|
|
359
477
|
// Ta's own page, where the relay has it (RELAY_WEB_PATH), draws a conversation as Ta does: its cards, plots and 3D.
|
|
@@ -387,7 +505,7 @@ async function show() {
|
|
|
387
505
|
file(main, item);
|
|
388
506
|
}
|
|
389
507
|
if (!main.classList.contains('wide')) {
|
|
390
|
-
footer(item.kind === RELAY_AGENT_KIND);
|
|
508
|
+
footer(item.kind === RELAY_AGENT_KIND, link);
|
|
391
509
|
}
|
|
392
510
|
return;
|
|
393
511
|
}
|
|
@@ -401,8 +519,11 @@ async function show() {
|
|
|
401
519
|
error = t('busy');
|
|
402
520
|
continue;
|
|
403
521
|
}
|
|
404
|
-
|
|
405
|
-
|
|
522
|
+
if (failure instanceof RelayContentError && reason === 'gone' && /operator/.test(failure.message)) {
|
|
523
|
+
card(main, 'alert', t('blocked'));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
failed(main, reason);
|
|
406
527
|
return;
|
|
407
528
|
}
|
|
408
529
|
}
|
package/lib/common/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './relay-card';
|
|
|
8
8
|
export * from './relay-chat-store';
|
|
9
9
|
export * from './relay-cipher';
|
|
10
10
|
export * from './relay-content';
|
|
11
|
+
export * from './relay-content-origin';
|
|
11
12
|
export * from './relay-conversation';
|
|
12
13
|
export * from './relay-faces';
|
|
13
14
|
export * from './relay-files';
|
|
@@ -23,6 +24,10 @@ export * from './relay-hubs-protocol';
|
|
|
23
24
|
export * from './relay-hubs-util';
|
|
24
25
|
export * from './relay-identity';
|
|
25
26
|
export * from './relay-info';
|
|
27
|
+
export * from './relay-moderation';
|
|
28
|
+
export * from './relay-moderation-client';
|
|
29
|
+
export * from './relay-moderation-door';
|
|
30
|
+
export * from './relay-moderation-policy';
|
|
26
31
|
export * from './relay-pairing';
|
|
27
32
|
export * from './relay-protocol';
|
|
28
33
|
export * from './relay-room';
|
package/lib/common/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./relay-card"), exports);
|
|
|
24
24
|
__exportStar(require("./relay-chat-store"), exports);
|
|
25
25
|
__exportStar(require("./relay-cipher"), exports);
|
|
26
26
|
__exportStar(require("./relay-content"), exports);
|
|
27
|
+
__exportStar(require("./relay-content-origin"), exports);
|
|
27
28
|
__exportStar(require("./relay-conversation"), exports);
|
|
28
29
|
__exportStar(require("./relay-faces"), exports);
|
|
29
30
|
__exportStar(require("./relay-files"), exports);
|
|
@@ -39,6 +40,10 @@ __exportStar(require("./relay-hubs-protocol"), exports);
|
|
|
39
40
|
__exportStar(require("./relay-hubs-util"), exports);
|
|
40
41
|
__exportStar(require("./relay-identity"), exports);
|
|
41
42
|
__exportStar(require("./relay-info"), exports);
|
|
43
|
+
__exportStar(require("./relay-moderation"), exports);
|
|
44
|
+
__exportStar(require("./relay-moderation-client"), exports);
|
|
45
|
+
__exportStar(require("./relay-moderation-door"), exports);
|
|
46
|
+
__exportStar(require("./relay-moderation-policy"), exports);
|
|
42
47
|
__exportStar(require("./relay-pairing"), exports);
|
|
43
48
|
__exportStar(require("./relay-protocol"), exports);
|
|
44
49
|
__exportStar(require("./relay-room"), exports);
|
|
@@ -92,6 +92,8 @@ export declare class RelayAccounts {
|
|
|
92
92
|
handle(request: Request): Promise<Response>;
|
|
93
93
|
protected provider(id: unknown): RelayAccountProvider;
|
|
94
94
|
protected poll(id: unknown, handle: unknown): Promise<AccountSignInPoll>;
|
|
95
|
+
/** The account of a bearer token, checked as a call checks it; undefined for one no longer of an account. */
|
|
96
|
+
whoIs(authorization: string): Promise<AccountName | undefined>;
|
|
95
97
|
protected call(authorization: string, op: unknown, args: unknown): Promise<unknown>;
|
|
96
98
|
}
|
|
97
99
|
/** The books of a `ta relay` or a gateway, in one process: the requests of one account one after another. */
|
|
@@ -345,6 +345,27 @@ class RelayAccounts {
|
|
|
345
345
|
await this.options.book(signedIn.id).handle({ op: 'issue', account: signedIn, hash: await relay_identity_1.RelayKeys.hash(token) });
|
|
346
346
|
return { status: 'done', token, account: signedIn };
|
|
347
347
|
}
|
|
348
|
+
/** The account of a bearer token, checked as a call checks it; undefined for one no longer of an account. */
|
|
349
|
+
async whoIs(authorization) {
|
|
350
|
+
const token = authorization.replace(/^Bearer\s+/i, '');
|
|
351
|
+
if (!token) {
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
if (this.options.authenticate) {
|
|
355
|
+
return this.options.authenticate(token);
|
|
356
|
+
}
|
|
357
|
+
const account = RelayAccounts.accountOf(token);
|
|
358
|
+
if (!account) {
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
try {
|
|
362
|
+
const roster = (await this.options.book(account).handle({ op: 'roster', args: [], hash: await relay_identity_1.RelayKeys.hash(token) }));
|
|
363
|
+
return roster.account;
|
|
364
|
+
}
|
|
365
|
+
catch (_a) {
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
348
369
|
async call(authorization, op, args) {
|
|
349
370
|
const token = authorization.replace(/^Bearer\s+/i, '');
|
|
350
371
|
if (!relay_account_1.ACCOUNT_CALLS.includes(op)) {
|
|
@@ -81,6 +81,8 @@ export declare namespace RelayBlobClient {
|
|
|
81
81
|
authHash: string;
|
|
82
82
|
expiresAt: number;
|
|
83
83
|
bytes: Uint8Array;
|
|
84
|
+
/** The token of the account it is put by, where the relay needs one of public links (RelayInfo.needsAccount). */
|
|
85
|
+
account?: string;
|
|
84
86
|
}
|
|
85
87
|
function put(copy: Copy): Promise<void>;
|
|
86
88
|
function remove(relay: string, share: string, token: string): Promise<void>;
|
|
@@ -168,6 +168,7 @@ var RelayBlobClient;
|
|
|
168
168
|
authorization: `Bearer ${copy.token}`,
|
|
169
169
|
'x-ta-auth-hash': copy.authHash,
|
|
170
170
|
'x-ta-expires': String(copy.expiresAt),
|
|
171
|
+
...(copy.account ? { 'x-ta-account': copy.account } : {}),
|
|
171
172
|
'content-type': 'application/octet-stream',
|
|
172
173
|
},
|
|
173
174
|
body: copy.bytes,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type RelayInfo } from './relay-info';
|
|
2
|
+
/** What a relay does with a request, by the domain it came to (RelayContentOrigin.route). */
|
|
3
|
+
export type RelayContentRoute =
|
|
4
|
+
/** Answer it as always. */
|
|
5
|
+
{
|
|
6
|
+
kind: 'serve';
|
|
7
|
+
}
|
|
8
|
+
/** A link of content on the relay's own domain: the same link on the domain of content (the fragment stays, as browsers keep it). */
|
|
9
|
+
| {
|
|
10
|
+
kind: 'redirect';
|
|
11
|
+
location: string;
|
|
12
|
+
}
|
|
13
|
+
/** Not here: 404. */
|
|
14
|
+
| {
|
|
15
|
+
kind: 'refuse';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The domain of content (RelayInfo.content, `TA_CONTENT_ORIGIN`): another domain of the same relay, where links of
|
|
19
|
+
* content open, so that what users share never shows on the relay's own domain (docs/design/ta-link.md 2.10). It
|
|
20
|
+
* answers only what a viewer needs: the pages of a link, the connection to the host that shared it, its copy, the
|
|
21
|
+
* report; the relay's own domain sends links of content there.
|
|
22
|
+
*/
|
|
23
|
+
export declare namespace RelayContentOrigin {
|
|
24
|
+
/** Whether the request came to the domain of content. */
|
|
25
|
+
function isContent(url: URL, content: string | undefined): boolean;
|
|
26
|
+
/** `content` none: the relay has no domain of content, and serves all on its own. */
|
|
27
|
+
function route(url: URL, content: string | undefined): RelayContentRoute;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Where links of content of each relay open, as the relay says (RelayInfo.content), asked again an hour later: its domain
|
|
31
|
+
* of content, else its own (also while it does not answer: the link still works, and it is sent on once there is one).
|
|
32
|
+
*/
|
|
33
|
+
export declare class RelayContentOrigins {
|
|
34
|
+
protected readonly probe: (relay: string) => Promise<RelayInfo | undefined>;
|
|
35
|
+
protected readonly known: Map<string, {
|
|
36
|
+
at: number;
|
|
37
|
+
info: Promise<RelayInfo | undefined>;
|
|
38
|
+
}>;
|
|
39
|
+
constructor(probe?: (relay: string) => Promise<RelayInfo | undefined>);
|
|
40
|
+
protected info(relay: string, now: number): Promise<RelayInfo | undefined>;
|
|
41
|
+
of(relay: string, now?: number): Promise<string | undefined>;
|
|
42
|
+
/** Whether the relay needs the one who shares a public link to have signed in to an account (RelayInfo.needsAccount). */
|
|
43
|
+
needsAccount(relay: string, now?: number): Promise<boolean>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=relay-content-origin.d.ts.map
|