@celljs/ta-share 4.24.1 → 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 +1 -1
- package/README.md +1 -1
- package/extension/index.mjs +343 -0
- package/host/index.mjs +1502 -7
- package/package.json +6 -5
- package/web/index.js +1018 -23
package/web/index.js
CHANGED
|
@@ -96,10 +96,98 @@ var EN = {
|
|
|
96
96
|
selfOnly: "opens only in your own Ta",
|
|
97
97
|
qr: "QR code of the link",
|
|
98
98
|
linkReady: "Scan with the Ta app or a phone camera, or send the link. A browser shows it; the Ta app can import it.",
|
|
99
|
+
linkReadyFile: "Scan with the Ta app or a phone camera, or send the link. A browser shows it or downloads it.",
|
|
99
100
|
emptyTitle: "Nothing shared yet",
|
|
100
101
|
emptyHint: "Choose Share conversation… in the + of a message box, or ask Ta to make a link of a file.",
|
|
102
|
+
servicesTitle: "Services of this computer",
|
|
103
|
+
servicesSwitch: "Allow public links",
|
|
104
|
+
servicesHint: "Lets Ta open a web page or an API on a port of this computer to anyone with its link, for a while, asking you each time. Company networks usually forbid it.",
|
|
105
|
+
servicesNone: "Ask Ta to “make port 3000 public”: its link shows here.",
|
|
106
|
+
serviceLine: "localhost:{port} · until {time}",
|
|
107
|
+
serviceStop: "Stop",
|
|
108
|
+
serviceStopTitle: "Stop “{title}”?",
|
|
109
|
+
serviceStopHint: "Its link stops working at once.",
|
|
110
|
+
reportsTitle: "Reports",
|
|
111
|
+
reportsRowLine: "{n} waiting",
|
|
112
|
+
operatorHint: "With the token of the operator of the relay, the reports of shares show here, to look at, block or dismiss.",
|
|
113
|
+
operatorSet: "Enter the token",
|
|
114
|
+
operatorToken: "Token of the operator",
|
|
115
|
+
operatorForget: "Remove the token",
|
|
116
|
+
operatorError: "The relay did not answer: {error}",
|
|
117
|
+
reportsNone: "No report waiting",
|
|
118
|
+
reportView: "See it",
|
|
119
|
+
reportNoLink: "Sent without its link",
|
|
120
|
+
reportLine: "{count}× · {time}",
|
|
121
|
+
blockShare: "Block this link",
|
|
122
|
+
blockHost: "Block all of this computer",
|
|
123
|
+
dismiss: "Dismiss",
|
|
124
|
+
unblock: "Unblock",
|
|
125
|
+
blockedTitle: "Blocked",
|
|
126
|
+
blockedShare: "Link {id}",
|
|
127
|
+
blockedHost: "Computer {id}",
|
|
128
|
+
blockShareTitle: "Block this link?",
|
|
129
|
+
blockShareHint: "It stops working at once, and its copy on the relay is no longer given.",
|
|
130
|
+
blockHostTitle: "Block everything this computer shares?",
|
|
131
|
+
blockHostHint: "All its links stop working at once, until you unblock it.",
|
|
132
|
+
reasonPhishing: "Phishing or scam",
|
|
133
|
+
reasonMalware: "Virus or malware",
|
|
134
|
+
reasonSexual: "Sexual content",
|
|
135
|
+
reasonIllegal: "Illegal content",
|
|
136
|
+
reasonHarassment: "Harassment or infringement",
|
|
137
|
+
reasonOther: "Other",
|
|
138
|
+
waitingTitle: "Waiting",
|
|
139
|
+
fromAccount: "from {name}",
|
|
140
|
+
fromComputer: "a computer not signed in",
|
|
141
|
+
limitAccount: "Limit {days} days",
|
|
142
|
+
banAccount: "Ban",
|
|
143
|
+
banTitle: "Ban {name}?",
|
|
144
|
+
banHint: "What reaches others is taken away, as the rules below say, until you lift it. Their own devices still reach each other.",
|
|
145
|
+
limitTitle: "Limit {name} for {days} days?",
|
|
146
|
+
limitHint: "Their links do not open for others until then.",
|
|
147
|
+
appealFrom: "Appeal of {name}",
|
|
148
|
+
restore: "Restore",
|
|
149
|
+
keep: "Keep",
|
|
150
|
+
sanctionsTitle: "In force",
|
|
151
|
+
sanctionLimit: "Public links limited",
|
|
152
|
+
sanctionBan: "Banned",
|
|
153
|
+
sanctionUntil: "until {date}",
|
|
154
|
+
sanctionForever: "until lifted",
|
|
155
|
+
byRule: "by the rules",
|
|
156
|
+
byOperator: "by you",
|
|
157
|
+
lift: "Lift",
|
|
158
|
+
undo: "Undo",
|
|
159
|
+
autoMark: "Auto",
|
|
160
|
+
rulesTitle: "Rules",
|
|
161
|
+
rulesAuto: "Act by the rules",
|
|
162
|
+
rulesAutoHint: "They stop a link, and limit its owner at most; banning stays yours. What you undo they leave be.",
|
|
163
|
+
rulePeople: "People reporting a link",
|
|
164
|
+
ruleSevere: "For phishing or malware",
|
|
165
|
+
ruleHostAfter: "Links stopped, to limit their owner",
|
|
166
|
+
ruleLimitDays: "Days a limit lasts",
|
|
167
|
+
needsAccount: "Public links need an account",
|
|
168
|
+
needsAccountHint: "Links open in a browser only of one who signed in, so that a ban reaches the person.",
|
|
169
|
+
banCoversTitle: "A ban takes away",
|
|
170
|
+
featureShare: "Public links",
|
|
171
|
+
featureRooms: "Group chats",
|
|
172
|
+
featureMoments: "Moments",
|
|
173
|
+
featureNearby: "Nearby",
|
|
174
|
+
notYet: "needs sign-in there first",
|
|
175
|
+
logTitle: "Record",
|
|
176
|
+
logLine: "{who} · {action} · {target}",
|
|
177
|
+
whoRule: "Rules",
|
|
178
|
+
whoOperator: "You",
|
|
179
|
+
whoUser: "User",
|
|
180
|
+
standingLimit: "Your public links are limited {until}",
|
|
181
|
+
standingBan: "Your account is banned {until}",
|
|
182
|
+
standingBlocked: "{n} of your links were stopped by the operator of the relay",
|
|
183
|
+
standingWhy: "Why: {reason}",
|
|
184
|
+
appeal: "Appeal",
|
|
185
|
+
appealTitle: "Appeal to the operator",
|
|
186
|
+
appealHint: "Say in a few words why it should be lifted",
|
|
187
|
+
appealSent: "Appealed, waiting for an answer",
|
|
101
188
|
kindConversation: "Conversation",
|
|
102
189
|
kindFile: "File",
|
|
190
|
+
fileLarge: "Larger than {max} MB: too large to share by a link.",
|
|
103
191
|
open: "Open",
|
|
104
192
|
opening: "Opening…",
|
|
105
193
|
passwordTitle: "This share needs a password",
|
|
@@ -107,7 +195,7 @@ var EN = {
|
|
|
107
195
|
wrong: "That password is wrong.",
|
|
108
196
|
busy: "Too many wrong passwords. Try again in a few minutes.",
|
|
109
197
|
gone: "This link no longer works: the share was stopped or ran out.",
|
|
110
|
-
offlineHost: "The computer that shared it is not running Ta now. Try again
|
|
198
|
+
offlineHost: "The computer that shared it is not running Ta now. Try again once it is, or ask them to share it again with “Opens while this computer is off”.",
|
|
111
199
|
self: "Only the one who shared this opens it, in their own Ta.",
|
|
112
200
|
invalid: "This is not a whole link of Ta.",
|
|
113
201
|
failed: "Cannot open it: {message}",
|
|
@@ -192,10 +280,98 @@ var ZH = {
|
|
|
192
280
|
selfOnly: "只能在你自己的 Ta 里打开",
|
|
193
281
|
qr: "链接的二维码",
|
|
194
282
|
linkReady: "用 Ta 应用或手机相机扫码,或者把链接发给对方。浏览器里能直接看,Ta 应用里还能导入。",
|
|
283
|
+
linkReadyFile: "用 Ta 应用或手机相机扫码,或者把链接发给对方。浏览器里能直接看或下载。",
|
|
195
284
|
emptyTitle: "还没有分享",
|
|
196
285
|
emptyHint: "在输入框的 + 里选“分享对话…”,或者让 Ta 帮你把文件生成分享链接。",
|
|
286
|
+
servicesTitle: "本机服务",
|
|
287
|
+
servicesSwitch: "允许生成公开链接",
|
|
288
|
+
servicesHint: "让 Ta 把本机端口上的网页或接口临时公开给拿到链接的人,每次都会先问你。公司网络通常禁止这样做。",
|
|
289
|
+
servicesNone: "对 Ta 说“把 3000 端口公开出去”,链接会出现在这里。",
|
|
290
|
+
serviceLine: "localhost:{port} · {time} 前有效",
|
|
291
|
+
serviceStop: "停止公开",
|
|
292
|
+
serviceStopTitle: "停止公开“{title}”?",
|
|
293
|
+
serviceStopHint: "链接立即失效。",
|
|
294
|
+
reportsTitle: "举报处理",
|
|
295
|
+
reportsRowLine: "{n} 条待处理",
|
|
296
|
+
operatorHint: "填入中继的运营令牌后,这里会列出别人对分享的举报,可以查看、封禁或驳回。",
|
|
297
|
+
operatorSet: "填入运营令牌",
|
|
298
|
+
operatorToken: "运营令牌",
|
|
299
|
+
operatorForget: "移除运营令牌",
|
|
300
|
+
operatorError: "中继没有响应:{error}",
|
|
301
|
+
reportsNone: "没有待处理的举报",
|
|
302
|
+
reportView: "查看内容",
|
|
303
|
+
reportNoLink: "举报人没有附上链接",
|
|
304
|
+
reportLine: "{count} 次 · {time}",
|
|
305
|
+
blockShare: "封禁这条链接",
|
|
306
|
+
blockHost: "封禁这台电脑的全部分享",
|
|
307
|
+
dismiss: "驳回",
|
|
308
|
+
unblock: "解封",
|
|
309
|
+
blockedTitle: "已封禁",
|
|
310
|
+
blockedShare: "链接 {id}",
|
|
311
|
+
blockedHost: "电脑 {id}",
|
|
312
|
+
blockShareTitle: "封禁这条链接?",
|
|
313
|
+
blockShareHint: "链接立即失效,中继上的副本也不再提供。",
|
|
314
|
+
blockHostTitle: "封禁这台电脑分享的全部内容?",
|
|
315
|
+
blockHostHint: "它的所有分享链接立即失效,直到你解封。",
|
|
316
|
+
reasonPhishing: "钓鱼或诈骗",
|
|
317
|
+
reasonMalware: "病毒或恶意软件",
|
|
318
|
+
reasonSexual: "色情内容",
|
|
319
|
+
reasonIllegal: "违法内容",
|
|
320
|
+
reasonHarassment: "骚扰或侵权",
|
|
321
|
+
reasonOther: "其他",
|
|
322
|
+
waitingTitle: "待处理",
|
|
323
|
+
fromAccount: "来自 {name}",
|
|
324
|
+
fromComputer: "来自未登录的电脑",
|
|
325
|
+
limitAccount: "限制 {days} 天",
|
|
326
|
+
banAccount: "封号",
|
|
327
|
+
banTitle: "封禁 {name}?",
|
|
328
|
+
banHint: "按下方规则停用对外功能,直到你解封;他自己的设备之间照常互连。",
|
|
329
|
+
limitTitle: "限制 {name} {days} 天?",
|
|
330
|
+
limitHint: "在此之前,他的链接别人都打不开。",
|
|
331
|
+
appealFrom: "{name} 的申诉",
|
|
332
|
+
restore: "恢复",
|
|
333
|
+
keep: "维持",
|
|
334
|
+
sanctionsTitle: "处罚中",
|
|
335
|
+
sanctionLimit: "公开分享受限",
|
|
336
|
+
sanctionBan: "已封号",
|
|
337
|
+
sanctionUntil: "{date} 前",
|
|
338
|
+
sanctionForever: "直到解除",
|
|
339
|
+
byRule: "自动规则",
|
|
340
|
+
byOperator: "你",
|
|
341
|
+
lift: "解除",
|
|
342
|
+
undo: "撤销",
|
|
343
|
+
autoMark: "自动",
|
|
344
|
+
rulesTitle: "规则",
|
|
345
|
+
rulesAuto: "按规则自动处理",
|
|
346
|
+
rulesAutoHint: "最多停链接、限制公开分享,封号只能你来;你撤销过的不会再自动处理。",
|
|
347
|
+
rulePeople: "多少人举报就停这条链接",
|
|
348
|
+
ruleSevere: "钓鱼或恶意软件",
|
|
349
|
+
ruleHostAfter: "停了几条链接就限制发布者",
|
|
350
|
+
ruleLimitDays: "限制多少天",
|
|
351
|
+
needsAccount: "公开分享须登录账号",
|
|
352
|
+
needsAccountHint: "只有登录了账号的人发的链接,浏览器里才能打开,封号才能封到人。",
|
|
353
|
+
banCoversTitle: "封号后不能用",
|
|
354
|
+
featureShare: "公开分享",
|
|
355
|
+
featureRooms: "群聊",
|
|
356
|
+
featureMoments: "动态",
|
|
357
|
+
featureNearby: "附近",
|
|
358
|
+
notYet: "需要先让这项功能必须登录",
|
|
359
|
+
logTitle: "记录",
|
|
360
|
+
logLine: "{who} · {action} · {target}",
|
|
361
|
+
whoRule: "规则",
|
|
362
|
+
whoOperator: "你",
|
|
363
|
+
whoUser: "用户",
|
|
364
|
+
standingLimit: "你的公开分享已被限制{until}",
|
|
365
|
+
standingBan: "你的账号已被封禁{until}",
|
|
366
|
+
standingBlocked: "你有 {n} 条链接被中继运营方停止",
|
|
367
|
+
standingWhy: "原因:{reason}",
|
|
368
|
+
appeal: "申诉",
|
|
369
|
+
appealTitle: "向运营方申诉",
|
|
370
|
+
appealHint: "用一句话说明为什么应该恢复",
|
|
371
|
+
appealSent: "已申诉,等待处理",
|
|
197
372
|
kindConversation: "对话",
|
|
198
373
|
kindFile: "文件",
|
|
374
|
+
fileLarge: "超过 {max} MB,太大了,不能用链接分享",
|
|
199
375
|
open: "打开",
|
|
200
376
|
opening: "正在打开…",
|
|
201
377
|
passwordTitle: "这个分享需要口令",
|
|
@@ -203,7 +379,7 @@ var ZH = {
|
|
|
203
379
|
wrong: "口令不对。",
|
|
204
380
|
busy: "口令错得太多了,请过几分钟再试。",
|
|
205
381
|
gone: "这个链接已经失效:分享已停止或已过期。",
|
|
206
|
-
offlineHost: "分享的人的电脑现在没有运行 Ta
|
|
382
|
+
offlineHost: "分享的人的电脑现在没有运行 Ta:请对方打开 Ta 后再试,或重新分享并勾选“电脑关机也能打开”。",
|
|
207
383
|
self: "这是仅自己可见的分享,只有分享的人能在自己的 Ta 里打开。",
|
|
208
384
|
invalid: "这不是一个完整的 Ta 分享链接。",
|
|
209
385
|
failed: "打不开:{message}",
|
|
@@ -288,10 +464,98 @@ var ZH_TW = {
|
|
|
288
464
|
selfOnly: "只能在你自己的 Ta 裡開啟",
|
|
289
465
|
qr: "連結的QR 碼",
|
|
290
466
|
linkReady: "用 Ta 應用或手機相機掃碼,或者把連結發給對方。瀏覽器裡能直接看,Ta 應用裡還能匯入。",
|
|
467
|
+
linkReadyFile: "用 Ta 應用或手機相機掃碼,或者把連結發給對方。瀏覽器裡能直接看或下載。",
|
|
291
468
|
emptyTitle: "還沒有分享",
|
|
292
469
|
emptyHint: "在輸入框的 + 裡選「分享對話…」,或者讓 Ta 幫你把檔案生成分享連結。",
|
|
470
|
+
servicesTitle: "本機服務",
|
|
471
|
+
servicesSwitch: "允許產生公開連結",
|
|
472
|
+
servicesHint: "讓 Ta 把本機連接埠上的網頁或介面暫時公開給拿到連結的人,每次都會先問你。公司網路通常禁止這樣做。",
|
|
473
|
+
servicesNone: "對 Ta 說「把 3000 連接埠公開出去」,連結會出現在這裡。",
|
|
474
|
+
serviceLine: "localhost:{port} · {time} 前有效",
|
|
475
|
+
serviceStop: "停止公開",
|
|
476
|
+
serviceStopTitle: "停止公開「{title}」?",
|
|
477
|
+
serviceStopHint: "連結立即失效。",
|
|
478
|
+
reportsTitle: "檢舉處理",
|
|
479
|
+
reportsRowLine: "{n} 則待處理",
|
|
480
|
+
operatorHint: "填入中繼的營運權杖後,這裡會列出別人對分享的檢舉,可以檢視、封鎖或駁回。",
|
|
481
|
+
operatorSet: "填入營運權杖",
|
|
482
|
+
operatorToken: "營運權杖",
|
|
483
|
+
operatorForget: "移除營運權杖",
|
|
484
|
+
operatorError: "中繼沒有回應:{error}",
|
|
485
|
+
reportsNone: "沒有待處理的檢舉",
|
|
486
|
+
reportView: "檢視內容",
|
|
487
|
+
reportNoLink: "檢舉人沒有附上連結",
|
|
488
|
+
reportLine: "{count} 次 · {time}",
|
|
489
|
+
blockShare: "封鎖這條連結",
|
|
490
|
+
blockHost: "封鎖這台電腦的全部分享",
|
|
491
|
+
dismiss: "駁回",
|
|
492
|
+
unblock: "解除封鎖",
|
|
493
|
+
blockedTitle: "已封鎖",
|
|
494
|
+
blockedShare: "連結 {id}",
|
|
495
|
+
blockedHost: "電腦 {id}",
|
|
496
|
+
blockShareTitle: "封鎖這條連結?",
|
|
497
|
+
blockShareHint: "連結立即失效,中繼上的副本也不再提供。",
|
|
498
|
+
blockHostTitle: "封鎖這台電腦分享的全部內容?",
|
|
499
|
+
blockHostHint: "它的所有分享連結立即失效,直到你解除封鎖。",
|
|
500
|
+
reasonPhishing: "釣魚或詐騙",
|
|
501
|
+
reasonMalware: "病毒或惡意軟體",
|
|
502
|
+
reasonSexual: "色情內容",
|
|
503
|
+
reasonIllegal: "違法內容",
|
|
504
|
+
reasonHarassment: "騷擾或侵權",
|
|
505
|
+
reasonOther: "其他",
|
|
506
|
+
waitingTitle: "待處理",
|
|
507
|
+
fromAccount: "來自 {name}",
|
|
508
|
+
fromComputer: "來自未登入的電腦",
|
|
509
|
+
limitAccount: "限制 {days} 天",
|
|
510
|
+
banAccount: "封號",
|
|
511
|
+
banTitle: "封鎖 {name}?",
|
|
512
|
+
banHint: "依下方規則停用對外功能,直到你解除;他自己的裝置之間照常互連。",
|
|
513
|
+
limitTitle: "限制 {name} {days} 天?",
|
|
514
|
+
limitHint: "在此之前,他的連結別人都打不開。",
|
|
515
|
+
appealFrom: "{name} 的申訴",
|
|
516
|
+
restore: "恢復",
|
|
517
|
+
keep: "維持",
|
|
518
|
+
sanctionsTitle: "處罰中",
|
|
519
|
+
sanctionLimit: "公開分享受限",
|
|
520
|
+
sanctionBan: "已封號",
|
|
521
|
+
sanctionUntil: "{date} 前",
|
|
522
|
+
sanctionForever: "直到解除",
|
|
523
|
+
byRule: "自動規則",
|
|
524
|
+
byOperator: "你",
|
|
525
|
+
lift: "解除",
|
|
526
|
+
undo: "撤銷",
|
|
527
|
+
autoMark: "自動",
|
|
528
|
+
rulesTitle: "規則",
|
|
529
|
+
rulesAuto: "依規則自動處理",
|
|
530
|
+
rulesAutoHint: "最多停連結、限制公開分享,封號只能你來;你撤銷過的不會再自動處理。",
|
|
531
|
+
rulePeople: "多少人檢舉就停這條連結",
|
|
532
|
+
ruleSevere: "釣魚或惡意軟體",
|
|
533
|
+
ruleHostAfter: "停了幾條連結就限制發布者",
|
|
534
|
+
ruleLimitDays: "限制多少天",
|
|
535
|
+
needsAccount: "公開分享須登入帳號",
|
|
536
|
+
needsAccountHint: "只有登入了帳號的人發的連結,瀏覽器裡才能開啟,封號才能封到人。",
|
|
537
|
+
banCoversTitle: "封號後不能用",
|
|
538
|
+
featureShare: "公開分享",
|
|
539
|
+
featureRooms: "群聊",
|
|
540
|
+
featureMoments: "動態",
|
|
541
|
+
featureNearby: "附近",
|
|
542
|
+
notYet: "需要先讓這項功能必須登入",
|
|
543
|
+
logTitle: "記錄",
|
|
544
|
+
logLine: "{who} · {action} · {target}",
|
|
545
|
+
whoRule: "規則",
|
|
546
|
+
whoOperator: "你",
|
|
547
|
+
whoUser: "使用者",
|
|
548
|
+
standingLimit: "你的公開分享已被限制{until}",
|
|
549
|
+
standingBan: "你的帳號已被封鎖{until}",
|
|
550
|
+
standingBlocked: "你有 {n} 條連結被中繼營運方停止",
|
|
551
|
+
standingWhy: "原因:{reason}",
|
|
552
|
+
appeal: "申訴",
|
|
553
|
+
appealTitle: "向營運方申訴",
|
|
554
|
+
appealHint: "用一句話說明為什麼應該恢復",
|
|
555
|
+
appealSent: "已申訴,等待處理",
|
|
293
556
|
kindConversation: "對話",
|
|
294
557
|
kindFile: "檔案",
|
|
558
|
+
fileLarge: "超過 {max} MB,太大了,不能用連結分享",
|
|
295
559
|
open: "開啟",
|
|
296
560
|
opening: "正在開啟…",
|
|
297
561
|
passwordTitle: "這個分享需要口令",
|
|
@@ -299,7 +563,7 @@ var ZH_TW = {
|
|
|
299
563
|
wrong: "口令不對。",
|
|
300
564
|
busy: "口令錯得太多了,請過幾分鐘再試。",
|
|
301
565
|
gone: "這個連結已經失效:分享已停止或已過期。",
|
|
302
|
-
offlineHost: "分享的人的電腦現在沒有執行 Ta
|
|
566
|
+
offlineHost: "分享的人的電腦現在沒有執行 Ta:請對方開啟 Ta 後再試,或重新分享並勾選「電腦關機也能開啟」。",
|
|
303
567
|
self: "這是僅自己可見的分享,只有分享的人能在自己的 Ta 裡開啟。",
|
|
304
568
|
invalid: "這不是一個完整的 Ta 分享連結。",
|
|
305
569
|
failed: "打不開:{message}",
|
|
@@ -383,11 +647,99 @@ var JA = {
|
|
|
383
647
|
offlineToo: "コンピューターがオフの場合でも開く",
|
|
384
648
|
selfOnly: "自身の Ta でのみ開く",
|
|
385
649
|
qr: "リンクの QR コード",
|
|
650
|
+
linkReadyFile: "Ta アプリやスマホのカメラで読み取るか、リンクを送ってください。ブラウザで表示またはダウンロードできます。",
|
|
386
651
|
linkReady: "Ta アプリまたはスマートフォンのカメラで QR コードをスキャンするか、リンクを送信してください。ブラウザで直接表示でき、Ta アプリにインポートできます。",
|
|
387
652
|
emptyTitle: "まだ共有がありません",
|
|
388
653
|
emptyHint: "入力欄の「+」から「会話を共有…」を選択するか、Ta にファイルの共有リンクを作成させてください。",
|
|
654
|
+
servicesTitle: "このコンピュータのサービス",
|
|
655
|
+
servicesSwitch: "公開リンクを許可",
|
|
656
|
+
servicesHint: "このコンピュータのポートで動く Web ページや API を、リンクを持つ人にしばらく公開できます。毎回確認します。会社のネットワークでは通常禁止されています。",
|
|
657
|
+
servicesNone: "Ta に「3000 番ポートを公開して」と頼むと、リンクがここに表示されます。",
|
|
658
|
+
serviceLine: "localhost:{port} · {time} まで",
|
|
659
|
+
serviceStop: "公開を停止",
|
|
660
|
+
serviceStopTitle: "「{title}」の公開を停止しますか?",
|
|
661
|
+
serviceStopHint: "リンクはすぐに使えなくなります。",
|
|
662
|
+
reportsTitle: "報告の対応",
|
|
663
|
+
reportsRowLine: "{n} 件が未対応",
|
|
664
|
+
operatorHint: "リレーの運営トークンを入れると、共有への報告がここに並び、確認・ブロック・却下ができます。",
|
|
665
|
+
operatorSet: "トークンを入力",
|
|
666
|
+
operatorToken: "運営トークン",
|
|
667
|
+
operatorForget: "トークンを削除",
|
|
668
|
+
operatorError: "リレーが応答しません:{error}",
|
|
669
|
+
reportsNone: "未対応の報告はありません",
|
|
670
|
+
reportView: "内容を見る",
|
|
671
|
+
reportNoLink: "リンクは添付されていません",
|
|
672
|
+
reportLine: "{count} 回 · {time}",
|
|
673
|
+
blockShare: "このリンクをブロック",
|
|
674
|
+
blockHost: "このコンピュータの共有をすべてブロック",
|
|
675
|
+
dismiss: "却下",
|
|
676
|
+
unblock: "ブロック解除",
|
|
677
|
+
blockedTitle: "ブロック中",
|
|
678
|
+
blockedShare: "リンク {id}",
|
|
679
|
+
blockedHost: "コンピュータ {id}",
|
|
680
|
+
blockShareTitle: "このリンクをブロックしますか?",
|
|
681
|
+
blockShareHint: "リンクはすぐに使えなくなり、リレー上のコピーも提供されなくなります。",
|
|
682
|
+
blockHostTitle: "このコンピュータの共有をすべてブロックしますか?",
|
|
683
|
+
blockHostHint: "すべての共有リンクがすぐに使えなくなります。解除するまで続きます。",
|
|
684
|
+
reasonPhishing: "フィッシング・詐欺",
|
|
685
|
+
reasonMalware: "ウイルス・マルウェア",
|
|
686
|
+
reasonSexual: "性的なコンテンツ",
|
|
687
|
+
reasonIllegal: "違法なコンテンツ",
|
|
688
|
+
reasonHarassment: "嫌がらせ・権利侵害",
|
|
689
|
+
reasonOther: "その他",
|
|
690
|
+
waitingTitle: "未対応",
|
|
691
|
+
fromAccount: "{name} から",
|
|
692
|
+
fromComputer: "サインインしていないコンピュータから",
|
|
693
|
+
limitAccount: "{days} 日制限",
|
|
694
|
+
banAccount: "アカウント停止",
|
|
695
|
+
banTitle: "{name} を停止しますか?",
|
|
696
|
+
banHint: "下のルールのとおり外向きの機能を止めます。解除するまで続きます。本人の端末同士は今までどおりつながります。",
|
|
697
|
+
limitTitle: "{name} を {days} 日制限しますか?",
|
|
698
|
+
limitHint: "それまで、その人のリンクは他の人が開けません。",
|
|
699
|
+
appealFrom: "{name} の異議",
|
|
700
|
+
restore: "元に戻す",
|
|
701
|
+
keep: "維持",
|
|
702
|
+
sanctionsTitle: "措置中",
|
|
703
|
+
sanctionLimit: "公開共有を制限中",
|
|
704
|
+
sanctionBan: "停止中",
|
|
705
|
+
sanctionUntil: "{date} まで",
|
|
706
|
+
sanctionForever: "解除するまで",
|
|
707
|
+
byRule: "自動ルール",
|
|
708
|
+
byOperator: "あなた",
|
|
709
|
+
lift: "解除",
|
|
710
|
+
undo: "取り消す",
|
|
711
|
+
autoMark: "自動",
|
|
712
|
+
rulesTitle: "ルール",
|
|
713
|
+
rulesAuto: "ルールで自動対応",
|
|
714
|
+
rulesAutoHint: "できるのはリンクの停止と公開共有の制限までで、アカウント停止はあなただけです。取り消したものは再び自動対応しません。",
|
|
715
|
+
rulePeople: "何人が報告したらリンクを止めるか",
|
|
716
|
+
ruleSevere: "フィッシング・マルウェア",
|
|
717
|
+
ruleHostAfter: "何件止めたら投稿者を制限するか",
|
|
718
|
+
ruleLimitDays: "制限する日数",
|
|
719
|
+
needsAccount: "公開共有にはアカウントが必要",
|
|
720
|
+
needsAccountHint: "サインインした人のリンクだけがブラウザで開くので、停止が本人に届きます。",
|
|
721
|
+
banCoversTitle: "停止すると使えないもの",
|
|
722
|
+
featureShare: "公開共有",
|
|
723
|
+
featureRooms: "グループチャット",
|
|
724
|
+
featureMoments: "モーメンツ",
|
|
725
|
+
featureNearby: "近く",
|
|
726
|
+
notYet: "まずこの機能をサインイン必須にする必要があります",
|
|
727
|
+
logTitle: "記録",
|
|
728
|
+
logLine: "{who} · {action} · {target}",
|
|
729
|
+
whoRule: "ルール",
|
|
730
|
+
whoOperator: "あなた",
|
|
731
|
+
whoUser: "ユーザー",
|
|
732
|
+
standingLimit: "あなたの公開共有は制限されています{until}",
|
|
733
|
+
standingBan: "あなたのアカウントは停止されています{until}",
|
|
734
|
+
standingBlocked: "あなたのリンク {n} 件がリレーの運営者により停止されました",
|
|
735
|
+
standingWhy: "理由:{reason}",
|
|
736
|
+
appeal: "異議を申し立てる",
|
|
737
|
+
appealTitle: "運営者に異議を申し立てる",
|
|
738
|
+
appealHint: "元に戻すべき理由をひとことで",
|
|
739
|
+
appealSent: "申し立て済み、対応待ち",
|
|
389
740
|
kindConversation: "会話",
|
|
390
741
|
kindFile: "ファイル",
|
|
742
|
+
fileLarge: "{max} MB を超えるため、リンクで共有できません",
|
|
391
743
|
open: "開く",
|
|
392
744
|
opening: "開いています…",
|
|
393
745
|
passwordTitle: "この共有にはパスワードが必要です",
|
|
@@ -395,7 +747,7 @@ var JA = {
|
|
|
395
747
|
wrong: "パスワードが正しくありません。",
|
|
396
748
|
busy: "パスワードの入力が多すぎました。数分後に再度お試しください。",
|
|
397
749
|
gone: "このリンクは無効です。共有が停止されたか、期限切れです。",
|
|
398
|
-
offlineHost: "共有したコンピューターは現在 Ta
|
|
750
|
+
offlineHost: "共有したコンピューターは現在 Ta を実行していません。相手に Ta を開いてもらってから再度お試しいただくか、「コンピューターがオフの場合でも開く」を選んで共有し直してもらってください。",
|
|
399
751
|
self: "これは自分のみが見える共有です。共有した人だけが自身の Ta で開くことができます。",
|
|
400
752
|
invalid: "これは完全な Ta 共有リンクではありません。",
|
|
401
753
|
failed: "開くことができません。{message}",
|
|
@@ -467,6 +819,14 @@ var Host = {
|
|
|
467
819
|
shareFile: (title, type, data, options) => pi.callHost("shareFile", title, type, data, options),
|
|
468
820
|
list: () => pi.callHost("list"),
|
|
469
821
|
remove: (id) => pi.callHost("remove", id),
|
|
822
|
+
tunnelState: () => pi.callHost("tunnelState"),
|
|
823
|
+
setTunnelsEnabled: (enabled) => pi.callHost("setTunnelsEnabled", enabled),
|
|
824
|
+
stopTunnel: (id) => pi.callHost("stopTunnel", id),
|
|
825
|
+
operatorState: () => pi.callHost("operatorState"),
|
|
826
|
+
setOperatorToken: (token) => pi.callHost("setOperatorToken", token),
|
|
827
|
+
moderate: (action) => pi.callHost("moderate", action),
|
|
828
|
+
standing: () => pi.callHost("standing"),
|
|
829
|
+
appeal: (text) => pi.callHost("appeal", text),
|
|
470
830
|
open: (link, password) => pi.callHost("open", link, password),
|
|
471
831
|
importConversation: (link, password, cwd) => pi.callHost("importConversation", link, password, cwd)
|
|
472
832
|
};
|
|
@@ -517,6 +877,423 @@ function shareLine(share) {
|
|
|
517
877
|
return [access, until, where].join(" · ");
|
|
518
878
|
}
|
|
519
879
|
|
|
880
|
+
// ../ta-relay/esm/common/relay-moderation-policy.js
|
|
881
|
+
var RELAY_OUTWARD_FEATURES = ["share", "rooms", "moments", "nearby"];
|
|
882
|
+
var RELAY_ENFORCED_FEATURES = ["share"];
|
|
883
|
+
var RELAY_MODERATION_POLICY = {
|
|
884
|
+
auto: false,
|
|
885
|
+
people: 3,
|
|
886
|
+
severe: 2,
|
|
887
|
+
hostAfter: 3,
|
|
888
|
+
limitDays: 7,
|
|
889
|
+
needsAccount: [],
|
|
890
|
+
banCovers: ["share", "rooms", "moments", "nearby"]
|
|
891
|
+
};
|
|
892
|
+
var RelayModerationPolicyUtil;
|
|
893
|
+
(function(RelayModerationPolicyUtil2) {
|
|
894
|
+
function count(value, fallback, min, max = 100) {
|
|
895
|
+
const n = Math.round(Number(value));
|
|
896
|
+
return Number.isFinite(n) && n >= min ? Math.min(n, max) : fallback;
|
|
897
|
+
}
|
|
898
|
+
function features(value, fallback) {
|
|
899
|
+
return Array.isArray(value) ? RELAY_OUTWARD_FEATURES.filter((feature) => value.includes(feature)) : fallback;
|
|
900
|
+
}
|
|
901
|
+
function of(given) {
|
|
902
|
+
const base = RELAY_MODERATION_POLICY;
|
|
903
|
+
return {
|
|
904
|
+
auto: (given === null || given === undefined ? undefined : given.auto) === true,
|
|
905
|
+
people: count(given === null || given === undefined ? undefined : given.people, base.people, 1),
|
|
906
|
+
severe: count(given === null || given === undefined ? undefined : given.severe, base.severe, 1),
|
|
907
|
+
hostAfter: count(given === null || given === undefined ? undefined : given.hostAfter, base.hostAfter, 0),
|
|
908
|
+
limitDays: count(given === null || given === undefined ? undefined : given.limitDays, base.limitDays, 1, 30),
|
|
909
|
+
needsAccount: features(given === null || given === undefined ? undefined : given.needsAccount, base.needsAccount),
|
|
910
|
+
banCovers: features(given === null || given === undefined ? undefined : given.banCovers, base.banCovers)
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
RelayModerationPolicyUtil2.of = of;
|
|
914
|
+
function active(sanction, now) {
|
|
915
|
+
return !!sanction && (sanction.until === undefined || sanction.until > now);
|
|
916
|
+
}
|
|
917
|
+
RelayModerationPolicyUtil2.active = active;
|
|
918
|
+
function takes(sanction, feature, policy, now) {
|
|
919
|
+
if (!active(sanction, now)) {
|
|
920
|
+
return false;
|
|
921
|
+
}
|
|
922
|
+
return sanction.level === "limit" ? feature === "share" : policy.banCovers.includes(feature);
|
|
923
|
+
}
|
|
924
|
+
RelayModerationPolicyUtil2.takes = takes;
|
|
925
|
+
})(RelayModerationPolicyUtil || (RelayModerationPolicyUtil = {}));
|
|
926
|
+
|
|
927
|
+
// web-src/moderation-rules.tsx
|
|
928
|
+
var FEATURES = { share: "featureShare", rooms: "featureRooms", moments: "featureMoments", nearby: "featureNearby" };
|
|
929
|
+
function Stepper({ label, value, min, max, onChange }) {
|
|
930
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
931
|
+
className: "tsh-rule"
|
|
932
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
933
|
+
className: "tsh-rule-label"
|
|
934
|
+
}, label), /* @__PURE__ */ React.createElement("span", {
|
|
935
|
+
className: "tsh-stepper"
|
|
936
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
937
|
+
type: "button",
|
|
938
|
+
className: "tsh-icon",
|
|
939
|
+
"aria-label": "−",
|
|
940
|
+
disabled: value <= min,
|
|
941
|
+
onClick: () => onChange(value - 1)
|
|
942
|
+
}, "−"), /* @__PURE__ */ React.createElement("span", {
|
|
943
|
+
className: "tsh-stepper-value"
|
|
944
|
+
}, value), /* @__PURE__ */ React.createElement("button", {
|
|
945
|
+
type: "button",
|
|
946
|
+
className: "tsh-icon",
|
|
947
|
+
"aria-label": "+",
|
|
948
|
+
disabled: value >= max,
|
|
949
|
+
onClick: () => onChange(value + 1)
|
|
950
|
+
}, "+")));
|
|
951
|
+
}
|
|
952
|
+
function Toggle({ label, hint, checked, onChange }) {
|
|
953
|
+
const Switch = pi.ui.Switch;
|
|
954
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
955
|
+
className: "tsh-rule"
|
|
956
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
957
|
+
className: "tsh-rule-text"
|
|
958
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
959
|
+
className: "tsh-rule-label"
|
|
960
|
+
}, label), hint && /* @__PURE__ */ React.createElement("span", {
|
|
961
|
+
className: "tsh-row-line tsh-wrap"
|
|
962
|
+
}, hint)), Switch && /* @__PURE__ */ React.createElement(Switch, {
|
|
963
|
+
checked,
|
|
964
|
+
label,
|
|
965
|
+
onChange
|
|
966
|
+
}));
|
|
967
|
+
}
|
|
968
|
+
function ModerationRules({ policy, change }) {
|
|
969
|
+
const covers = (feature, on) => change({ banCovers: on ? [...policy.banCovers, feature] : policy.banCovers.filter((each) => each !== feature) });
|
|
970
|
+
return /* @__PURE__ */ React.createElement("section", {
|
|
971
|
+
className: "tsh-rules"
|
|
972
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
973
|
+
className: "tsh-section"
|
|
974
|
+
}, t("rulesTitle")), /* @__PURE__ */ React.createElement(Toggle, {
|
|
975
|
+
label: t("rulesAuto"),
|
|
976
|
+
hint: t("rulesAutoHint"),
|
|
977
|
+
checked: policy.auto,
|
|
978
|
+
onChange: (auto) => change({ auto })
|
|
979
|
+
}), policy.auto && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stepper, {
|
|
980
|
+
label: t("rulePeople"),
|
|
981
|
+
value: policy.people,
|
|
982
|
+
min: 1,
|
|
983
|
+
max: 100,
|
|
984
|
+
onChange: (people) => void change({ people })
|
|
985
|
+
}), /* @__PURE__ */ React.createElement(Stepper, {
|
|
986
|
+
label: t("ruleSevere"),
|
|
987
|
+
value: policy.severe,
|
|
988
|
+
min: 1,
|
|
989
|
+
max: 100,
|
|
990
|
+
onChange: (severe) => void change({ severe })
|
|
991
|
+
}), /* @__PURE__ */ React.createElement(Stepper, {
|
|
992
|
+
label: t("ruleHostAfter"),
|
|
993
|
+
value: policy.hostAfter,
|
|
994
|
+
min: 0,
|
|
995
|
+
max: 100,
|
|
996
|
+
onChange: (hostAfter) => void change({ hostAfter })
|
|
997
|
+
}), /* @__PURE__ */ React.createElement(Stepper, {
|
|
998
|
+
label: t("ruleLimitDays"),
|
|
999
|
+
value: policy.limitDays,
|
|
1000
|
+
min: 1,
|
|
1001
|
+
max: 30,
|
|
1002
|
+
onChange: (limitDays) => void change({ limitDays })
|
|
1003
|
+
})), /* @__PURE__ */ React.createElement(Toggle, {
|
|
1004
|
+
label: t("needsAccount"),
|
|
1005
|
+
hint: t("needsAccountHint"),
|
|
1006
|
+
checked: policy.needsAccount.includes("share"),
|
|
1007
|
+
onChange: (on) => change({ needsAccount: on ? [...policy.needsAccount, "share"] : policy.needsAccount.filter((each) => each !== "share") })
|
|
1008
|
+
}), /* @__PURE__ */ React.createElement("h3", {
|
|
1009
|
+
className: "tsh-section"
|
|
1010
|
+
}, t("banCoversTitle")), RELAY_OUTWARD_FEATURES.map((feature) => /* @__PURE__ */ React.createElement(Toggle, {
|
|
1011
|
+
key: feature,
|
|
1012
|
+
label: t(FEATURES[feature]),
|
|
1013
|
+
hint: RELAY_ENFORCED_FEATURES.includes(feature) ? undefined : t("notYet"),
|
|
1014
|
+
checked: policy.banCovers.includes(feature),
|
|
1015
|
+
onChange: (on) => covers(feature, on)
|
|
1016
|
+
})));
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// web-src/reports-page.tsx
|
|
1020
|
+
var REASONS = {
|
|
1021
|
+
phishing: "reasonPhishing",
|
|
1022
|
+
malware: "reasonMalware",
|
|
1023
|
+
sexual: "reasonSexual",
|
|
1024
|
+
illegal: "reasonIllegal",
|
|
1025
|
+
harassment: "reasonHarassment",
|
|
1026
|
+
other: "reasonOther"
|
|
1027
|
+
};
|
|
1028
|
+
function useOperator() {
|
|
1029
|
+
const [state, setState] = React.useState();
|
|
1030
|
+
React.useEffect(() => {
|
|
1031
|
+
let live = true;
|
|
1032
|
+
const read = () => void Host.operatorState().then((next) => live && setState(next), () => {
|
|
1033
|
+
return;
|
|
1034
|
+
});
|
|
1035
|
+
read();
|
|
1036
|
+
const timer = setInterval(read, 60000);
|
|
1037
|
+
return () => {
|
|
1038
|
+
live = false;
|
|
1039
|
+
clearInterval(timer);
|
|
1040
|
+
};
|
|
1041
|
+
}, []);
|
|
1042
|
+
return [state, setState];
|
|
1043
|
+
}
|
|
1044
|
+
function waiting(state) {
|
|
1045
|
+
const blocks = state?.blocks ?? { hosts: [], shares: [] };
|
|
1046
|
+
const sanctioned = new Set(Object.keys(state?.sanctions ?? {}));
|
|
1047
|
+
return (state?.reports ?? []).filter((report) => !blocks.shares.includes(report.share) && !blocks.hosts.includes(report.host) && !sanctioned.has(state?.owners?.[report.host]?.account ?? ""));
|
|
1048
|
+
}
|
|
1049
|
+
var short = (id) => id.slice(0, 6);
|
|
1050
|
+
function ReportRow({ report, state, act }) {
|
|
1051
|
+
const Mark = icon("Shield");
|
|
1052
|
+
const time = new Date(report.last).toLocaleString(pi.ui.language, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
1053
|
+
const owner = state.owners?.[report.host];
|
|
1054
|
+
const days = state.policy?.limitDays ?? 7;
|
|
1055
|
+
const name = owner?.name ?? short(owner?.account ?? "");
|
|
1056
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
1057
|
+
className: "tsh-report"
|
|
1058
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1059
|
+
className: "tsh-report-head"
|
|
1060
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1061
|
+
className: "tsh-tile tsh-tile-report",
|
|
1062
|
+
"aria-hidden": "true"
|
|
1063
|
+
}, /* @__PURE__ */ React.createElement(Mark, {
|
|
1064
|
+
size: 18
|
|
1065
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1066
|
+
className: "tsh-row-text"
|
|
1067
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1068
|
+
className: "tsh-row-title"
|
|
1069
|
+
}, t(REASONS[report.reason] ?? "reasonOther")), /* @__PURE__ */ React.createElement("span", {
|
|
1070
|
+
className: "tsh-row-line"
|
|
1071
|
+
}, t("reportLine", { count: report.count, time }), " · ", owner ? t("fromAccount", { name }) : t("fromComputer")))), report.note && /* @__PURE__ */ React.createElement("p", {
|
|
1072
|
+
className: "tsh-report-note"
|
|
1073
|
+
}, report.note), /* @__PURE__ */ React.createElement("div", {
|
|
1074
|
+
className: "tsh-report-actions"
|
|
1075
|
+
}, report.link ? /* @__PURE__ */ React.createElement("button", {
|
|
1076
|
+
type: "button",
|
|
1077
|
+
className: "ta-button",
|
|
1078
|
+
onClick: () => void pi.openLink?.(report.link)
|
|
1079
|
+
}, t("reportView")) : /* @__PURE__ */ React.createElement("span", {
|
|
1080
|
+
className: "tsh-row-line"
|
|
1081
|
+
}, t("reportNoLink")), /* @__PURE__ */ React.createElement("span", {
|
|
1082
|
+
className: "tsh-grow"
|
|
1083
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
1084
|
+
type: "button",
|
|
1085
|
+
className: "ta-button",
|
|
1086
|
+
onClick: () => act(() => Host.moderate({ action: "dismiss", share: report.share }))
|
|
1087
|
+
}, t("dismiss")), /* @__PURE__ */ React.createElement("button", {
|
|
1088
|
+
type: "button",
|
|
1089
|
+
className: "ta-button tsh-danger",
|
|
1090
|
+
onClick: () => act(() => Host.moderate({ action: "block", share: report.share }), [t("blockShareTitle"), t("blockShareHint")])
|
|
1091
|
+
}, t("blockShare")), owner ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
|
|
1092
|
+
type: "button",
|
|
1093
|
+
className: "ta-button tsh-danger",
|
|
1094
|
+
onClick: () => act(() => Host.moderate({ action: "limit", account: owner.account, days, reason: t(REASONS[report.reason] ?? "reasonOther") }), [t("limitTitle", { name, days }), t("limitHint")])
|
|
1095
|
+
}, t("limitAccount", { days })), /* @__PURE__ */ React.createElement("button", {
|
|
1096
|
+
type: "button",
|
|
1097
|
+
className: "ta-button tsh-danger",
|
|
1098
|
+
onClick: () => act(() => Host.moderate({ action: "ban", account: owner.account, reason: t(REASONS[report.reason] ?? "reasonOther") }), [t("banTitle", { name }), t("banHint")])
|
|
1099
|
+
}, t("banAccount"))) : /* @__PURE__ */ React.createElement("button", {
|
|
1100
|
+
type: "button",
|
|
1101
|
+
className: "ta-button tsh-danger",
|
|
1102
|
+
onClick: () => act(() => Host.moderate({ action: "block", host: report.host }), [t("blockHostTitle"), t("blockHostHint")])
|
|
1103
|
+
}, t("blockHost"))));
|
|
1104
|
+
}
|
|
1105
|
+
function AppealRow({ appeal, act }) {
|
|
1106
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
1107
|
+
className: "tsh-report"
|
|
1108
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1109
|
+
className: "tsh-row-title"
|
|
1110
|
+
}, t("appealFrom", { name: appeal.name ?? short(appeal.account) })), /* @__PURE__ */ React.createElement("p", {
|
|
1111
|
+
className: "tsh-report-note tsh-flush"
|
|
1112
|
+
}, appeal.text), /* @__PURE__ */ React.createElement("div", {
|
|
1113
|
+
className: "tsh-report-actions tsh-flush"
|
|
1114
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1115
|
+
className: "tsh-grow"
|
|
1116
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
className: "ta-button",
|
|
1119
|
+
onClick: () => act(() => Host.moderate({ action: "answer", account: appeal.account, restore: false }))
|
|
1120
|
+
}, t("keep")), /* @__PURE__ */ React.createElement("button", {
|
|
1121
|
+
type: "button",
|
|
1122
|
+
className: "ta-button ta-primary",
|
|
1123
|
+
onClick: () => act(() => Host.moderate({ action: "answer", account: appeal.account, restore: true }))
|
|
1124
|
+
}, t("restore"))));
|
|
1125
|
+
}
|
|
1126
|
+
function InForce({ state, act }) {
|
|
1127
|
+
const blocks = state.blocks ?? { hosts: [], shares: [] };
|
|
1128
|
+
const sanctions = Object.values(state.sanctions ?? {});
|
|
1129
|
+
const items = [
|
|
1130
|
+
...sanctions.map((sanction) => ({
|
|
1131
|
+
key: `account:${sanction.account}`,
|
|
1132
|
+
line: `${sanction.name ?? short(sanction.account)} · ${t(sanction.level === "ban" ? "sanctionBan" : "sanctionLimit")} · ${sanction.until ? t("sanctionUntil", { date: date(sanction.until) }) : t("sanctionForever")}`,
|
|
1133
|
+
auto: sanction.by === "rule",
|
|
1134
|
+
lift: () => Host.moderate({ action: "lift", account: sanction.account })
|
|
1135
|
+
})),
|
|
1136
|
+
...blocks.hosts.map((id) => ({
|
|
1137
|
+
key: `host:${id}`,
|
|
1138
|
+
line: t("blockedHost", { id: short(id) }),
|
|
1139
|
+
auto: !!blocks.auto?.[`host:${id}`],
|
|
1140
|
+
lift: () => Host.moderate({ action: "unblock", host: id })
|
|
1141
|
+
})),
|
|
1142
|
+
...blocks.shares.map((id) => ({
|
|
1143
|
+
key: `share:${id}`,
|
|
1144
|
+
line: t("blockedShare", { id: short(id) }),
|
|
1145
|
+
auto: !!blocks.auto?.[`share:${id}`],
|
|
1146
|
+
lift: () => Host.moderate({ action: "unblock", share: id })
|
|
1147
|
+
}))
|
|
1148
|
+
];
|
|
1149
|
+
if (items.length === 0) {
|
|
1150
|
+
return null;
|
|
1151
|
+
}
|
|
1152
|
+
return /* @__PURE__ */ React.createElement("section", {
|
|
1153
|
+
className: "tsh-blocked"
|
|
1154
|
+
}, /* @__PURE__ */ React.createElement("h3", {
|
|
1155
|
+
className: "tsh-section"
|
|
1156
|
+
}, t("sanctionsTitle")), /* @__PURE__ */ React.createElement("ul", {
|
|
1157
|
+
className: "tsh-rows"
|
|
1158
|
+
}, items.map((item) => /* @__PURE__ */ React.createElement("li", {
|
|
1159
|
+
key: item.key,
|
|
1160
|
+
className: "tsh-blocked-row"
|
|
1161
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1162
|
+
className: "tsh-row-line"
|
|
1163
|
+
}, item.auto && /* @__PURE__ */ React.createElement("span", {
|
|
1164
|
+
className: "tsh-auto"
|
|
1165
|
+
}, t("autoMark")), item.line), /* @__PURE__ */ React.createElement("button", {
|
|
1166
|
+
type: "button",
|
|
1167
|
+
className: "ta-button",
|
|
1168
|
+
onClick: () => act(item.lift)
|
|
1169
|
+
}, item.auto ? t("undo") : t("lift"))))));
|
|
1170
|
+
}
|
|
1171
|
+
function Record({ log }) {
|
|
1172
|
+
if (log.length === 0) {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1175
|
+
const who = { rule: t("whoRule"), operator: t("whoOperator"), user: t("whoUser") };
|
|
1176
|
+
return /* @__PURE__ */ React.createElement("details", {
|
|
1177
|
+
className: "tsh-log"
|
|
1178
|
+
}, /* @__PURE__ */ React.createElement("summary", {
|
|
1179
|
+
className: "tsh-section"
|
|
1180
|
+
}, t("logTitle")), /* @__PURE__ */ React.createElement("ul", {
|
|
1181
|
+
className: "tsh-rows"
|
|
1182
|
+
}, log.slice(0, 30).map((entry) => /* @__PURE__ */ React.createElement("li", {
|
|
1183
|
+
key: `${entry.at}:${entry.target}:${entry.action}`,
|
|
1184
|
+
className: "tsh-row-line tsh-log-line"
|
|
1185
|
+
}, date(entry.at), " · ", t("logLine", { who: who[entry.by], action: entry.action, target: entry.target.replace(/:(.{6}).*/, ":$1") }), entry.reason ? ` · ${entry.reason}` : ""))));
|
|
1186
|
+
}
|
|
1187
|
+
function ReportsPage() {
|
|
1188
|
+
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
1189
|
+
const [state, setState] = useOperator();
|
|
1190
|
+
const [busy, setBusy] = React.useState(false);
|
|
1191
|
+
const act = (run, ask) => void (async () => {
|
|
1192
|
+
if (ask && !await pi.ui.confirm(ask[0], ask[1], { confirmLabel: ask[0].replace(/[??]$/, ""), danger: true })) {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
setBusy(true);
|
|
1196
|
+
try {
|
|
1197
|
+
setState(await run());
|
|
1198
|
+
} catch (error) {
|
|
1199
|
+
pi.ui.notify(message(error), "error");
|
|
1200
|
+
} finally {
|
|
1201
|
+
setBusy(false);
|
|
1202
|
+
}
|
|
1203
|
+
})();
|
|
1204
|
+
const setToken = () => void (async () => {
|
|
1205
|
+
const token = await pi.ui.input(t("operatorSet"), t("operatorToken"));
|
|
1206
|
+
if (token?.trim()) {
|
|
1207
|
+
act(() => Host.setOperatorToken(token.trim()));
|
|
1208
|
+
}
|
|
1209
|
+
})();
|
|
1210
|
+
if (!state) {
|
|
1211
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1212
|
+
className: "tsh-page"
|
|
1213
|
+
}, Loading ? /* @__PURE__ */ React.createElement(Loading, null) : null);
|
|
1214
|
+
}
|
|
1215
|
+
if (!state.operator) {
|
|
1216
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1217
|
+
className: "tsh-page"
|
|
1218
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
1219
|
+
title: t("reportsTitle"),
|
|
1220
|
+
hint: t("operatorHint")
|
|
1221
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1222
|
+
className: "tsh-actions tsh-center"
|
|
1223
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1224
|
+
type: "button",
|
|
1225
|
+
className: "ta-button ta-primary",
|
|
1226
|
+
disabled: busy,
|
|
1227
|
+
onClick: setToken
|
|
1228
|
+
}, t("operatorSet"))));
|
|
1229
|
+
}
|
|
1230
|
+
const list = waiting(state);
|
|
1231
|
+
const appeals = state.appeals ?? [];
|
|
1232
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1233
|
+
className: `tsh-page${busy ? " ta-pending" : ""}`,
|
|
1234
|
+
"aria-busy": busy || undefined
|
|
1235
|
+
}, state.error && /* @__PURE__ */ React.createElement("p", {
|
|
1236
|
+
className: "tsh-error"
|
|
1237
|
+
}, t("operatorError", { error: state.error })), list.length + appeals.length === 0 && !state.error ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
1238
|
+
title: t("reportsNone")
|
|
1239
|
+
}) : /* @__PURE__ */ React.createElement("ul", {
|
|
1240
|
+
className: "tsh-rows"
|
|
1241
|
+
}, appeals.map((appeal) => /* @__PURE__ */ React.createElement(AppealRow, {
|
|
1242
|
+
key: appeal.account,
|
|
1243
|
+
appeal,
|
|
1244
|
+
act
|
|
1245
|
+
})), list.map((report) => /* @__PURE__ */ React.createElement(ReportRow, {
|
|
1246
|
+
key: `${report.host}:${report.share}`,
|
|
1247
|
+
report,
|
|
1248
|
+
state,
|
|
1249
|
+
act
|
|
1250
|
+
}))), /* @__PURE__ */ React.createElement(InForce, {
|
|
1251
|
+
state,
|
|
1252
|
+
act
|
|
1253
|
+
}), state.policy && /* @__PURE__ */ React.createElement(ModerationRules, {
|
|
1254
|
+
policy: state.policy,
|
|
1255
|
+
change: (policy) => Promise.resolve(act(() => Host.moderate({ action: "policy", policy })))
|
|
1256
|
+
}), /* @__PURE__ */ React.createElement(Record, {
|
|
1257
|
+
log: state.log ?? []
|
|
1258
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1259
|
+
className: "tsh-actions tsh-center"
|
|
1260
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1261
|
+
type: "button",
|
|
1262
|
+
className: "ta-button tsh-quiet",
|
|
1263
|
+
onClick: () => act(() => Host.setOperatorToken(null), [t("operatorForget"), state.relay])
|
|
1264
|
+
}, t("operatorForget"))));
|
|
1265
|
+
}
|
|
1266
|
+
function ReportsRow() {
|
|
1267
|
+
const [state] = useOperator();
|
|
1268
|
+
if (!state?.operator) {
|
|
1269
|
+
return null;
|
|
1270
|
+
}
|
|
1271
|
+
const Mark = icon("Shield");
|
|
1272
|
+
const count = waiting(state).length + (state.appeals?.length ?? 0);
|
|
1273
|
+
return /* @__PURE__ */ React.createElement("ul", {
|
|
1274
|
+
className: "tsh-rows tsh-reports-row"
|
|
1275
|
+
}, /* @__PURE__ */ React.createElement("li", {
|
|
1276
|
+
className: "tsh-item"
|
|
1277
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1278
|
+
type: "button",
|
|
1279
|
+
className: "tsh-row-main",
|
|
1280
|
+
onClick: () => pi.ui.showView("@celljs/ta-share/reports")
|
|
1281
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1282
|
+
className: "tsh-tile tsh-tile-report",
|
|
1283
|
+
"aria-hidden": "true"
|
|
1284
|
+
}, /* @__PURE__ */ React.createElement(Mark, {
|
|
1285
|
+
size: 18
|
|
1286
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1287
|
+
className: "tsh-row-text"
|
|
1288
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1289
|
+
className: "tsh-row-title"
|
|
1290
|
+
}, t("reportsTitle")), /* @__PURE__ */ React.createElement("span", {
|
|
1291
|
+
className: "tsh-row-line"
|
|
1292
|
+
}, count ? t("reportsRowLine", { n: count }) : t("reportsNone"))), count > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
1293
|
+
className: "tsh-count"
|
|
1294
|
+
}, count))));
|
|
1295
|
+
}
|
|
1296
|
+
|
|
520
1297
|
// ../ta-protocol/esm/common/message-protocol.js
|
|
521
1298
|
var TaMessageContext;
|
|
522
1299
|
(function(TaMessageContext2) {
|
|
@@ -1041,6 +1818,7 @@ function ShareSheetCompat({ pi: pi2, ...props }) {
|
|
|
1041
1818
|
var SHARE_TOOL = "share_link";
|
|
1042
1819
|
var CONVERSATION_KIND = "ta-conversation";
|
|
1043
1820
|
var FILE_KIND = "file";
|
|
1821
|
+
var MAX_FILE_BYTES = 8 * 1024 * 1024;
|
|
1044
1822
|
var ShareLink;
|
|
1045
1823
|
((ShareLink) => {
|
|
1046
1824
|
const LINK = /^https?:\/\/[^/\s#?]+\/s#v=1&\S+$/i;
|
|
@@ -1079,7 +1857,7 @@ function Choice({
|
|
|
1079
1857
|
onClick: () => onChange(option.value)
|
|
1080
1858
|
}, option.label)));
|
|
1081
1859
|
}
|
|
1082
|
-
function
|
|
1860
|
+
function Toggle2({
|
|
1083
1861
|
checked,
|
|
1084
1862
|
onChange,
|
|
1085
1863
|
label,
|
|
@@ -1138,6 +1916,37 @@ function PreviewBox({ preview, outputs }) {
|
|
|
1138
1916
|
className: "tsh-notes"
|
|
1139
1917
|
}, notes.join(" · ")));
|
|
1140
1918
|
}
|
|
1919
|
+
function sizeOf(bytes) {
|
|
1920
|
+
return bytes < 1024 ? `${bytes} B` : bytes < 1024 * 1024 ? `${Math.round(bytes / 1024)} KB` : `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
1921
|
+
}
|
|
1922
|
+
function FileBox({ target }) {
|
|
1923
|
+
const Kind = icon("FileText");
|
|
1924
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1925
|
+
className: "tsh-preview"
|
|
1926
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1927
|
+
className: "tsh-preview-head"
|
|
1928
|
+
}, /* @__PURE__ */ React.createElement("span", null, t("preview")), target.size !== undefined && /* @__PURE__ */ React.createElement("span", {
|
|
1929
|
+
className: "tsh-muted"
|
|
1930
|
+
}, sizeOf(target.size))), /* @__PURE__ */ React.createElement("p", {
|
|
1931
|
+
className: "tsh-file"
|
|
1932
|
+
}, /* @__PURE__ */ React.createElement(Kind, {
|
|
1933
|
+
size: 16
|
|
1934
|
+
}), /* @__PURE__ */ React.createElement("span", null, target.name)));
|
|
1935
|
+
}
|
|
1936
|
+
function base64url(bytes) {
|
|
1937
|
+
let binary = "";
|
|
1938
|
+
for (let at = 0;at < bytes.length; at += 32768) {
|
|
1939
|
+
binary += String.fromCharCode(...bytes.subarray(at, at + 32768));
|
|
1940
|
+
}
|
|
1941
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1942
|
+
}
|
|
1943
|
+
async function shareFile(target, options) {
|
|
1944
|
+
const file = await pi.files.read(await pi.workspace.fileUrl(target.path, target.cwd));
|
|
1945
|
+
if (file.data.length > MAX_FILE_BYTES) {
|
|
1946
|
+
throw new Error(t("fileLarge", { max: MAX_FILE_BYTES / 1024 / 1024 }));
|
|
1947
|
+
}
|
|
1948
|
+
return Host.shareFile(target.name, file.type || "application/octet-stream", base64url(file.data), options);
|
|
1949
|
+
}
|
|
1141
1950
|
function randomPassword() {
|
|
1142
1951
|
const letters = "abcdefghjkmnpqrstuvwxyz23456789";
|
|
1143
1952
|
const bytes = crypto.getRandomValues(new Uint8Array(8));
|
|
@@ -1162,7 +1971,7 @@ function Made({ share, password, close }) {
|
|
|
1162
1971
|
size: 22
|
|
1163
1972
|
}),
|
|
1164
1973
|
name: share.title,
|
|
1165
|
-
gets: share.access === "self" ? t("accessSelfHint") : share.access === "people" ? t("accessPeopleHint") : t("linkReady"),
|
|
1974
|
+
gets: share.access === "self" ? t("accessSelfHint") : share.access === "people" ? t("accessPeopleHint") : t(share.kind === CONVERSATION_KIND ? "linkReady" : "linkReadyFile"),
|
|
1166
1975
|
notes: [shareLine(share)],
|
|
1167
1976
|
password,
|
|
1168
1977
|
own: share.access === "self",
|
|
@@ -1216,14 +2025,19 @@ function Options({ target, onMade }) {
|
|
|
1216
2025
|
const [preview, setPreview] = React.useState();
|
|
1217
2026
|
const [busy, setBusy] = React.useState(false);
|
|
1218
2027
|
const [error, setError] = React.useState();
|
|
2028
|
+
const sessionFile = target.kind === "conversation" ? target.sessionFile : undefined;
|
|
2029
|
+
const title = target.kind === "conversation" ? target.title : target.name;
|
|
1219
2030
|
React.useEffect(() => {
|
|
2031
|
+
if (!sessionFile) {
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
1220
2034
|
let live = true;
|
|
1221
2035
|
setPreview(undefined);
|
|
1222
|
-
Host.preview(
|
|
2036
|
+
Host.preview(sessionFile, { outputs, title }).then((result) => live && setPreview({ conversation: JSON.parse(result.json), stats: result.stats }), () => live && setPreview({}));
|
|
1223
2037
|
return () => {
|
|
1224
2038
|
live = false;
|
|
1225
2039
|
};
|
|
1226
|
-
}, [
|
|
2040
|
+
}, [sessionFile, title, outputs]);
|
|
1227
2041
|
const self = access === "self";
|
|
1228
2042
|
const only = self || access === "people";
|
|
1229
2043
|
const make = async () => {
|
|
@@ -1238,15 +2052,14 @@ function Options({ target, onMade }) {
|
|
|
1238
2052
|
setBusy(true);
|
|
1239
2053
|
setError(undefined);
|
|
1240
2054
|
try {
|
|
1241
|
-
const
|
|
2055
|
+
const options = {
|
|
1242
2056
|
access,
|
|
1243
2057
|
...access === "password" ? { password } : {},
|
|
1244
2058
|
...access === "people" ? { people } : {},
|
|
1245
2059
|
days: offline && days === 0 ? 30 : days,
|
|
1246
|
-
offline: offline && !only
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
});
|
|
2060
|
+
offline: offline && !only
|
|
2061
|
+
};
|
|
2062
|
+
const result = target.kind === "conversation" ? await Host.shareConversation(target.sessionFile, { ...options, outputs, title: target.title }) : await shareFile(target, options);
|
|
1250
2063
|
shares.added(result.share);
|
|
1251
2064
|
onMade(result, access === "password" ? password : undefined);
|
|
1252
2065
|
} catch (failure) {
|
|
@@ -1254,12 +2067,15 @@ function Options({ target, onMade }) {
|
|
|
1254
2067
|
setBusy(false);
|
|
1255
2068
|
}
|
|
1256
2069
|
};
|
|
1257
|
-
const empty = preview?.stats?.messages === 0;
|
|
2070
|
+
const empty = target.kind === "conversation" && preview?.stats?.messages === 0;
|
|
2071
|
+
const large = target.kind === "file" && (target.size ?? 0) > MAX_FILE_BYTES;
|
|
1258
2072
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1259
2073
|
className: "tsh-options"
|
|
1260
|
-
}, /* @__PURE__ */ React.createElement(PreviewBox, {
|
|
2074
|
+
}, target.kind === "conversation" ? /* @__PURE__ */ React.createElement(PreviewBox, {
|
|
1261
2075
|
preview,
|
|
1262
2076
|
outputs
|
|
2077
|
+
}) : /* @__PURE__ */ React.createElement(FileBox, {
|
|
2078
|
+
target
|
|
1263
2079
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
1264
2080
|
className: "tsh-field"
|
|
1265
2081
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
@@ -1304,25 +2120,25 @@ function Options({ target, onMade }) {
|
|
|
1304
2120
|
value: offline && days === 0 ? 30 : days,
|
|
1305
2121
|
onChange: setDays,
|
|
1306
2122
|
options: DAYS.map((value) => ({ value, label: value === 0 ? t("forever") : t(`day${value}`), disabled: value === 0 && offline }))
|
|
1307
|
-
})), /* @__PURE__ */ React.createElement(
|
|
2123
|
+
})), target.kind === "conversation" && /* @__PURE__ */ React.createElement(Toggle2, {
|
|
1308
2124
|
checked: outputs,
|
|
1309
2125
|
onChange: setOutputs,
|
|
1310
2126
|
label: t("outputs"),
|
|
1311
2127
|
hint: t("outputsHint")
|
|
1312
|
-
}), /* @__PURE__ */ React.createElement(
|
|
2128
|
+
}), /* @__PURE__ */ React.createElement(Toggle2, {
|
|
1313
2129
|
checked: offline && !only,
|
|
1314
2130
|
onChange: setOffline,
|
|
1315
2131
|
disabled: only,
|
|
1316
2132
|
label: t("offline"),
|
|
1317
2133
|
hint: access === "password" ? t("offlinePassword") : t("offlineHint")
|
|
1318
|
-
}), (error || empty) && /* @__PURE__ */ React.createElement("p", {
|
|
2134
|
+
}), (error || empty || large) && /* @__PURE__ */ React.createElement("p", {
|
|
1319
2135
|
className: "tsh-error"
|
|
1320
|
-
}, error ?? t("nothing")), /* @__PURE__ */ React.createElement("div", {
|
|
2136
|
+
}, error ?? (large ? t("fileLarge", { max: MAX_FILE_BYTES / 1024 / 1024 }) : t("nothing"))), /* @__PURE__ */ React.createElement("div", {
|
|
1321
2137
|
className: "tsh-actions"
|
|
1322
2138
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
1323
2139
|
type: "button",
|
|
1324
2140
|
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
1325
|
-
disabled: busy || empty,
|
|
2141
|
+
disabled: busy || empty || large,
|
|
1326
2142
|
onClick: () => void make()
|
|
1327
2143
|
}, busy ? t("making") : t("makeLink"))));
|
|
1328
2144
|
}
|
|
@@ -1336,11 +2152,11 @@ function ShareDialog({ target, close }) {
|
|
|
1336
2152
|
});
|
|
1337
2153
|
}
|
|
1338
2154
|
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1339
|
-
title: t("shareTitle", { title: target.kind === "made" ? target.share.title : target.title }),
|
|
2155
|
+
title: t("shareTitle", { title: target.kind === "made" ? target.share.title : target.kind === "file" ? target.name : target.title }),
|
|
1340
2156
|
onClose: close
|
|
1341
2157
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1342
2158
|
className: "tsh-dialog"
|
|
1343
|
-
}, target.kind
|
|
2159
|
+
}, target.kind !== "made" && /* @__PURE__ */ React.createElement(Options, {
|
|
1344
2160
|
target,
|
|
1345
2161
|
onMade: (result, password) => setMade({ share: result.share, password })
|
|
1346
2162
|
})));
|
|
@@ -1656,6 +2472,48 @@ function SharedView({ link }) {
|
|
|
1656
2472
|
}));
|
|
1657
2473
|
}
|
|
1658
2474
|
|
|
2475
|
+
// web-src/standing-notice.tsx
|
|
2476
|
+
function StandingNotice() {
|
|
2477
|
+
const [standing, setStanding] = React.useState(null);
|
|
2478
|
+
React.useEffect(() => {
|
|
2479
|
+
let live = true;
|
|
2480
|
+
Host.standing().then((next) => live && setStanding(next), () => {
|
|
2481
|
+
return;
|
|
2482
|
+
});
|
|
2483
|
+
return () => {
|
|
2484
|
+
live = false;
|
|
2485
|
+
};
|
|
2486
|
+
}, []);
|
|
2487
|
+
if (!standing || !standing.sanction && standing.blocked.length === 0) {
|
|
2488
|
+
return null;
|
|
2489
|
+
}
|
|
2490
|
+
const sanction = standing.sanction;
|
|
2491
|
+
const until = sanction ? sanction.until ? t("sanctionUntil", { date: date(sanction.until) }) : "" : "";
|
|
2492
|
+
const line = sanction ? t(sanction.level === "ban" ? "standingBan" : "standingLimit", { until: until ? ` · ${until}` : "" }) : t("standingBlocked", { n: standing.blocked.length });
|
|
2493
|
+
const appeal = () => void (async () => {
|
|
2494
|
+
const text = await pi.ui.input(t("appealTitle"), t("appealHint"));
|
|
2495
|
+
if (text?.trim()) {
|
|
2496
|
+
await Host.appeal(text.trim()).then(setStanding, (error) => pi.ui.notify(message(error), "error"));
|
|
2497
|
+
}
|
|
2498
|
+
})();
|
|
2499
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2500
|
+
className: "tsh-standing",
|
|
2501
|
+
role: "status"
|
|
2502
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2503
|
+
className: "tsh-row-text"
|
|
2504
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2505
|
+
className: "tsh-row-title"
|
|
2506
|
+
}, line), sanction?.reason && /* @__PURE__ */ React.createElement("span", {
|
|
2507
|
+
className: "tsh-row-line tsh-wrap"
|
|
2508
|
+
}, t("standingWhy", { reason: sanction.reason })), standing.appeal && /* @__PURE__ */ React.createElement("span", {
|
|
2509
|
+
className: "tsh-row-line"
|
|
2510
|
+
}, t("appealSent"))), !standing.appeal && /* @__PURE__ */ React.createElement("button", {
|
|
2511
|
+
type: "button",
|
|
2512
|
+
className: "ta-button",
|
|
2513
|
+
onClick: appeal
|
|
2514
|
+
}, t("appeal")));
|
|
2515
|
+
}
|
|
2516
|
+
|
|
1659
2517
|
// web-src/shares-page.tsx
|
|
1660
2518
|
function ShareRow({ share }) {
|
|
1661
2519
|
const [copied, setCopied] = React.useState(false);
|
|
@@ -1736,12 +2594,104 @@ function ShareRow({ share }) {
|
|
|
1736
2594
|
actions: [{ key: "stop", label: t("stop"), danger: true, run: () => void stop() }]
|
|
1737
2595
|
}, content) : content, menu);
|
|
1738
2596
|
}
|
|
2597
|
+
function TunnelRow({ tunnel, onStop }) {
|
|
2598
|
+
const touch = pi.ui.useDevice().touch;
|
|
2599
|
+
const Globe = icon("Globe");
|
|
2600
|
+
const Stop = icon("Power");
|
|
2601
|
+
const time = new Date(tunnel.expiresAt).toLocaleTimeString(pi.ui.language, { hour: "2-digit", minute: "2-digit" });
|
|
2602
|
+
const copy = () => void navigator.clipboard?.writeText(tunnel.url).then(() => pi.ui.notify(t("copied"))).catch((error) => pi.ui.notify(message(error), "error"));
|
|
2603
|
+
const content = /* @__PURE__ */ React.createElement("div", {
|
|
2604
|
+
className: "tsh-row"
|
|
2605
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2606
|
+
type: "button",
|
|
2607
|
+
className: "tsh-row-main",
|
|
2608
|
+
title: t("copy"),
|
|
2609
|
+
onClick: copy
|
|
2610
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2611
|
+
className: "tsh-tile tsh-tile-service",
|
|
2612
|
+
"aria-hidden": "true"
|
|
2613
|
+
}, /* @__PURE__ */ React.createElement(Globe, {
|
|
2614
|
+
size: 18
|
|
2615
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
2616
|
+
className: "tsh-row-text"
|
|
2617
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2618
|
+
className: "tsh-row-title"
|
|
2619
|
+
}, tunnel.title), /* @__PURE__ */ React.createElement("span", {
|
|
2620
|
+
className: "tsh-row-line"
|
|
2621
|
+
}, t("serviceLine", { port: tunnel.port, time })))), !touch && /* @__PURE__ */ React.createElement("div", {
|
|
2622
|
+
className: "tsh-row-actions"
|
|
2623
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2624
|
+
type: "button",
|
|
2625
|
+
className: "tsh-icon tsh-danger",
|
|
2626
|
+
title: t("serviceStop"),
|
|
2627
|
+
"aria-label": t("serviceStop"),
|
|
2628
|
+
onClick: () => onStop(tunnel)
|
|
2629
|
+
}, /* @__PURE__ */ React.createElement(Stop, {
|
|
2630
|
+
size: 15
|
|
2631
|
+
}))));
|
|
2632
|
+
const SwipeRow = pi.ui.SwipeRow;
|
|
2633
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2634
|
+
className: "tsh-item"
|
|
2635
|
+
}, SwipeRow ? /* @__PURE__ */ React.createElement(SwipeRow, {
|
|
2636
|
+
actions: [{ key: "stop", label: t("serviceStop"), danger: true, run: () => onStop(tunnel) }]
|
|
2637
|
+
}, content) : content);
|
|
2638
|
+
}
|
|
2639
|
+
function Services() {
|
|
2640
|
+
const [state, setState] = React.useState();
|
|
2641
|
+
React.useEffect(() => {
|
|
2642
|
+
let live = true;
|
|
2643
|
+
const read = () => void Host.tunnelState().then((next) => live && setState(next), () => {
|
|
2644
|
+
return;
|
|
2645
|
+
});
|
|
2646
|
+
read();
|
|
2647
|
+
const timer = setInterval(read, 1e4);
|
|
2648
|
+
return () => {
|
|
2649
|
+
live = false;
|
|
2650
|
+
clearInterval(timer);
|
|
2651
|
+
};
|
|
2652
|
+
}, []);
|
|
2653
|
+
if (!state?.allowed) {
|
|
2654
|
+
return null;
|
|
2655
|
+
}
|
|
2656
|
+
const Switch = pi.ui.Switch;
|
|
2657
|
+
const toggle = (enabled) => Host.setTunnelsEnabled(enabled).then(setState, (error) => {
|
|
2658
|
+
pi.ui.notify(message(error), "error");
|
|
2659
|
+
throw error;
|
|
2660
|
+
});
|
|
2661
|
+
const stop = async (tunnel) => {
|
|
2662
|
+
if (await pi.ui.confirm(t("serviceStopTitle", { title: tunnel.title }), t("serviceStopHint"), { confirmLabel: t("serviceStop"), danger: true })) {
|
|
2663
|
+
await Host.stopTunnel(tunnel.id).catch((error) => pi.ui.notify(message(error), "error"));
|
|
2664
|
+
setState({ ...state, tunnels: state.tunnels.filter((each) => each.id !== tunnel.id) });
|
|
2665
|
+
}
|
|
2666
|
+
};
|
|
2667
|
+
return /* @__PURE__ */ React.createElement("section", {
|
|
2668
|
+
className: "tsh-services"
|
|
2669
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2670
|
+
className: "tsh-services-head"
|
|
2671
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2672
|
+
className: "tsh-services-text"
|
|
2673
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2674
|
+
className: "tsh-row-title"
|
|
2675
|
+
}, t("servicesTitle")), /* @__PURE__ */ React.createElement("span", {
|
|
2676
|
+
className: "tsh-row-line tsh-wrap"
|
|
2677
|
+
}, state.enabled && state.tunnels.length === 0 ? t("servicesNone") : t("servicesHint"))), Switch && /* @__PURE__ */ React.createElement(Switch, {
|
|
2678
|
+
checked: state.enabled,
|
|
2679
|
+
label: t("servicesSwitch"),
|
|
2680
|
+
onChange: (checked) => toggle(checked)
|
|
2681
|
+
})), state.tunnels.length > 0 && /* @__PURE__ */ React.createElement("ul", {
|
|
2682
|
+
className: "tsh-rows"
|
|
2683
|
+
}, state.tunnels.map((tunnel) => /* @__PURE__ */ React.createElement(TunnelRow, {
|
|
2684
|
+
key: tunnel.id,
|
|
2685
|
+
tunnel,
|
|
2686
|
+
onStop: (each) => void stop(each)
|
|
2687
|
+
}))));
|
|
2688
|
+
}
|
|
1739
2689
|
function SharesPage() {
|
|
1740
2690
|
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
1741
2691
|
const list = useShares();
|
|
1742
2692
|
return /* @__PURE__ */ React.createElement("div", {
|
|
1743
2693
|
className: "tsh-page"
|
|
1744
|
-
}, list === undefined ? Loading ? /* @__PURE__ */ React.createElement(Loading, null) : null : list.length === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
2694
|
+
}, /* @__PURE__ */ React.createElement(StandingNotice, null), /* @__PURE__ */ React.createElement(ReportsRow, null), /* @__PURE__ */ React.createElement(Services, null), list === undefined ? Loading ? /* @__PURE__ */ React.createElement(Loading, null) : null : list.length === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
1745
2695
|
title: t("emptyTitle"),
|
|
1746
2696
|
hint: t("emptyHint")
|
|
1747
2697
|
}) : /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -1769,6 +2719,9 @@ var STYLE = `
|
|
|
1769
2719
|
.tsh-lines b { flex: none; width: 2.2em; font-weight: 500; color: var(--ta-muted); }
|
|
1770
2720
|
.tsh-lines span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1771
2721
|
.tsh-line-user span { color: var(--ta-text); }
|
|
2722
|
+
.tsh-file { margin: 8px 0 0; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-secondary); }
|
|
2723
|
+
.tsh-file svg { flex: none; color: var(--ta-muted); }
|
|
2724
|
+
.tsh-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1772
2725
|
.tsh-notes { margin: 8px 0 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
1773
2726
|
.tsh-field { display: flex; flex-direction: column; gap: 6px; }
|
|
1774
2727
|
.tsh-label { font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-secondary); }
|
|
@@ -1798,6 +2751,39 @@ var STYLE = `
|
|
|
1798
2751
|
.tsh-tile { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: var(--ta-green); }
|
|
1799
2752
|
.tsh-tile-password { background: var(--ta-yellow); }
|
|
1800
2753
|
.tsh-tile-self { background: var(--ta-blue); }
|
|
2754
|
+
.tsh-tile-service { background: #8b5cf6; }
|
|
2755
|
+
.tsh-tile-report { background: var(--ta-red); }
|
|
2756
|
+
.tsh-report { list-style: none; padding: 12px 8px; border-bottom: 1px solid var(--ta-border-muted); display: flex; flex-direction: column; gap: 8px; }
|
|
2757
|
+
.tsh-report-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
|
2758
|
+
.tsh-report-note { margin: 0 0 0 50px; font-size: calc(13px * var(--ta-font-scale)); line-height: 1.5; color: var(--ta-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2759
|
+
.tsh-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: 50px; }
|
|
2760
|
+
.tsh-report-actions .tsh-danger, .tsh-blocked .tsh-danger { color: var(--ta-red); }
|
|
2761
|
+
.ta-button.tsh-danger { color: var(--ta-red); }
|
|
2762
|
+
.tsh-grow { flex: 1; }
|
|
2763
|
+
.tsh-section { margin: 20px 8px 4px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }
|
|
2764
|
+
.tsh-blocked { width: 100%; max-width: var(--ta-page-width); margin: 0 auto; }
|
|
2765
|
+
.tsh-blocked-row { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; }
|
|
2766
|
+
.tsh-center { justify-content: center; margin-top: 20px; }
|
|
2767
|
+
.tsh-quiet { border-color: transparent; color: var(--ta-muted); }
|
|
2768
|
+
.tsh-count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ta-red); color: #fff; font-size: calc(12px * var(--ta-font-scale)); line-height: 20px; text-align: center; box-sizing: border-box; }
|
|
2769
|
+
.tsh-reports-row { margin-bottom: 8px; }
|
|
2770
|
+
.tsh-flush { margin-left: 0; }
|
|
2771
|
+
.tsh-auto { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px; background: var(--ta-hover-strong); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: 18px; }
|
|
2772
|
+
.tsh-rules { width: 100%; max-width: var(--ta-page-width); margin: 0 auto; }
|
|
2773
|
+
.tsh-rule { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; }
|
|
2774
|
+
.tsh-rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
2775
|
+
.tsh-rule-label { font-size: calc(14px * var(--ta-font-scale)); }
|
|
2776
|
+
.tsh-stepper { flex: none; display: inline-flex; align-items: center; gap: 4px; }
|
|
2777
|
+
.tsh-stepper-value { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; font-size: calc(14px * var(--ta-font-scale)); }
|
|
2778
|
+
.tsh-log { width: 100%; max-width: var(--ta-page-width); margin: 8px auto 0; }
|
|
2779
|
+
.tsh-log summary { cursor: pointer; }
|
|
2780
|
+
.tsh-log-line { list-style: none; padding: 3px 8px; white-space: normal; }
|
|
2781
|
+
.tsh-standing { width: 100%; max-width: var(--ta-page-width); margin: 0 auto 12px; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--ta-red) 10%, transparent); }
|
|
2782
|
+
:root[data-handheld] .tsh-report-note, :root[data-handheld] .tsh-report-actions { margin-left: 0; }
|
|
2783
|
+
.tsh-services { width: 100%; max-width: var(--ta-page-width); margin: 0 auto 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ta-border-muted); }
|
|
2784
|
+
.tsh-services-head { display: flex; align-items: center; gap: 12px; padding: 6px 8px; }
|
|
2785
|
+
.tsh-services-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
2786
|
+
.tsh-wrap { white-space: normal; line-height: 1.45; }
|
|
1801
2787
|
.tsh-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
1802
2788
|
.tsh-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1803
2789
|
.tsh-row-line { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -1886,6 +2872,14 @@ function activate(pi2) {
|
|
|
1886
2872
|
run: () => openShareDialog({ kind: "conversation", sessionFile: session.sessionFile, title: session.title })
|
|
1887
2873
|
}
|
|
1888
2874
|
] : []);
|
|
2875
|
+
pi2.registerFileMenu?.((file) => file.kind === "file" ? [
|
|
2876
|
+
{
|
|
2877
|
+
key: "share",
|
|
2878
|
+
label: t("share"),
|
|
2879
|
+
icon: Share,
|
|
2880
|
+
run: () => openShareDialog({ kind: "file", cwd: file.cwd, path: file.path, name: file.name, size: file.size })
|
|
2881
|
+
}
|
|
2882
|
+
] : []);
|
|
1889
2883
|
pi2.registerOpener((link) => {
|
|
1890
2884
|
if (link.type !== "url" || !ShareLink.is(link.url)) {
|
|
1891
2885
|
return false;
|
|
@@ -1894,6 +2888,7 @@ function activate(pi2) {
|
|
|
1894
2888
|
return true;
|
|
1895
2889
|
}, { specific: true });
|
|
1896
2890
|
pi2.registerView("shares", { title: () => t("sharesTitle"), icon: Share, render: SharesPage, group: "share", order: 80 });
|
|
2891
|
+
pi2.registerView("reports", { title: () => t("reportsTitle"), icon: pi2.ui.icons.Shield ?? Share, render: ReportsPage, navigation: false });
|
|
1897
2892
|
pi2.registerToolRenderer((name, next) => name === SHARE_TOOL ? next() ?? {
|
|
1898
2893
|
renderCall: (args) => ({
|
|
1899
2894
|
verb: t("toolShare"),
|