@celljs/ta-share 4.25.0 → 4.27.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/host/index.mjs +539 -68
- package/package.json +4 -4
- package/web/index.js +119 -37
package/host/index.mjs
CHANGED
|
@@ -41,6 +41,489 @@ var RelayBytes;
|
|
|
41
41
|
RelayBytes2.concat = concat;
|
|
42
42
|
})(RelayBytes || (RelayBytes = {}));
|
|
43
43
|
|
|
44
|
+
// ../ta-relay/esm/common/relay-feedback-board-types.js
|
|
45
|
+
var RELAY_FEEDBACK_BOARD_POLICY = {
|
|
46
|
+
halfLifeDays: 30,
|
|
47
|
+
archiveDoneDays: 7,
|
|
48
|
+
archiveIdleDays: 90,
|
|
49
|
+
votesDaily: 200,
|
|
50
|
+
commentCooldownSeconds: 60,
|
|
51
|
+
commentsDaily: 30,
|
|
52
|
+
commentNewHours: 24,
|
|
53
|
+
breakerHourly: 50,
|
|
54
|
+
sourceCap: 2
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// ../ta-relay/esm/common/relay-feedback-score.js
|
|
58
|
+
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
59
|
+
var HOUR_MS = 60 * 60 * 1000;
|
|
60
|
+
var PLUS_WEIGHT = 2;
|
|
61
|
+
var UP_WEIGHT = 1;
|
|
62
|
+
var BURST_TIMES = 10;
|
|
63
|
+
var BURST_MIN = 20;
|
|
64
|
+
var Z = 1.96;
|
|
65
|
+
var RelayFeedbackScore;
|
|
66
|
+
(function(RelayFeedbackScore2) {
|
|
67
|
+
function trust(since, now, spammer = false) {
|
|
68
|
+
if (spammer || now - since < DAY_MS) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
return now - since < 7 * DAY_MS ? 0.5 : 1;
|
|
72
|
+
}
|
|
73
|
+
RelayFeedbackScore2.trust = trust;
|
|
74
|
+
function decay(age, halfLifeDays) {
|
|
75
|
+
return 2 ** (-Math.max(0, age) / (halfLifeDays * DAY_MS));
|
|
76
|
+
}
|
|
77
|
+
RelayFeedbackScore2.decay = decay;
|
|
78
|
+
function counted(votes2, spammers, cap = 2) {
|
|
79
|
+
var _a;
|
|
80
|
+
const seen = new Map;
|
|
81
|
+
const kept = [];
|
|
82
|
+
for (const vote of votes2) {
|
|
83
|
+
if (vote.h || spammers.has(vote.a)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const key = `${vote.src}:${vote.day}`;
|
|
87
|
+
const n = ((_a = seen.get(key)) !== null && _a !== undefined ? _a : 0) + 1;
|
|
88
|
+
seen.set(key, n);
|
|
89
|
+
if (!cap || n <= cap) {
|
|
90
|
+
kept.push(vote);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return kept;
|
|
94
|
+
}
|
|
95
|
+
RelayFeedbackScore2.counted = counted;
|
|
96
|
+
function tally(votes2, spammers, now, halfLifeDays, cap = 2) {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
const counted2 = RelayFeedbackScore2.counted(votes2, spammers, cap);
|
|
99
|
+
let support = 0;
|
|
100
|
+
let against = 0;
|
|
101
|
+
for (const vote of counted2) {
|
|
102
|
+
if (vote.p) {
|
|
103
|
+
support += PLUS_WEIGHT * vote.w * decay(now - ((_a = vote.pAt) !== null && _a !== undefined ? _a : now), halfLifeDays);
|
|
104
|
+
}
|
|
105
|
+
if (vote.s === "up") {
|
|
106
|
+
support += UP_WEIGHT * vote.w * decay(now - ((_b = vote.sAt) !== null && _b !== undefined ? _b : now), halfLifeDays);
|
|
107
|
+
} else if (vote.s === "down") {
|
|
108
|
+
against += vote.w * decay(now - ((_c = vote.sAt) !== null && _c !== undefined ? _c : now), halfLifeDays);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
plus: counted2.filter((vote) => vote.p).length,
|
|
113
|
+
up: counted2.filter((vote) => vote.s === "up").length,
|
|
114
|
+
down: counted2.filter((vote) => vote.s === "down").length,
|
|
115
|
+
held: votes2.filter((vote) => vote.h).length,
|
|
116
|
+
support,
|
|
117
|
+
against,
|
|
118
|
+
at: now
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
RelayFeedbackScore2.tally = tally;
|
|
122
|
+
function wilson(support, against) {
|
|
123
|
+
const n = support + against;
|
|
124
|
+
if (n <= 0) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
const p = support / n;
|
|
128
|
+
const z2 = Z * Z;
|
|
129
|
+
return (p + z2 / (2 * n) - Z * Math.sqrt(p * (1 - p) / n + z2 / (4 * n * n))) / (1 + z2 / n);
|
|
130
|
+
}
|
|
131
|
+
RelayFeedbackScore2.wilson = wilson;
|
|
132
|
+
function votes(given, now, halfLifeDays) {
|
|
133
|
+
var _a, _b, _c;
|
|
134
|
+
const fade = decay(now - ((_a = given.scoredAt) !== null && _a !== undefined ? _a : now), halfLifeDays);
|
|
135
|
+
const support = ((_b = given.support) !== null && _b !== undefined ? _b : 0) * fade;
|
|
136
|
+
const against = ((_c = given.against) !== null && _c !== undefined ? _c : 0) * fade;
|
|
137
|
+
return Math.log2(1 + support) * wilson(support, against);
|
|
138
|
+
}
|
|
139
|
+
RelayFeedbackScore2.votes = votes;
|
|
140
|
+
function burst(times, now) {
|
|
141
|
+
const hour = times.filter((at) => now - at < HOUR_MS).length + 1;
|
|
142
|
+
const week = times.filter((at) => now - at >= HOUR_MS && now - at < 7 * DAY_MS).length;
|
|
143
|
+
return hour >= BURST_MIN && hour > BURST_TIMES * week / (7 * 24 - 1);
|
|
144
|
+
}
|
|
145
|
+
RelayFeedbackScore2.burst = burst;
|
|
146
|
+
function tokens(text) {
|
|
147
|
+
var _a;
|
|
148
|
+
const out = new Set;
|
|
149
|
+
for (const run of (_a = text.toLowerCase().match(/[\p{L}\p{N}]+/gu)) !== null && _a !== undefined ? _a : []) {
|
|
150
|
+
if (/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(run)) {
|
|
151
|
+
for (let i = 0;i < run.length - 1; i++) {
|
|
152
|
+
out.add(run.slice(i, i + 2));
|
|
153
|
+
}
|
|
154
|
+
if (run.length === 1) {
|
|
155
|
+
out.add(run);
|
|
156
|
+
}
|
|
157
|
+
} else if (run.length > 1) {
|
|
158
|
+
out.add(run);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
RelayFeedbackScore2.tokens = tokens;
|
|
164
|
+
function match(query, text) {
|
|
165
|
+
if (!query.size) {
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
let hit = 0;
|
|
169
|
+
for (const token of query) {
|
|
170
|
+
if (text.has(token)) {
|
|
171
|
+
hit++;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return hit / query.size;
|
|
175
|
+
}
|
|
176
|
+
RelayFeedbackScore2.match = match;
|
|
177
|
+
})(RelayFeedbackScore || (RelayFeedbackScore = {}));
|
|
178
|
+
// ../ta-relay/esm/common/relay-feedback-types.js
|
|
179
|
+
var RELAY_FEEDBACK_PACKAGE_PATH = "/v1/feedback/package";
|
|
180
|
+
var RELAY_FEEDBACK_INBOX_PACKAGE_PATH = "/v1/feedback/inbox/package";
|
|
181
|
+
var RELAY_FEEDBACK_CATALOG_PATH = "/v1/feedback/catalog";
|
|
182
|
+
var RELAY_FEEDBACK_CATALOG_PACKAGE_PATH = "/v1/feedback/catalog/package";
|
|
183
|
+
var RELAY_FEEDBACK_KINDS = ["bug", "wish"];
|
|
184
|
+
var RELAY_FEEDBACK_STATUSES = ["new", "planned", "doing", "done", "declined"];
|
|
185
|
+
var RELAY_FEEDBACK_CLOSED = ["done", "declined"];
|
|
186
|
+
var RELAY_FEEDBACK_LIMITS = {
|
|
187
|
+
title: 80,
|
|
188
|
+
body: 4000,
|
|
189
|
+
reply: 2000,
|
|
190
|
+
images: 3,
|
|
191
|
+
image: 700000,
|
|
192
|
+
package: 512 * 1024,
|
|
193
|
+
request: 3200000,
|
|
194
|
+
catalog: 100,
|
|
195
|
+
kept: 2000
|
|
196
|
+
};
|
|
197
|
+
var RELAY_FEEDBACK_IMAGE = /^data:(image\/(?:jpeg|png|webp));base64,([A-Za-z0-9+/]+={0,2})$/;
|
|
198
|
+
var RELAY_FEEDBACK_MODES = ["confirm", "auto", "human"];
|
|
199
|
+
var RELAY_FEEDBACK_POLICY = { on: true, cooldownMinutes: 10, daily: 5, open: 10, newDays: 7, imageDays: 30 };
|
|
200
|
+
var RELAY_FEEDBACK_PACE = { mode: "confirm", daily: 3, parallel: 2, tokens: 2000000, from: 9, to: 21, rush: ["security"] };
|
|
201
|
+
var RelayFeedbackPolicyUtil;
|
|
202
|
+
(function(RelayFeedbackPolicyUtil2) {
|
|
203
|
+
const count = (value, fallback, min, max) => {
|
|
204
|
+
const n = Math.round(Number(value));
|
|
205
|
+
return Number.isFinite(n) && value !== null && value !== "" ? Math.min(max, Math.max(min, n)) : fallback;
|
|
206
|
+
};
|
|
207
|
+
const mode = (value) => RELAY_FEEDBACK_MODES.find((each) => each === value);
|
|
208
|
+
function words(value, most = 20, max = 40) {
|
|
209
|
+
const list = Array.isArray(value) ? value : typeof value === "string" ? value.split(/[,,、\n]/) : [];
|
|
210
|
+
return [
|
|
211
|
+
...new Set(list.map((each) => String(each !== null && each !== undefined ? each : "").trim().slice(0, max)).filter(Boolean))
|
|
212
|
+
].slice(0, most);
|
|
213
|
+
}
|
|
214
|
+
RelayFeedbackPolicyUtil2.words = words;
|
|
215
|
+
function env(given) {
|
|
216
|
+
const env2 = given !== null && given !== undefined ? given : {};
|
|
217
|
+
const short = (value, max) => String(value).trim().slice(0, max);
|
|
218
|
+
return {
|
|
219
|
+
...env2.version ? { version: short(env2.version, 40) } : {},
|
|
220
|
+
...env2.os ? { os: short(env2.os, 60) } : {},
|
|
221
|
+
...env2.language ? { language: short(env2.language, 20) } : {}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
RelayFeedbackPolicyUtil2.env = env;
|
|
225
|
+
function input(text) {
|
|
226
|
+
var _a, _b;
|
|
227
|
+
let given;
|
|
228
|
+
try {
|
|
229
|
+
given = JSON.parse(text);
|
|
230
|
+
} catch (_c) {
|
|
231
|
+
return { error: "Not a feedback." };
|
|
232
|
+
}
|
|
233
|
+
const kind = RELAY_FEEDBACK_KINDS.find((each) => each === (given === null || given === undefined ? undefined : given.kind));
|
|
234
|
+
const title = String((_a = given === null || given === undefined ? undefined : given.title) !== null && _a !== undefined ? _a : "").trim().slice(0, RELAY_FEEDBACK_LIMITS.title);
|
|
235
|
+
const body = String((_b = given === null || given === undefined ? undefined : given.body) !== null && _b !== undefined ? _b : "").trim().slice(0, RELAY_FEEDBACK_LIMITS.body);
|
|
236
|
+
const images = Array.isArray(given === null || given === undefined ? undefined : given.images) ? given.images : [];
|
|
237
|
+
if (!kind || !title) {
|
|
238
|
+
return { error: "Say what it is about, in a title." };
|
|
239
|
+
}
|
|
240
|
+
if (images.length > RELAY_FEEDBACK_LIMITS.images || images.some((url) => typeof url !== "string" || url.length > RELAY_FEEDBACK_LIMITS.image || !RELAY_FEEDBACK_IMAGE.test(url))) {
|
|
241
|
+
return { error: `At most ${RELAY_FEEDBACK_LIMITS.images} pictures, each JPEG, PNG or WebP of about 500 KB.` };
|
|
242
|
+
}
|
|
243
|
+
return { kind, title, body, images, ...given.env ? { env: given.env } : {}, ...given.package ? { package: given.package } : {} };
|
|
244
|
+
}
|
|
245
|
+
RelayFeedbackPolicyUtil2.input = input;
|
|
246
|
+
function packageInfo(given, size) {
|
|
247
|
+
const info = given !== null && given !== undefined ? given : {};
|
|
248
|
+
const short = (value, max) => value === undefined || value === null ? "" : String(value).trim().slice(0, max);
|
|
249
|
+
const name = short(info.name, 214);
|
|
250
|
+
if (!name) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const title = short(info.title, 80);
|
|
254
|
+
const summary = short(info.summary, 400);
|
|
255
|
+
const version = short(info.version, 40);
|
|
256
|
+
const files = Math.max(0, Math.min(5000, Math.round(Number(info.files)) || 0));
|
|
257
|
+
return { name, ...title ? { title } : {}, ...summary ? { summary } : {}, ...version ? { version } : {}, size, files };
|
|
258
|
+
}
|
|
259
|
+
RelayFeedbackPolicyUtil2.packageInfo = packageInfo;
|
|
260
|
+
function pace(given, base = RELAY_FEEDBACK_PACE) {
|
|
261
|
+
var _a;
|
|
262
|
+
return {
|
|
263
|
+
mode: (_a = mode(given === null || given === undefined ? undefined : given.mode)) !== null && _a !== undefined ? _a : base.mode,
|
|
264
|
+
daily: count(given === null || given === undefined ? undefined : given.daily, base.daily, 0, 100),
|
|
265
|
+
parallel: count(given === null || given === undefined ? undefined : given.parallel, base.parallel, 1, 20),
|
|
266
|
+
tokens: count(given === null || given === undefined ? undefined : given.tokens, base.tokens, 0, 1e9),
|
|
267
|
+
from: count(given === null || given === undefined ? undefined : given.from, base.from, 0, 23),
|
|
268
|
+
to: count(given === null || given === undefined ? undefined : given.to, base.to, 1, 24),
|
|
269
|
+
rush: (given === null || given === undefined ? undefined : given.rush) === undefined ? base.rush : words(given.rush, 10)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
RelayFeedbackPolicyUtil2.pace = pace;
|
|
273
|
+
function rule(given, id) {
|
|
274
|
+
var _a, _b, _c, _d;
|
|
275
|
+
const when = (_a = given === null || given === undefined ? undefined : given.when) !== null && _a !== undefined ? _a : {};
|
|
276
|
+
const then = (_b = given === null || given === undefined ? undefined : given.does) !== null && _b !== undefined ? _b : {};
|
|
277
|
+
const days = (value) => value === undefined || value === null || value === "" ? undefined : count(value, 1, 1, 365);
|
|
278
|
+
const cleanWhen = {
|
|
279
|
+
...RELAY_FEEDBACK_KINDS.includes(when.kind) ? { kind: when.kind } : {},
|
|
280
|
+
...words(when.words).length ? { words: words(when.words) } : {},
|
|
281
|
+
...typeof when.images === "boolean" ? { images: when.images } : {},
|
|
282
|
+
...days(when.newAccount) ? { newAccount: days(when.newAccount) } : {},
|
|
283
|
+
...days(when.idleDays) ? { idleDays: days(when.idleDays) } : {},
|
|
284
|
+
...words(when.tag, 1)[0] ? { tag: words(when.tag, 1)[0] } : {},
|
|
285
|
+
...typeof when.package === "boolean" ? { package: when.package } : {},
|
|
286
|
+
...when.plus !== undefined && when.plus !== null && when.plus !== "" ? { plus: count(when.plus, 1, 1, 1e5) } : {}
|
|
287
|
+
};
|
|
288
|
+
const reply = String((_c = then.reply) !== null && _c !== undefined ? _c : "").trim().slice(0, RELAY_FEEDBACK_LIMITS.reply);
|
|
289
|
+
const cleanThen = {
|
|
290
|
+
...words(then.tags, 10).length ? { tags: words(then.tags, 10) } : {},
|
|
291
|
+
...mode(then.mode) ? { mode: mode(then.mode) } : {},
|
|
292
|
+
...RELAY_FEEDBACK_STATUSES.includes(then.status) ? { status: then.status } : {},
|
|
293
|
+
...reply ? { reply } : {},
|
|
294
|
+
...then.notify === true ? { notify: true } : {},
|
|
295
|
+
...then.public === true ? { public: true } : {}
|
|
296
|
+
};
|
|
297
|
+
if (!Object.keys(cleanThen).length) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const safeId = String((_d = given === null || given === undefined ? undefined : given.id) !== null && _d !== undefined ? _d : "").replace(/[^\w-]/g, "").slice(0, 24) || id;
|
|
301
|
+
return { id: safeId, on: (given === null || given === undefined ? undefined : given.on) !== false, when: cleanWhen, does: cleanThen, ...(given === null || given === undefined ? undefined : given.stop) ? { stop: true } : {} };
|
|
302
|
+
}
|
|
303
|
+
RelayFeedbackPolicyUtil2.rule = rule;
|
|
304
|
+
function board(given, base = RELAY_FEEDBACK_BOARD_POLICY) {
|
|
305
|
+
return {
|
|
306
|
+
halfLifeDays: count(given === null || given === undefined ? undefined : given.halfLifeDays, base.halfLifeDays, 1, 365),
|
|
307
|
+
archiveDoneDays: count(given === null || given === undefined ? undefined : given.archiveDoneDays, base.archiveDoneDays, 0, 365),
|
|
308
|
+
archiveIdleDays: count(given === null || given === undefined ? undefined : given.archiveIdleDays, base.archiveIdleDays, 0, 365),
|
|
309
|
+
votesDaily: count(given === null || given === undefined ? undefined : given.votesDaily, base.votesDaily, 1, 1e4),
|
|
310
|
+
commentCooldownSeconds: count(given === null || given === undefined ? undefined : given.commentCooldownSeconds, base.commentCooldownSeconds, 0, 3600),
|
|
311
|
+
commentsDaily: count(given === null || given === undefined ? undefined : given.commentsDaily, base.commentsDaily, 1, 500),
|
|
312
|
+
commentNewHours: count(given === null || given === undefined ? undefined : given.commentNewHours, base.commentNewHours, 0, 720),
|
|
313
|
+
breakerHourly: count(given === null || given === undefined ? undefined : given.breakerHourly, base.breakerHourly, 0, 1e4),
|
|
314
|
+
sourceCap: count(given === null || given === undefined ? undefined : given.sourceCap, base.sourceCap, 0, 1000)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
RelayFeedbackPolicyUtil2.board = board;
|
|
318
|
+
function slow(given) {
|
|
319
|
+
const seconds = (given === null || given === undefined ? undefined : given.seconds) ? count(given.seconds, 60, 10, 6 * 3600) : undefined;
|
|
320
|
+
const until = (given === null || given === undefined ? undefined : given.until) ? Math.round(Number(given.until)) || undefined : undefined;
|
|
321
|
+
return seconds || (given === null || given === undefined ? undefined : given.only) ? { ...seconds ? { seconds } : {}, ...(given === null || given === undefined ? undefined : given.only) ? { only: true } : {}, ...until ? { until } : {} } : undefined;
|
|
322
|
+
}
|
|
323
|
+
RelayFeedbackPolicyUtil2.slow = slow;
|
|
324
|
+
function of(given, base = RELAY_FEEDBACK_POLICY) {
|
|
325
|
+
return {
|
|
326
|
+
on: typeof (given === null || given === undefined ? undefined : given.on) === "boolean" ? given.on : base.on,
|
|
327
|
+
cooldownMinutes: count(given === null || given === undefined ? undefined : given.cooldownMinutes, base.cooldownMinutes, 0, 24 * 60),
|
|
328
|
+
daily: count(given === null || given === undefined ? undefined : given.daily, base.daily, 1, 100),
|
|
329
|
+
open: count(given === null || given === undefined ? undefined : given.open, base.open, 1, 100),
|
|
330
|
+
newDays: count(given === null || given === undefined ? undefined : given.newDays, base.newDays, 0, 90),
|
|
331
|
+
imageDays: count(given === null || given === undefined ? undefined : given.imageDays, base.imageDays, 0, 90)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
RelayFeedbackPolicyUtil2.of = of;
|
|
335
|
+
})(RelayFeedbackPolicyUtil || (RelayFeedbackPolicyUtil = {}));
|
|
336
|
+
|
|
337
|
+
// ../ta-relay/esm/common/relay-feedback-rules.js
|
|
338
|
+
var DAY_MS2 = 24 * 60 * 60 * 1000;
|
|
339
|
+
var KIND_SCORE = { bug: 1, wish: 0.5 };
|
|
340
|
+
var WAIT_SCORE = 2;
|
|
341
|
+
var WAIT_FULL_DAYS = 14;
|
|
342
|
+
var RelayFeedbackRuleUtil;
|
|
343
|
+
(function(RelayFeedbackRuleUtil2) {
|
|
344
|
+
function matches(item, when, now) {
|
|
345
|
+
var _a, _b;
|
|
346
|
+
var _c, _d;
|
|
347
|
+
if (when.kind && item.kind !== when.kind) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
if ((_a = when.words) === null || _a === undefined ? undefined : _a.length) {
|
|
351
|
+
const text = `${item.title}
|
|
352
|
+
${item.body}`.toLowerCase();
|
|
353
|
+
if (!when.words.some((word) => text.includes(word.toLowerCase()))) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (when.images !== undefined && ((_c = item.shots) !== null && _c !== undefined ? _c : item.images) > 0 !== when.images) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
if (when.newAccount && !(item.since !== undefined && item.at - item.since < when.newAccount * DAY_MS2)) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
if (when.idleDays && (RELAY_FEEDBACK_CLOSED.includes(item.status) || now - item.updatedAt < when.idleDays * DAY_MS2)) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
if (when.package !== undefined && !!item.package !== when.package) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
if (when.plus && ((_d = item.plus) !== null && _d !== undefined ? _d : 0) < when.plus) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
return !when.tag || !!((_b = item.tags) === null || _b === undefined ? undefined : _b.includes(when.tag));
|
|
373
|
+
}
|
|
374
|
+
RelayFeedbackRuleUtil2.matches = matches;
|
|
375
|
+
function queue(items, pace, now, halfLifeDays = 30) {
|
|
376
|
+
const score = (item) => RelayFeedbackScore.votes(item, now, halfLifeDays) + KIND_SCORE[item.kind] + Math.min((now - item.at) / (WAIT_FULL_DAYS * DAY_MS2), 1) * WAIT_SCORE;
|
|
377
|
+
const rush = (item) => {
|
|
378
|
+
var _a;
|
|
379
|
+
return ((_a = item.tags) !== null && _a !== undefined ? _a : []).some((tag) => pace.rush.includes(tag));
|
|
380
|
+
};
|
|
381
|
+
return items.filter((item) => {
|
|
382
|
+
var _a;
|
|
383
|
+
return (item.status === "new" || item.status === "planned") && !item.taken && !item.archived && !item.held && ((_a = item.mode) !== null && _a !== undefined ? _a : pace.mode) !== "human";
|
|
384
|
+
}).sort((a, b) => Number(rush(b)) - Number(rush(a)) || score(b) - score(a) || a.at - b.at || a.n - b.n).map((item) => item.id);
|
|
385
|
+
}
|
|
386
|
+
RelayFeedbackRuleUtil2.queue = queue;
|
|
387
|
+
function does(item, then, now) {
|
|
388
|
+
var _a, _b;
|
|
389
|
+
const did = [];
|
|
390
|
+
const tags = ((_a = then.tags) !== null && _a !== undefined ? _a : []).filter((tag) => {
|
|
391
|
+
var _a2;
|
|
392
|
+
return !((_a2 = item.tags) === null || _a2 === undefined ? undefined : _a2.includes(tag));
|
|
393
|
+
});
|
|
394
|
+
if (tags.length) {
|
|
395
|
+
item.tags = [...(_b = item.tags) !== null && _b !== undefined ? _b : [], ...tags].slice(0, 10);
|
|
396
|
+
did.push(...tags.map((tag) => `tag:${tag}`));
|
|
397
|
+
}
|
|
398
|
+
if (then.mode && item.mode !== then.mode) {
|
|
399
|
+
item.mode = then.mode;
|
|
400
|
+
did.push(`mode:${then.mode}`);
|
|
401
|
+
}
|
|
402
|
+
const status = then.status && item.status !== then.status ? then.status : undefined;
|
|
403
|
+
if (status) {
|
|
404
|
+
did.push(`status:${status}`);
|
|
405
|
+
}
|
|
406
|
+
const replyAt = then.reply ? reply(item, then.reply.split("{n}").join(String(item.n)).split("{title}").join(item.title), now) : undefined;
|
|
407
|
+
if (replyAt) {
|
|
408
|
+
did.push("reply");
|
|
409
|
+
}
|
|
410
|
+
if (then.notify) {
|
|
411
|
+
item.flagged = now;
|
|
412
|
+
did.push("notify");
|
|
413
|
+
}
|
|
414
|
+
if (then.public && !item.public) {
|
|
415
|
+
item.public = true;
|
|
416
|
+
did.push("public:on");
|
|
417
|
+
}
|
|
418
|
+
return { did, ...replyAt ? { replyAt } : {}, ...status ? { status } : {} };
|
|
419
|
+
}
|
|
420
|
+
RelayFeedbackRuleUtil2.does = does;
|
|
421
|
+
function reply(item, text, now) {
|
|
422
|
+
var _a;
|
|
423
|
+
var _b;
|
|
424
|
+
const at = Math.max(now, ((_b = (_a = item.replies[item.replies.length - 1]) === null || _a === undefined ? undefined : _a.at) !== null && _b !== undefined ? _b : 0) + 1);
|
|
425
|
+
item.replies = [...item.replies, { at, text }].slice(-50);
|
|
426
|
+
item.updatedAt = at;
|
|
427
|
+
return at;
|
|
428
|
+
}
|
|
429
|
+
RelayFeedbackRuleUtil2.reply = reply;
|
|
430
|
+
function before(item) {
|
|
431
|
+
return {
|
|
432
|
+
status: item.status,
|
|
433
|
+
...item.tags ? { tags: [...item.tags] } : {},
|
|
434
|
+
...item.mode ? { mode: item.mode } : {},
|
|
435
|
+
...item.taken ? { taken: item.taken } : {},
|
|
436
|
+
...item.flagged ? { flagged: item.flagged } : {},
|
|
437
|
+
...item.public ? { public: true } : {},
|
|
438
|
+
...item.archived ? { archived: item.archived } : {},
|
|
439
|
+
...item.held ? { held: item.held } : {}
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
RelayFeedbackRuleUtil2.before = before;
|
|
443
|
+
})(RelayFeedbackRuleUtil || (RelayFeedbackRuleUtil = {}));
|
|
444
|
+
|
|
445
|
+
// ../ta-relay/esm/common/relay-feedback-board.js
|
|
446
|
+
var DAY_MS3 = 24 * 60 * 60 * 1000;
|
|
447
|
+
var HOUR_MS2 = 60 * 60 * 1000;
|
|
448
|
+
|
|
449
|
+
// ../ta-relay/esm/common/relay-feedback-shelf.js
|
|
450
|
+
var PATHS = new Set([
|
|
451
|
+
RELAY_FEEDBACK_PACKAGE_PATH,
|
|
452
|
+
RELAY_FEEDBACK_INBOX_PACKAGE_PATH,
|
|
453
|
+
RELAY_FEEDBACK_CATALOG_PATH,
|
|
454
|
+
RELAY_FEEDBACK_CATALOG_PACKAGE_PATH
|
|
455
|
+
]);
|
|
456
|
+
|
|
457
|
+
// ../ta-relay/esm/common/relay-feedback.js
|
|
458
|
+
var DAY_MS4 = 24 * 60 * 60 * 1000;
|
|
459
|
+
var HOUR_MS3 = 60 * 60 * 1000;
|
|
460
|
+
|
|
461
|
+
// ../ta-relay/esm/common/relay-moderation-policy.js
|
|
462
|
+
var RELAY_OUTWARD_FEATURES = ["share", "rooms", "moments", "nearby"];
|
|
463
|
+
var RELAY_MODERATION_POLICY = {
|
|
464
|
+
auto: false,
|
|
465
|
+
people: 3,
|
|
466
|
+
severe: 2,
|
|
467
|
+
hostAfter: 3,
|
|
468
|
+
limitDays: 7,
|
|
469
|
+
needsAccount: [],
|
|
470
|
+
banCovers: ["share", "rooms", "moments", "nearby"],
|
|
471
|
+
newDays: 7,
|
|
472
|
+
newDaily: 5
|
|
473
|
+
};
|
|
474
|
+
var RELAY_BIND_PATH = "/v1/bind";
|
|
475
|
+
var RELAY_STANDING_PATH = "/v1/standing";
|
|
476
|
+
var RELAY_APPEAL_PATH = "/v1/appeal";
|
|
477
|
+
var RELAY_TICKET_PATH = "/v1/ticket";
|
|
478
|
+
var RELAY_QUOTA_PATH = "/v1/quota";
|
|
479
|
+
var RELAY_TICKET_MS = 60 * 60 * 1000;
|
|
480
|
+
var RelayModerationPolicyUtil;
|
|
481
|
+
(function(RelayModerationPolicyUtil2) {
|
|
482
|
+
function count(value, fallback, min, max = 100) {
|
|
483
|
+
const n = Math.round(Number(value));
|
|
484
|
+
return Number.isFinite(n) && n >= min ? Math.min(n, max) : fallback;
|
|
485
|
+
}
|
|
486
|
+
function features(value, fallback) {
|
|
487
|
+
return Array.isArray(value) ? RELAY_OUTWARD_FEATURES.filter((feature) => value.includes(feature)) : fallback;
|
|
488
|
+
}
|
|
489
|
+
function of(given) {
|
|
490
|
+
const base = RELAY_MODERATION_POLICY;
|
|
491
|
+
return {
|
|
492
|
+
auto: (given === null || given === undefined ? undefined : given.auto) === true,
|
|
493
|
+
people: count(given === null || given === undefined ? undefined : given.people, base.people, 1),
|
|
494
|
+
severe: count(given === null || given === undefined ? undefined : given.severe, base.severe, 1),
|
|
495
|
+
hostAfter: count(given === null || given === undefined ? undefined : given.hostAfter, base.hostAfter, 0),
|
|
496
|
+
limitDays: count(given === null || given === undefined ? undefined : given.limitDays, base.limitDays, 1, 30),
|
|
497
|
+
needsAccount: features(given === null || given === undefined ? undefined : given.needsAccount, base.needsAccount),
|
|
498
|
+
banCovers: features(given === null || given === undefined ? undefined : given.banCovers, base.banCovers),
|
|
499
|
+
newDays: count(given === null || given === undefined ? undefined : given.newDays, base.newDays, 0, 90),
|
|
500
|
+
newDaily: count(given === null || given === undefined ? undefined : given.newDaily, base.newDaily, 1, 1000)
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
RelayModerationPolicyUtil2.of = of;
|
|
504
|
+
function active(sanction, now) {
|
|
505
|
+
return !!sanction && (sanction.until === undefined || sanction.until > now);
|
|
506
|
+
}
|
|
507
|
+
RelayModerationPolicyUtil2.active = active;
|
|
508
|
+
function takes(sanction, feature, policy, now) {
|
|
509
|
+
if (!active(sanction, now)) {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
return sanction.level === "limit" ? feature === "share" : policy.banCovers.includes(feature);
|
|
513
|
+
}
|
|
514
|
+
RelayModerationPolicyUtil2.takes = takes;
|
|
515
|
+
})(RelayModerationPolicyUtil || (RelayModerationPolicyUtil = {}));
|
|
516
|
+
|
|
517
|
+
// ../ta-relay/esm/common/relay-moderation-tickets.js
|
|
518
|
+
var encoder = new TextEncoder;
|
|
519
|
+
|
|
520
|
+
// ../ta-relay/esm/common/relay-moderation-trust.js
|
|
521
|
+
var DAY_MS5 = 24 * 60 * 60 * 1000;
|
|
522
|
+
|
|
523
|
+
// ../ta-relay/esm/common/relay-moderation-types.js
|
|
524
|
+
var RELAY_MODERATION_PATH = "/v1/moderation";
|
|
525
|
+
var RELAY_REPORT_REASONS = ["phishing", "malware", "sexual", "illegal", "harassment", "other"];
|
|
526
|
+
|
|
44
527
|
// ../ta-relay/esm/common/relay-protocol.js
|
|
45
528
|
var RELAY_CONNECT_PATH = "/v1/connect/";
|
|
46
529
|
var RELAY_PAIR_PATH = "/pair";
|
|
@@ -83,7 +566,7 @@ var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
|
|
|
83
566
|
var RELAY_HUB_LOG_CHARS = 4 * 1024 * 1024;
|
|
84
567
|
|
|
85
568
|
// ../ta-relay/esm/common/relay-identity.js
|
|
86
|
-
var
|
|
569
|
+
var encoder2 = new TextEncoder;
|
|
87
570
|
var decoder = new TextDecoder;
|
|
88
571
|
var subtle = () => globalThis.crypto.subtle;
|
|
89
572
|
var SIGN = { name: "ECDSA", namedCurve: "P-256" };
|
|
@@ -93,12 +576,12 @@ var RelayKeys;
|
|
|
93
576
|
(function(RelayKeys2) {
|
|
94
577
|
async function hkdf(key, salt, info) {
|
|
95
578
|
const secret = await subtle().importKey("raw", key, "HKDF", false, ["deriveBits"]);
|
|
96
|
-
const bits = await subtle().deriveBits({ name: "HKDF", hash: "SHA-256", salt, info:
|
|
579
|
+
const bits = await subtle().deriveBits({ name: "HKDF", hash: "SHA-256", salt, info: encoder2.encode(info) }, secret, 256);
|
|
97
580
|
return new Uint8Array(bits);
|
|
98
581
|
}
|
|
99
582
|
RelayKeys2.hkdf = hkdf;
|
|
100
583
|
async function sha256(bytes) {
|
|
101
|
-
const data = typeof bytes === "string" ?
|
|
584
|
+
const data = typeof bytes === "string" ? encoder2.encode(bytes) : bytes;
|
|
102
585
|
return new Uint8Array(await subtle().digest("SHA-256", data));
|
|
103
586
|
}
|
|
104
587
|
RelayKeys2.sha256 = sha256;
|
|
@@ -108,7 +591,7 @@ var RelayKeys;
|
|
|
108
591
|
RelayKeys2.hash = hash;
|
|
109
592
|
async function hmac(key, text) {
|
|
110
593
|
const imported = await subtle().importKey("raw", key, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
111
|
-
return RelayBytes.toBase64(new Uint8Array(await subtle().sign("HMAC", imported,
|
|
594
|
+
return RelayBytes.toBase64(new Uint8Array(await subtle().sign("HMAC", imported, encoder2.encode(text))));
|
|
112
595
|
}
|
|
113
596
|
RelayKeys2.hmac = hmac;
|
|
114
597
|
function aesKey(key) {
|
|
@@ -117,7 +600,7 @@ var RelayKeys;
|
|
|
117
600
|
RelayKeys2.aesKey = aesKey;
|
|
118
601
|
async function seal(key, text) {
|
|
119
602
|
const iv = RelayBytes.random(12);
|
|
120
|
-
const sealed = await subtle().encrypt({ name: "AES-GCM", iv }, key,
|
|
603
|
+
const sealed = await subtle().encrypt({ name: "AES-GCM", iv }, key, encoder2.encode(text));
|
|
121
604
|
return RelayBytes.toBase64(RelayBytes.concat(iv, new Uint8Array(sealed)));
|
|
122
605
|
}
|
|
123
606
|
RelayKeys2.seal = seal;
|
|
@@ -182,12 +665,12 @@ var RelayIdentityUtil;
|
|
|
182
665
|
RelayIdentityUtil2.withLook = withLook;
|
|
183
666
|
async function sign(identity, text) {
|
|
184
667
|
const key = await subtle().importKey("jwk", identity.signKey, SIGN, false, ["sign"]);
|
|
185
|
-
return RelayBytes.toBase64(new Uint8Array(await subtle().sign(SIGNATURE, key,
|
|
668
|
+
return RelayBytes.toBase64(new Uint8Array(await subtle().sign(SIGNATURE, key, encoder2.encode(text))));
|
|
186
669
|
}
|
|
187
670
|
RelayIdentityUtil2.sign = sign;
|
|
188
671
|
async function verify(signPublic, text, signature) {
|
|
189
672
|
try {
|
|
190
|
-
return await subtle().verify(SIGNATURE, await importSign(signPublic), RelayBytes.fromBase64(signature),
|
|
673
|
+
return await subtle().verify(SIGNATURE, await importSign(signPublic), RelayBytes.fromBase64(signature), encoder2.encode(text));
|
|
191
674
|
} catch (_a) {
|
|
192
675
|
return false;
|
|
193
676
|
}
|
|
@@ -196,7 +679,7 @@ var RelayIdentityUtil;
|
|
|
196
679
|
async function agree(identity, otherBox, salt, info) {
|
|
197
680
|
const own = await subtle().importKey("jwk", identity.boxKey, BOX, false, ["deriveBits"]);
|
|
198
681
|
const shared = await subtle().deriveBits({ name: "ECDH", public: await importBox(otherBox) }, own, 256);
|
|
199
|
-
return RelayKeys.hkdf(new Uint8Array(shared),
|
|
682
|
+
return RelayKeys.hkdf(new Uint8Array(shared), encoder2.encode(salt), info);
|
|
200
683
|
}
|
|
201
684
|
RelayIdentityUtil2.agree = agree;
|
|
202
685
|
function importSign(raw) {
|
|
@@ -208,7 +691,7 @@ var RelayIdentityUtil;
|
|
|
208
691
|
})(RelayIdentityUtil || (RelayIdentityUtil = {}));
|
|
209
692
|
|
|
210
693
|
// ../ta-relay/esm/common/relay-cipher.js
|
|
211
|
-
var
|
|
694
|
+
var encoder3 = new TextEncoder;
|
|
212
695
|
var decoder2 = new TextDecoder;
|
|
213
696
|
var IV_LENGTH = 12;
|
|
214
697
|
var PLAIN = 0;
|
|
@@ -229,7 +712,7 @@ class RelayCipher {
|
|
|
229
712
|
const subtle2 = globalThis.crypto.subtle;
|
|
230
713
|
const secret = await subtle2.importKey("raw", deviceKey, "HKDF", false, ["deriveKey"]);
|
|
231
714
|
const salt = RelayBytes.concat(clientNonce, hostNonce);
|
|
232
|
-
const key = (direction) => subtle2.deriveKey({ name: "HKDF", hash: "SHA-256", salt, info:
|
|
715
|
+
const key = (direction) => subtle2.deriveKey({ name: "HKDF", hash: "SHA-256", salt, info: encoder3.encode(`ta-relay/1 ${direction}`) }, secret, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
233
716
|
const [toHost, toClient] = await Promise.all([key("client-to-host"), key("host-to-client")]);
|
|
234
717
|
return side === "client" ? new RelayCipher(toHost, toClient) : new RelayCipher(toClient, toHost);
|
|
235
718
|
}
|
|
@@ -256,7 +739,7 @@ class RelayCipher {
|
|
|
256
739
|
return opened;
|
|
257
740
|
}
|
|
258
741
|
async pack(text) {
|
|
259
|
-
const bytes =
|
|
742
|
+
const bytes = encoder3.encode(text);
|
|
260
743
|
if (!this.compress) {
|
|
261
744
|
return bytes;
|
|
262
745
|
}
|
|
@@ -484,7 +967,7 @@ RelaySocket.CLOSED = CLOSED;
|
|
|
484
967
|
RelaySocket.REFUSED = 4403;
|
|
485
968
|
|
|
486
969
|
// ../ta-relay/esm/common/relay-content.js
|
|
487
|
-
var
|
|
970
|
+
var encoder4 = new TextEncoder;
|
|
488
971
|
var decoder3 = new TextDecoder;
|
|
489
972
|
|
|
490
973
|
class RelayContentError extends Error {
|
|
@@ -566,8 +1049,8 @@ var RelayContentUtil;
|
|
|
566
1049
|
return linkKey;
|
|
567
1050
|
}
|
|
568
1051
|
const subtle2 = globalThis.crypto.subtle;
|
|
569
|
-
const secret = await subtle2.importKey("raw",
|
|
570
|
-
const stretched = await subtle2.deriveBits({ name: "PBKDF2", hash: "SHA-256", salt:
|
|
1052
|
+
const secret = await subtle2.importKey("raw", encoder4.encode(password.normalize("NFC")), "PBKDF2", false, ["deriveBits"]);
|
|
1053
|
+
const stretched = await subtle2.deriveBits({ name: "PBKDF2", hash: "SHA-256", salt: encoder4.encode(`ta-share:${share}`), iterations: PBKDF2_ITERATIONS }, secret, 256);
|
|
571
1054
|
return hkdf(linkKey, new Uint8Array(stretched), "ta-share/1 password");
|
|
572
1055
|
}
|
|
573
1056
|
RelayContentUtil2.contentKey = contentKey;
|
|
@@ -580,7 +1063,7 @@ var RelayContentUtil;
|
|
|
580
1063
|
}
|
|
581
1064
|
RelayContentUtil2.authToken = authToken;
|
|
582
1065
|
async function sha256(text) {
|
|
583
|
-
return RelayBytes.toBase64(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",
|
|
1066
|
+
return RelayBytes.toBase64(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", encoder4.encode(text))));
|
|
584
1067
|
}
|
|
585
1068
|
RelayContentUtil2.sha256 = sha256;
|
|
586
1069
|
async function seal(key, item) {
|
|
@@ -596,7 +1079,7 @@ var RelayContentUtil;
|
|
|
596
1079
|
RelayContentUtil2.open = open;
|
|
597
1080
|
function encode(item) {
|
|
598
1081
|
const { data, ...header } = item;
|
|
599
|
-
const head =
|
|
1082
|
+
const head = encoder4.encode(JSON.stringify(header));
|
|
600
1083
|
const length = new Uint8Array(4);
|
|
601
1084
|
new DataView(length.buffer).setUint32(0, head.length);
|
|
602
1085
|
return RelayBytes.concat(length, head, data);
|
|
@@ -756,7 +1239,7 @@ var RelayContentUtil;
|
|
|
756
1239
|
async function hkdf(key, salt, info) {
|
|
757
1240
|
const subtle2 = globalThis.crypto.subtle;
|
|
758
1241
|
const secret = await subtle2.importKey("raw", key, "HKDF", false, ["deriveBits"]);
|
|
759
|
-
const bits = await subtle2.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info:
|
|
1242
|
+
const bits = await subtle2.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info: encoder4.encode(info) }, secret, 256);
|
|
760
1243
|
return new Uint8Array(bits);
|
|
761
1244
|
}
|
|
762
1245
|
})(RelayContentUtil || (RelayContentUtil = {}));
|
|
@@ -795,60 +1278,37 @@ var RelayContentHandoff;
|
|
|
795
1278
|
RelayContentHandoff2.take = take;
|
|
796
1279
|
})(RelayContentHandoff || (RelayContentHandoff = {}));
|
|
797
1280
|
|
|
798
|
-
// ../ta-relay/esm/common/relay-
|
|
799
|
-
var
|
|
800
|
-
var
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
var RELAY_STANDING_PATH = "/v1/standing";
|
|
811
|
-
var RELAY_APPEAL_PATH = "/v1/appeal";
|
|
812
|
-
var RelayModerationPolicyUtil;
|
|
813
|
-
(function(RelayModerationPolicyUtil2) {
|
|
814
|
-
function count(value, fallback, min, max = 100) {
|
|
815
|
-
const n = Math.round(Number(value));
|
|
816
|
-
return Number.isFinite(n) && n >= min ? Math.min(n, max) : fallback;
|
|
817
|
-
}
|
|
818
|
-
function features(value, fallback) {
|
|
819
|
-
return Array.isArray(value) ? RELAY_OUTWARD_FEATURES.filter((feature) => value.includes(feature)) : fallback;
|
|
820
|
-
}
|
|
821
|
-
function of(given) {
|
|
822
|
-
const base = RELAY_MODERATION_POLICY;
|
|
823
|
-
return {
|
|
824
|
-
auto: (given === null || given === undefined ? undefined : given.auto) === true,
|
|
825
|
-
people: count(given === null || given === undefined ? undefined : given.people, base.people, 1),
|
|
826
|
-
severe: count(given === null || given === undefined ? undefined : given.severe, base.severe, 1),
|
|
827
|
-
hostAfter: count(given === null || given === undefined ? undefined : given.hostAfter, base.hostAfter, 0),
|
|
828
|
-
limitDays: count(given === null || given === undefined ? undefined : given.limitDays, base.limitDays, 1, 30),
|
|
829
|
-
needsAccount: features(given === null || given === undefined ? undefined : given.needsAccount, base.needsAccount),
|
|
830
|
-
banCovers: features(given === null || given === undefined ? undefined : given.banCovers, base.banCovers)
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
RelayModerationPolicyUtil2.of = of;
|
|
834
|
-
function active(sanction, now) {
|
|
835
|
-
return !!sanction && (sanction.until === undefined || sanction.until > now);
|
|
1281
|
+
// ../ta-relay/esm/common/relay-report.js
|
|
1282
|
+
var MAX_NOTE = 500;
|
|
1283
|
+
var RelayReportUtil;
|
|
1284
|
+
(function(RelayReportUtil2) {
|
|
1285
|
+
function parse(value) {
|
|
1286
|
+
const given = value;
|
|
1287
|
+
if (!given || typeof given.host !== "string" || typeof given.share !== "string" || !RELAY_ID.test(given.host) || !RELAY_ID.test(given.share) || !RELAY_REPORT_REASONS.includes(given.reason)) {
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
const note = typeof given.note === "string" ? given.note.trim().slice(0, MAX_NOTE) : "";
|
|
1291
|
+
const link = linkOf(given.link, given.host, given.share);
|
|
1292
|
+
return { host: given.host, share: given.share, reason: given.reason, ...note ? { note } : {}, ...link ? { link } : {} };
|
|
836
1293
|
}
|
|
837
|
-
|
|
838
|
-
function
|
|
839
|
-
if (
|
|
840
|
-
return
|
|
1294
|
+
RelayReportUtil2.parse = parse;
|
|
1295
|
+
function linkOf(value, host, share) {
|
|
1296
|
+
if (typeof value !== "string" || value.length > 2048) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
try {
|
|
1300
|
+
const link = RelayContentUtil.parse(value);
|
|
1301
|
+
return link.host === host && link.share === share && link.access !== "self" && link.access !== "people" ? value.trim() : undefined;
|
|
1302
|
+
} catch (_a) {
|
|
1303
|
+
return;
|
|
841
1304
|
}
|
|
842
|
-
return sanction.level === "limit" ? feature === "share" : policy.banCovers.includes(feature);
|
|
843
1305
|
}
|
|
844
|
-
|
|
845
|
-
})(
|
|
1306
|
+
RelayReportUtil2.linkOf = linkOf;
|
|
1307
|
+
})(RelayReportUtil || (RelayReportUtil = {}));
|
|
846
1308
|
|
|
847
1309
|
// ../ta-relay/esm/common/relay-moderation.js
|
|
848
|
-
var
|
|
849
|
-
var
|
|
850
|
-
var HOUR_MS = 60 * 60 * 1000;
|
|
851
|
-
var DAY_MS = 24 * HOUR_MS;
|
|
1310
|
+
var HOUR_MS4 = 60 * 60 * 1000;
|
|
1311
|
+
var DAY_MS6 = 24 * HOUR_MS4;
|
|
852
1312
|
|
|
853
1313
|
// ../ta-relay/esm/common/relay-moderation-client.js
|
|
854
1314
|
async function call(url, token, init) {
|
|
@@ -866,6 +1326,9 @@ async function call(url, token, init) {
|
|
|
866
1326
|
if (response.status === 404) {
|
|
867
1327
|
throw new Error("This relay does not answer it.");
|
|
868
1328
|
}
|
|
1329
|
+
if (response.status === 429) {
|
|
1330
|
+
throw new Error("429: past the quota of today.");
|
|
1331
|
+
}
|
|
869
1332
|
if (!response.ok || !body) {
|
|
870
1333
|
throw new Error((_b = body === null || body === undefined ? undefined : body.error) !== null && _b !== undefined ? _b : `The relay answered ${response.status}.`);
|
|
871
1334
|
}
|
|
@@ -893,6 +1356,14 @@ var RelayStandingClient;
|
|
|
893
1356
|
return call(`${base(relay)}${RELAY_STANDING_PATH}`, token);
|
|
894
1357
|
}
|
|
895
1358
|
RelayStandingClient2.standing = standing;
|
|
1359
|
+
function ticket(relay, token) {
|
|
1360
|
+
return call(`${base(relay)}${RELAY_TICKET_PATH}`, token, { method: "POST", body: "{}" });
|
|
1361
|
+
}
|
|
1362
|
+
RelayStandingClient2.ticket = ticket;
|
|
1363
|
+
function quota(relay, token) {
|
|
1364
|
+
return call(`${base(relay)}${RELAY_QUOTA_PATH}`, token, { method: "POST", body: "{}" });
|
|
1365
|
+
}
|
|
1366
|
+
RelayStandingClient2.quota = quota;
|
|
896
1367
|
function appeal(relay, token, text) {
|
|
897
1368
|
return call(`${base(relay)}${RELAY_APPEAL_PATH}`, token, { method: "POST", body: JSON.stringify({ text }) });
|
|
898
1369
|
}
|
|
@@ -2297,7 +2768,7 @@ var ConversationImport;
|
|
|
2297
2768
|
})(ConversationImport ||= {});
|
|
2298
2769
|
|
|
2299
2770
|
// web-src/share-service.ts
|
|
2300
|
-
var
|
|
2771
|
+
var encoder5 = new TextEncoder;
|
|
2301
2772
|
var decoder4 = new TextDecoder;
|
|
2302
2773
|
var PICTURE_TYPES = {
|
|
2303
2774
|
png: "image/png",
|
|
@@ -2380,7 +2851,7 @@ class ShareService {
|
|
|
2380
2851
|
kind: CONVERSATION_KIND,
|
|
2381
2852
|
title: conversation.title,
|
|
2382
2853
|
type: "application/json",
|
|
2383
|
-
data:
|
|
2854
|
+
data: encoder5.encode(JSON.stringify(conversation)),
|
|
2384
2855
|
...ShareService.input(options)
|
|
2385
2856
|
});
|
|
2386
2857
|
return { share, stats };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-share",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.0",
|
|
4
4
|
"description": "A pi package for Ta: share a conversation, a page or a file by a link, public, with a password or for yourself, end to end through the relay; open and import what others share",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@celljs/ta-protocol": "4.
|
|
31
|
-
"@celljs/ta-relay": "4.
|
|
32
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.27.0",
|
|
31
|
+
"@celljs/ta-relay": "4.27.0",
|
|
32
|
+
"@celljs/ta-web": "4.27.0",
|
|
33
33
|
"@types/react": "^19.3.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -99,6 +99,7 @@ var EN = {
|
|
|
99
99
|
linkReadyFile: "Scan with the Ta app or a phone camera, or send the link. A browser shows it or downloads it.",
|
|
100
100
|
emptyTitle: "Nothing shared yet",
|
|
101
101
|
emptyHint: "Choose Share conversation… in the + of a message box, or ask Ta to make a link of a file.",
|
|
102
|
+
linksTitle: "Shared links",
|
|
102
103
|
servicesTitle: "Services of this computer",
|
|
103
104
|
servicesSwitch: "Allow public links",
|
|
104
105
|
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.",
|
|
@@ -160,6 +161,12 @@ var EN = {
|
|
|
160
161
|
rulesTitle: "Rules",
|
|
161
162
|
rulesAuto: "Act by the rules",
|
|
162
163
|
rulesAutoHint: "They stop a link, and limit its owner at most; banning stays yours. What you undo they leave be.",
|
|
164
|
+
newTitle: "New accounts",
|
|
165
|
+
newHint: "For their first days on the relay, an account makes only a few public links a day: one made to spam stops soon.",
|
|
166
|
+
newDays: "Days an account is new (0: no limit)",
|
|
167
|
+
newDaily: "Public links a day",
|
|
168
|
+
doubtful: "{n} doubtful reporters not counted",
|
|
169
|
+
ruleTrustHint: "Reporters you keep dismissing (3 times or more, twice as often as upheld) no longer count.",
|
|
163
170
|
rulePeople: "People reporting a link",
|
|
164
171
|
ruleSevere: "For phishing or malware",
|
|
165
172
|
ruleHostAfter: "Links stopped, to limit their owner",
|
|
@@ -169,9 +176,10 @@ var EN = {
|
|
|
169
176
|
banCoversTitle: "A ban takes away",
|
|
170
177
|
featureShare: "Public links",
|
|
171
178
|
featureRooms: "Group chats",
|
|
172
|
-
featureMoments: "Moments",
|
|
179
|
+
featureMoments: "Friends and Moments",
|
|
173
180
|
featureNearby: "Nearby",
|
|
174
|
-
|
|
181
|
+
needsFor: "Needs an account",
|
|
182
|
+
needsForHint: "Without it, those not signed in can still use it, and a ban does not reach them there.",
|
|
175
183
|
logTitle: "Record",
|
|
176
184
|
logLine: "{who} · {action} · {target}",
|
|
177
185
|
whoRule: "Rules",
|
|
@@ -283,6 +291,7 @@ var ZH = {
|
|
|
283
291
|
linkReadyFile: "用 Ta 应用或手机相机扫码,或者把链接发给对方。浏览器里能直接看或下载。",
|
|
284
292
|
emptyTitle: "还没有分享",
|
|
285
293
|
emptyHint: "在输入框的 + 里选“分享对话…”,或者让 Ta 帮你把文件生成分享链接。",
|
|
294
|
+
linksTitle: "分享的链接",
|
|
286
295
|
servicesTitle: "本机服务",
|
|
287
296
|
servicesSwitch: "允许生成公开链接",
|
|
288
297
|
servicesHint: "让 Ta 把本机端口上的网页或接口临时公开给拿到链接的人,每次都会先问你。公司网络通常禁止这样做。",
|
|
@@ -344,6 +353,12 @@ var ZH = {
|
|
|
344
353
|
rulesTitle: "规则",
|
|
345
354
|
rulesAuto: "按规则自动处理",
|
|
346
355
|
rulesAutoHint: "最多停链接、限制公开分享,封号只能你来;你撤销过的不会再自动处理。",
|
|
356
|
+
newTitle: "新账号",
|
|
357
|
+
newHint: "账号在中继上的头几天,每天只能发几条公开链接,注册来刷的账号很快就停住。",
|
|
358
|
+
newDays: "新账号期(天,0 为不限制)",
|
|
359
|
+
newDaily: "每天最多公开链接",
|
|
360
|
+
doubtful: "另有 {n} 位存疑举报人未计入",
|
|
361
|
+
ruleTrustHint: "举报常被你驳回的人(3 次以上,且是被采纳次数的两倍多)不再计入人数。",
|
|
347
362
|
rulePeople: "多少人举报就停这条链接",
|
|
348
363
|
ruleSevere: "钓鱼或恶意软件",
|
|
349
364
|
ruleHostAfter: "停了几条链接就限制发布者",
|
|
@@ -353,9 +368,10 @@ var ZH = {
|
|
|
353
368
|
banCoversTitle: "封号后不能用",
|
|
354
369
|
featureShare: "公开分享",
|
|
355
370
|
featureRooms: "群聊",
|
|
356
|
-
featureMoments: "
|
|
371
|
+
featureMoments: "加好友与动态",
|
|
357
372
|
featureNearby: "附近",
|
|
358
|
-
|
|
373
|
+
needsFor: "须登录账号",
|
|
374
|
+
needsForHint: "不要求登录时,没登录的人仍能使用,封号也拦不住他们。",
|
|
359
375
|
logTitle: "记录",
|
|
360
376
|
logLine: "{who} · {action} · {target}",
|
|
361
377
|
whoRule: "规则",
|
|
@@ -467,6 +483,7 @@ var ZH_TW = {
|
|
|
467
483
|
linkReadyFile: "用 Ta 應用或手機相機掃碼,或者把連結發給對方。瀏覽器裡能直接看或下載。",
|
|
468
484
|
emptyTitle: "還沒有分享",
|
|
469
485
|
emptyHint: "在輸入框的 + 裡選「分享對話…」,或者讓 Ta 幫你把檔案生成分享連結。",
|
|
486
|
+
linksTitle: "分享的連結",
|
|
470
487
|
servicesTitle: "本機服務",
|
|
471
488
|
servicesSwitch: "允許產生公開連結",
|
|
472
489
|
servicesHint: "讓 Ta 把本機連接埠上的網頁或介面暫時公開給拿到連結的人,每次都會先問你。公司網路通常禁止這樣做。",
|
|
@@ -528,6 +545,12 @@ var ZH_TW = {
|
|
|
528
545
|
rulesTitle: "規則",
|
|
529
546
|
rulesAuto: "依規則自動處理",
|
|
530
547
|
rulesAutoHint: "最多停連結、限制公開分享,封號只能你來;你撤銷過的不會再自動處理。",
|
|
548
|
+
newTitle: "新帳號",
|
|
549
|
+
newHint: "帳號在中繼上的頭幾天,每天只能發幾條公開連結,註冊來洗版的帳號很快就停住。",
|
|
550
|
+
newDays: "新帳號期(天,0 為不限制)",
|
|
551
|
+
newDaily: "每天最多公開連結",
|
|
552
|
+
doubtful: "另有 {n} 位存疑檢舉人未計入",
|
|
553
|
+
ruleTrustHint: "檢舉常被你駁回的人(3 次以上,且是被採納次數的兩倍多)不再計入人數。",
|
|
531
554
|
rulePeople: "多少人檢舉就停這條連結",
|
|
532
555
|
ruleSevere: "釣魚或惡意軟體",
|
|
533
556
|
ruleHostAfter: "停了幾條連結就限制發布者",
|
|
@@ -537,9 +560,10 @@ var ZH_TW = {
|
|
|
537
560
|
banCoversTitle: "封號後不能用",
|
|
538
561
|
featureShare: "公開分享",
|
|
539
562
|
featureRooms: "群聊",
|
|
540
|
-
featureMoments: "
|
|
563
|
+
featureMoments: "加好友與動態",
|
|
541
564
|
featureNearby: "附近",
|
|
542
|
-
|
|
565
|
+
needsFor: "須登入帳號",
|
|
566
|
+
needsForHint: "不要求登入時,沒登入的人仍能使用,封號也攔不住他們。",
|
|
543
567
|
logTitle: "記錄",
|
|
544
568
|
logLine: "{who} · {action} · {target}",
|
|
545
569
|
whoRule: "規則",
|
|
@@ -651,6 +675,7 @@ var JA = {
|
|
|
651
675
|
linkReady: "Ta アプリまたはスマートフォンのカメラで QR コードをスキャンするか、リンクを送信してください。ブラウザで直接表示でき、Ta アプリにインポートできます。",
|
|
652
676
|
emptyTitle: "まだ共有がありません",
|
|
653
677
|
emptyHint: "入力欄の「+」から「会話を共有…」を選択するか、Ta にファイルの共有リンクを作成させてください。",
|
|
678
|
+
linksTitle: "共有したリンク",
|
|
654
679
|
servicesTitle: "このコンピュータのサービス",
|
|
655
680
|
servicesSwitch: "公開リンクを許可",
|
|
656
681
|
servicesHint: "このコンピュータのポートで動く Web ページや API を、リンクを持つ人にしばらく公開できます。毎回確認します。会社のネットワークでは通常禁止されています。",
|
|
@@ -712,6 +737,12 @@ var JA = {
|
|
|
712
737
|
rulesTitle: "ルール",
|
|
713
738
|
rulesAuto: "ルールで自動対応",
|
|
714
739
|
rulesAutoHint: "できるのはリンクの停止と公開共有の制限までで、アカウント停止はあなただけです。取り消したものは再び自動対応しません。",
|
|
740
|
+
newTitle: "新しいアカウント",
|
|
741
|
+
newHint: "リレーでの最初の数日間、アカウントは 1 日に数件しか公開リンクを作れません。スパム用のアカウントはすぐに止まります。",
|
|
742
|
+
newDays: "新規とみなす日数(0 で制限なし)",
|
|
743
|
+
newDaily: "1 日の公開リンクの上限",
|
|
744
|
+
doubtful: "疑わしい報告者 {n} 人は数えていません",
|
|
745
|
+
ruleTrustHint: "あなたがよく却下する報告者(3 回以上、採用の 2 倍を超える)は人数に数えません。",
|
|
715
746
|
rulePeople: "何人が報告したらリンクを止めるか",
|
|
716
747
|
ruleSevere: "フィッシング・マルウェア",
|
|
717
748
|
ruleHostAfter: "何件止めたら投稿者を制限するか",
|
|
@@ -721,9 +752,10 @@ var JA = {
|
|
|
721
752
|
banCoversTitle: "停止すると使えないもの",
|
|
722
753
|
featureShare: "公開共有",
|
|
723
754
|
featureRooms: "グループチャット",
|
|
724
|
-
featureMoments: "
|
|
755
|
+
featureMoments: "友だちとモーメンツ",
|
|
725
756
|
featureNearby: "近く",
|
|
726
|
-
|
|
757
|
+
needsFor: "アカウント必須",
|
|
758
|
+
needsForHint: "必須にしないと、サインインしていない人は使い続けられ、停止も届きません。",
|
|
727
759
|
logTitle: "記録",
|
|
728
760
|
logLine: "{who} · {action} · {target}",
|
|
729
761
|
whoRule: "ルール",
|
|
@@ -879,7 +911,6 @@ function shareLine(share) {
|
|
|
879
911
|
|
|
880
912
|
// ../ta-relay/esm/common/relay-moderation-policy.js
|
|
881
913
|
var RELAY_OUTWARD_FEATURES = ["share", "rooms", "moments", "nearby"];
|
|
882
|
-
var RELAY_ENFORCED_FEATURES = ["share"];
|
|
883
914
|
var RELAY_MODERATION_POLICY = {
|
|
884
915
|
auto: false,
|
|
885
916
|
people: 3,
|
|
@@ -887,8 +918,11 @@ var RELAY_MODERATION_POLICY = {
|
|
|
887
918
|
hostAfter: 3,
|
|
888
919
|
limitDays: 7,
|
|
889
920
|
needsAccount: [],
|
|
890
|
-
banCovers: ["share", "rooms", "moments", "nearby"]
|
|
921
|
+
banCovers: ["share", "rooms", "moments", "nearby"],
|
|
922
|
+
newDays: 7,
|
|
923
|
+
newDaily: 5
|
|
891
924
|
};
|
|
925
|
+
var RELAY_TICKET_MS = 60 * 60 * 1000;
|
|
892
926
|
var RelayModerationPolicyUtil;
|
|
893
927
|
(function(RelayModerationPolicyUtil2) {
|
|
894
928
|
function count(value, fallback, min, max = 100) {
|
|
@@ -907,7 +941,9 @@ var RelayModerationPolicyUtil;
|
|
|
907
941
|
hostAfter: count(given === null || given === undefined ? undefined : given.hostAfter, base.hostAfter, 0),
|
|
908
942
|
limitDays: count(given === null || given === undefined ? undefined : given.limitDays, base.limitDays, 1, 30),
|
|
909
943
|
needsAccount: features(given === null || given === undefined ? undefined : given.needsAccount, base.needsAccount),
|
|
910
|
-
banCovers: features(given === null || given === undefined ? undefined : given.banCovers, base.banCovers)
|
|
944
|
+
banCovers: features(given === null || given === undefined ? undefined : given.banCovers, base.banCovers),
|
|
945
|
+
newDays: count(given === null || given === undefined ? undefined : given.newDays, base.newDays, 0, 90),
|
|
946
|
+
newDaily: count(given === null || given === undefined ? undefined : given.newDaily, base.newDaily, 1, 1000)
|
|
911
947
|
};
|
|
912
948
|
}
|
|
913
949
|
RelayModerationPolicyUtil2.of = of;
|
|
@@ -976,7 +1012,9 @@ function ModerationRules({ policy, change }) {
|
|
|
976
1012
|
hint: t("rulesAutoHint"),
|
|
977
1013
|
checked: policy.auto,
|
|
978
1014
|
onChange: (auto) => change({ auto })
|
|
979
|
-
}), policy.auto && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
1015
|
+
}), policy.auto && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
|
|
1016
|
+
className: "tsh-row-line tsh-wrap tsh-rule-note"
|
|
1017
|
+
}, t("ruleTrustHint")), /* @__PURE__ */ React.createElement(Stepper, {
|
|
980
1018
|
label: t("rulePeople"),
|
|
981
1019
|
value: policy.people,
|
|
982
1020
|
min: 1,
|
|
@@ -1000,17 +1038,37 @@ function ModerationRules({ policy, change }) {
|
|
|
1000
1038
|
min: 1,
|
|
1001
1039
|
max: 30,
|
|
1002
1040
|
onChange: (limitDays) => void change({ limitDays })
|
|
1003
|
-
})), /* @__PURE__ */ React.createElement(
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1041
|
+
})), /* @__PURE__ */ React.createElement("h3", {
|
|
1042
|
+
className: "tsh-section"
|
|
1043
|
+
}, t("newTitle")), /* @__PURE__ */ React.createElement("p", {
|
|
1044
|
+
className: "tsh-row-line tsh-wrap tsh-rule-note"
|
|
1045
|
+
}, t("newHint")), /* @__PURE__ */ React.createElement(Stepper, {
|
|
1046
|
+
label: t("newDays"),
|
|
1047
|
+
value: policy.newDays,
|
|
1048
|
+
min: 0,
|
|
1049
|
+
max: 90,
|
|
1050
|
+
onChange: (newDays) => void change({ newDays })
|
|
1051
|
+
}), policy.newDays > 0 && /* @__PURE__ */ React.createElement(Stepper, {
|
|
1052
|
+
label: t("newDaily"),
|
|
1053
|
+
value: policy.newDaily,
|
|
1054
|
+
min: 1,
|
|
1055
|
+
max: 100,
|
|
1056
|
+
onChange: (newDaily) => void change({ newDaily })
|
|
1008
1057
|
}), /* @__PURE__ */ React.createElement("h3", {
|
|
1009
1058
|
className: "tsh-section"
|
|
1059
|
+
}, t("needsFor")), /* @__PURE__ */ React.createElement("p", {
|
|
1060
|
+
className: "tsh-row-line tsh-wrap tsh-rule-note"
|
|
1061
|
+
}, t("needsForHint")), RELAY_OUTWARD_FEATURES.map((feature) => /* @__PURE__ */ React.createElement(Toggle, {
|
|
1062
|
+
key: feature,
|
|
1063
|
+
label: t(FEATURES[feature]),
|
|
1064
|
+
hint: feature === "share" ? t("needsAccountHint") : undefined,
|
|
1065
|
+
checked: policy.needsAccount.includes(feature),
|
|
1066
|
+
onChange: (on) => change({ needsAccount: on ? [...policy.needsAccount, feature] : policy.needsAccount.filter((each) => each !== feature) })
|
|
1067
|
+
})), /* @__PURE__ */ React.createElement("h3", {
|
|
1068
|
+
className: "tsh-section"
|
|
1010
1069
|
}, t("banCoversTitle")), RELAY_OUTWARD_FEATURES.map((feature) => /* @__PURE__ */ React.createElement(Toggle, {
|
|
1011
1070
|
key: feature,
|
|
1012
1071
|
label: t(FEATURES[feature]),
|
|
1013
|
-
hint: RELAY_ENFORCED_FEATURES.includes(feature) ? undefined : t("notYet"),
|
|
1014
1072
|
checked: policy.banCovers.includes(feature),
|
|
1015
1073
|
onChange: (on) => covers(feature, on)
|
|
1016
1074
|
})));
|
|
@@ -1068,7 +1126,7 @@ function ReportRow({ report, state, act }) {
|
|
|
1068
1126
|
className: "tsh-row-title"
|
|
1069
1127
|
}, t(REASONS[report.reason] ?? "reasonOther")), /* @__PURE__ */ React.createElement("span", {
|
|
1070
1128
|
className: "tsh-row-line"
|
|
1071
|
-
}, t("reportLine", { count: report.count, time }), " · ", owner ? t("fromAccount", { name }) : t("fromComputer")))), report.note && /* @__PURE__ */ React.createElement("p", {
|
|
1129
|
+
}, t("reportLine", { count: report.count, time }), " · ", owner ? t("fromAccount", { name }) : t("fromComputer"), report.doubtful ? ` · ${t("doubtful", { n: report.doubtful })}` : ""))), report.note && /* @__PURE__ */ React.createElement("p", {
|
|
1072
1130
|
className: "tsh-report-note"
|
|
1073
1131
|
}, report.note), /* @__PURE__ */ React.createElement("div", {
|
|
1074
1132
|
className: "tsh-report-actions"
|
|
@@ -1270,10 +1328,13 @@ function ReportsRow() {
|
|
|
1270
1328
|
}
|
|
1271
1329
|
const Mark = icon("Shield");
|
|
1272
1330
|
const count = waiting(state).length + (state.appeals?.length ?? 0);
|
|
1331
|
+
const More = icon("ChevronRight");
|
|
1273
1332
|
return /* @__PURE__ */ React.createElement("ul", {
|
|
1274
|
-
className: "tsh-rows tsh-
|
|
1333
|
+
className: "tsh-rows tsh-group"
|
|
1275
1334
|
}, /* @__PURE__ */ React.createElement("li", {
|
|
1276
1335
|
className: "tsh-item"
|
|
1336
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1337
|
+
className: "tsh-row"
|
|
1277
1338
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
1278
1339
|
type: "button",
|
|
1279
1340
|
className: "tsh-row-main",
|
|
@@ -1291,7 +1352,12 @@ function ReportsRow() {
|
|
|
1291
1352
|
className: "tsh-row-line"
|
|
1292
1353
|
}, count ? t("reportsRowLine", { n: count }) : t("reportsNone"))), count > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
1293
1354
|
className: "tsh-count"
|
|
1294
|
-
}, count)
|
|
1355
|
+
}, count), /* @__PURE__ */ React.createElement("span", {
|
|
1356
|
+
className: "tsh-chevron",
|
|
1357
|
+
"aria-hidden": "true"
|
|
1358
|
+
}, /* @__PURE__ */ React.createElement(More, {
|
|
1359
|
+
size: 16
|
|
1360
|
+
}))))));
|
|
1295
1361
|
}
|
|
1296
1362
|
|
|
1297
1363
|
// ../ta-protocol/esm/common/message-protocol.js
|
|
@@ -2664,27 +2730,35 @@ function Services() {
|
|
|
2664
2730
|
setState({ ...state, tunnels: state.tunnels.filter((each) => each.id !== tunnel.id) });
|
|
2665
2731
|
}
|
|
2666
2732
|
};
|
|
2667
|
-
|
|
2668
|
-
|
|
2733
|
+
const Globe = icon("Globe");
|
|
2734
|
+
return /* @__PURE__ */ React.createElement("ul", {
|
|
2735
|
+
className: "tsh-rows tsh-group"
|
|
2736
|
+
}, /* @__PURE__ */ React.createElement("li", {
|
|
2737
|
+
className: "tsh-item"
|
|
2669
2738
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2670
|
-
className: "tsh-
|
|
2739
|
+
className: "tsh-row tsh-static"
|
|
2671
2740
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
2672
|
-
className: "tsh-
|
|
2741
|
+
className: "tsh-row-main"
|
|
2742
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2743
|
+
className: "tsh-tile tsh-tile-service",
|
|
2744
|
+
"aria-hidden": "true"
|
|
2745
|
+
}, /* @__PURE__ */ React.createElement(Globe, {
|
|
2746
|
+
size: 18
|
|
2747
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
2748
|
+
className: "tsh-row-text"
|
|
2673
2749
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
2674
2750
|
className: "tsh-row-title"
|
|
2675
2751
|
}, t("servicesTitle")), /* @__PURE__ */ React.createElement("span", {
|
|
2676
|
-
className: "tsh-row-line tsh-
|
|
2677
|
-
}, state.enabled && state.tunnels.length === 0 ? t("servicesNone") : t("servicesHint"))), Switch && /* @__PURE__ */ React.createElement(Switch, {
|
|
2752
|
+
className: "tsh-row-line tsh-two"
|
|
2753
|
+
}, state.enabled && state.tunnels.length === 0 ? t("servicesNone") : t("servicesHint")))), Switch && /* @__PURE__ */ React.createElement(Switch, {
|
|
2678
2754
|
checked: state.enabled,
|
|
2679
2755
|
label: t("servicesSwitch"),
|
|
2680
2756
|
onChange: (checked) => toggle(checked)
|
|
2681
|
-
})), state.tunnels.
|
|
2682
|
-
className: "tsh-rows"
|
|
2683
|
-
}, state.tunnels.map((tunnel) => /* @__PURE__ */ React.createElement(TunnelRow, {
|
|
2757
|
+
}))), state.tunnels.map((tunnel) => /* @__PURE__ */ React.createElement(TunnelRow, {
|
|
2684
2758
|
key: tunnel.id,
|
|
2685
2759
|
tunnel,
|
|
2686
2760
|
onStop: (each) => void stop(each)
|
|
2687
|
-
})))
|
|
2761
|
+
})));
|
|
2688
2762
|
}
|
|
2689
2763
|
function SharesPage() {
|
|
2690
2764
|
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
@@ -2696,7 +2770,9 @@ function SharesPage() {
|
|
|
2696
2770
|
hint: t("emptyHint")
|
|
2697
2771
|
}) : /* @__PURE__ */ React.createElement("ul", {
|
|
2698
2772
|
className: "tsh-rows"
|
|
2699
|
-
},
|
|
2773
|
+
}, /* @__PURE__ */ React.createElement("li", {
|
|
2774
|
+
className: "tsh-section tsh-links"
|
|
2775
|
+
}, t("linksTitle")), list.map((share) => /* @__PURE__ */ React.createElement(ShareRow, {
|
|
2700
2776
|
key: share.id,
|
|
2701
2777
|
share
|
|
2702
2778
|
}))));
|
|
@@ -2747,7 +2823,7 @@ var STYLE = `
|
|
|
2747
2823
|
.tsh-item { --ta-swipe-bg: var(--ta-main); min-width: 0; border-radius: 10px; overflow: hidden; }
|
|
2748
2824
|
.tsh-row { display: flex; align-items: center; gap: 4px; min-width: 0; padding-right: 6px; border-radius: 10px; transition: background 120ms, opacity 200ms; }
|
|
2749
2825
|
.tsh-row:hover { background: var(--ta-hover); }
|
|
2750
|
-
.tsh-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
2826
|
+
.tsh-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
|
|
2751
2827
|
.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); }
|
|
2752
2828
|
.tsh-tile-password { background: var(--ta-yellow); }
|
|
2753
2829
|
.tsh-tile-self { background: var(--ta-blue); }
|
|
@@ -2766,12 +2842,12 @@ var STYLE = `
|
|
|
2766
2842
|
.tsh-center { justify-content: center; margin-top: 20px; }
|
|
2767
2843
|
.tsh-quiet { border-color: transparent; color: var(--ta-muted); }
|
|
2768
2844
|
.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
2845
|
.tsh-flush { margin-left: 0; }
|
|
2771
2846
|
.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
2847
|
.tsh-rules { width: 100%; max-width: var(--ta-page-width); margin: 0 auto; }
|
|
2773
2848
|
.tsh-rule { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; }
|
|
2774
2849
|
.tsh-rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
2850
|
+
.tsh-rule-note { margin: 0 8px 4px; }
|
|
2775
2851
|
.tsh-rule-label { font-size: calc(14px * var(--ta-font-scale)); }
|
|
2776
2852
|
.tsh-stepper { flex: none; display: inline-flex; align-items: center; gap: 4px; }
|
|
2777
2853
|
.tsh-stepper-value { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; font-size: calc(14px * var(--ta-font-scale)); }
|
|
@@ -2780,13 +2856,19 @@ var STYLE = `
|
|
|
2780
2856
|
.tsh-log-line { list-style: none; padding: 3px 8px; white-space: normal; }
|
|
2781
2857
|
.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
2858
|
:root[data-handheld] .tsh-report-note, :root[data-handheld] .tsh-report-actions { margin-left: 0; }
|
|
2783
|
-
|
|
2784
|
-
.tsh-
|
|
2785
|
-
.tsh-
|
|
2859
|
+
/* The rows above the links (Reports, Services of this computer): each a group of its own, as the list rows are. */
|
|
2860
|
+
.tsh-group { margin-bottom: 4px; }
|
|
2861
|
+
.tsh-static, .tsh-static:hover { background: none; padding-right: 12px; }
|
|
2862
|
+
.tsh-static .tsh-row-main { cursor: default; }
|
|
2863
|
+
:root[data-touch] .tsh-static .tsh-row-main:active { background: none; }
|
|
2864
|
+
.tsh-chevron { flex: none; display: inline-flex; color: var(--ta-muted); opacity: .7; }
|
|
2865
|
+
.tsh-section.tsh-links { margin: 16px 8px 4px; list-style: none; }
|
|
2786
2866
|
.tsh-wrap { white-space: normal; line-height: 1.45; }
|
|
2787
2867
|
.tsh-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
2788
2868
|
.tsh-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2789
2869
|
.tsh-row-line { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2870
|
+
.tsh-row-line.tsh-wrap { white-space: normal; line-height: 1.45; }
|
|
2871
|
+
.tsh-row-line.tsh-two { white-space: normal; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
|
|
2790
2872
|
.tsh-row-actions { flex: none; display: flex; gap: 2px; opacity: .75; }
|
|
2791
2873
|
.tsh-row:hover .tsh-row-actions, .tsh-row:focus-within .tsh-row-actions { opacity: 1; }
|
|
2792
2874
|
:root[data-touch] .tsh-row:hover { background: none; }
|