@celljs/ta-relay 4.17.0 → 4.19.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/esm/common/index.d.ts +4 -0
- package/esm/common/index.js +4 -0
- package/esm/common/relay-account-client.d.ts +138 -0
- package/esm/common/relay-account-client.js +338 -0
- package/esm/common/relay-account.d.ts +137 -0
- package/esm/common/relay-account.js +122 -0
- package/esm/common/relay-accounts.d.ts +107 -0
- package/esm/common/relay-accounts.js +393 -0
- package/esm/common/relay-faces.d.ts +1 -1
- package/esm/common/relay-faces.js +56 -1
- package/esm/common/relay-files.d.ts +14 -3
- package/esm/common/relay-files.js +41 -16
- package/esm/common/relay-friend-sends.d.ts +64 -0
- package/esm/common/relay-friend-sends.js +126 -0
- package/esm/common/relay-group-invites.d.ts +76 -0
- package/esm/common/relay-group-invites.js +163 -0
- package/esm/common/relay-hubs-protocol.d.ts +3 -1
- package/esm/common/relay-hubs.d.ts +19 -0
- package/esm/common/relay-hubs.js +58 -0
- package/esm/common/relay-open-in-ta.d.ts +11 -0
- package/esm/common/relay-open-in-ta.js +34 -0
- package/esm/common/relay-protocol.d.ts +2 -2
- package/esm/common/relay-protocol.js +5 -2
- package/esm/guest/guest-i18n.d.ts +1 -0
- package/esm/guest/guest-i18n.js +45 -41
- package/esm/guest/guest-style.d.ts +1 -1
- package/esm/guest/guest-style.js +2 -0
- package/esm/guest/guest.js +7 -2
- package/esm/join/join-i18n.d.ts +1 -0
- package/esm/join/join-i18n.js +4 -0
- package/esm/join/join.js +4 -1
- package/esm/node/index.d.ts +1 -0
- package/esm/node/index.js +1 -0
- package/esm/node/relay-files-host.d.ts +2 -0
- package/esm/node/relay-files-host.js +24 -5
- package/esm/node/relay-server-accounts.d.ts +16 -0
- package/esm/node/relay-server-accounts.js +54 -0
- package/esm/node/relay-server.d.ts +5 -0
- package/esm/node/relay-server.js +7 -0
- package/esm/node/relay-store.d.ts +3 -1
- package/esm/node/relay-store.js +1 -0
- package/esm/viewer/viewer-i18n.d.ts +1 -0
- package/esm/viewer/viewer-i18n.js +4 -0
- package/esm/viewer/viewer-style.d.ts +1 -1
- package/esm/viewer/viewer-style.js +2 -0
- package/esm/viewer/viewer.js +3 -1
- package/lib/common/index.d.ts +4 -0
- package/lib/common/index.js +4 -0
- package/lib/common/relay-account-client.d.ts +139 -0
- package/lib/common/relay-account-client.js +343 -0
- package/lib/common/relay-account.d.ts +138 -0
- package/lib/common/relay-account.js +125 -0
- package/lib/common/relay-accounts.d.ts +108 -0
- package/lib/common/relay-accounts.js +401 -0
- package/lib/common/relay-faces.d.ts +1 -1
- package/lib/common/relay-faces.js +56 -1
- package/lib/common/relay-files.d.ts +14 -3
- package/lib/common/relay-files.js +42 -17
- package/lib/common/relay-friend-sends.d.ts +65 -0
- package/lib/common/relay-friend-sends.js +130 -0
- package/lib/common/relay-group-invites.d.ts +77 -0
- package/lib/common/relay-group-invites.js +167 -0
- package/lib/common/relay-hubs-protocol.d.ts +3 -1
- package/lib/common/relay-hubs.d.ts +19 -0
- package/lib/common/relay-hubs.js +58 -0
- package/lib/common/relay-open-in-ta.d.ts +12 -0
- package/lib/common/relay-open-in-ta.js +37 -0
- package/lib/common/relay-protocol.d.ts +2 -2
- package/lib/common/relay-protocol.js +5 -2
- package/lib/guest/guest-i18n.d.ts +1 -0
- package/lib/guest/guest-i18n.js +45 -41
- package/lib/guest/guest-style.d.ts +1 -1
- package/lib/guest/guest-style.js +2 -0
- package/lib/guest/guest.js +7 -2
- package/lib/join/join-i18n.d.ts +1 -0
- package/lib/join/join-i18n.js +4 -0
- package/lib/join/join.js +4 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +1 -0
- package/lib/node/relay-files-host.d.ts +2 -0
- package/lib/node/relay-files-host.js +23 -4
- package/lib/node/relay-server-accounts.d.ts +17 -0
- package/lib/node/relay-server-accounts.js +58 -0
- package/lib/node/relay-server.d.ts +5 -0
- package/lib/node/relay-server.js +7 -0
- package/lib/node/relay-store.d.ts +3 -1
- package/lib/node/relay-store.js +1 -0
- package/lib/viewer/viewer-i18n.d.ts +1 -0
- package/lib/viewer/viewer-i18n.js +4 -0
- package/lib/viewer/viewer-style.d.ts +1 -1
- package/lib/viewer/viewer-style.js +2 -0
- package/lib/viewer/viewer.js +3 -1
- package/package.json +3 -3
- package/viewer/join.html +12 -3
- package/viewer/page.html +18 -9
- package/viewer/room.html +19 -8
|
@@ -32,6 +32,8 @@ export interface RelayRoomRecord {
|
|
|
32
32
|
capacity?: number;
|
|
33
33
|
/** Of one asking: the invitation, till the relay has the ask. */
|
|
34
34
|
invite?: string;
|
|
35
|
+
/** Of the owner: the friends invited into it (RelayGroupInvites), by identity id, till when: let in at once as they ask. */
|
|
36
|
+
invited?: Record<string, number>;
|
|
35
37
|
asked?: boolean;
|
|
36
38
|
createdAt: number;
|
|
37
39
|
joinedAt?: number;
|
|
@@ -168,7 +170,7 @@ export interface RelayHubsStore {
|
|
|
168
170
|
write(name: RelayHubsStoreName, value: unknown): void;
|
|
169
171
|
}
|
|
170
172
|
/** The identity, the rooms (with their keys) and the friends. */
|
|
171
|
-
export type RelayHubsStoreName = 'identity' | 'rooms' | 'friends';
|
|
173
|
+
export type RelayHubsStoreName = 'identity' | 'rooms' | 'friends' | 'groups' | 'sends';
|
|
172
174
|
export interface RelayHubsOptions {
|
|
173
175
|
store: RelayHubsStore;
|
|
174
176
|
/** The name of a new identity: that of the user on the system. */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { RelayFriendSends, type RelayFriendShare } from './relay-friend-sends.js';
|
|
1
2
|
import { RelayFriends } from './relay-friends.js';
|
|
3
|
+
import { type RelayGroupInvite, RelayGroupInvites } from './relay-group-invites.js';
|
|
2
4
|
import { type RelayHubAskBody } from './relay-hub-util.js';
|
|
3
5
|
import { Live } from './relay-hubs-connection.js';
|
|
4
6
|
import { RelayHubsIdentity } from './relay-hubs-identity.js';
|
|
@@ -12,6 +14,8 @@ import { type RelayPublicIdentity } from './relay-identity.js';
|
|
|
12
14
|
*/
|
|
13
15
|
export declare class RelayHubs extends RelayHubsIdentity {
|
|
14
16
|
protected readonly book: RelayFriends;
|
|
17
|
+
protected readonly groups: RelayGroupInvites;
|
|
18
|
+
protected readonly sends: RelayFriendSends;
|
|
15
19
|
/** Connects to the rooms of rooms.json, and keeps connected. */
|
|
16
20
|
start(): void;
|
|
17
21
|
stop(): void;
|
|
@@ -90,6 +94,21 @@ export declare class RelayHubs extends RelayHubsIdentity {
|
|
|
90
94
|
answerFriend(id: string, accept: boolean): Promise<void>;
|
|
91
95
|
/** No longer friends, on both sides. */
|
|
92
96
|
removeFriend(id: string): Promise<boolean>;
|
|
97
|
+
/** Invites friends into a group chat of the user's own: they join on their word, let in at once. How many were. */
|
|
98
|
+
inviteFriends(roomId: string, friends: readonly string[]): Promise<number>;
|
|
99
|
+
/** The group chats friends invited the user into. */
|
|
100
|
+
groupInvites(): Promise<RelayGroupInvite[]>;
|
|
101
|
+
/** The user's answer to an invitation into a group chat. */
|
|
102
|
+
answerGroupInvite(roomId: string, accept: boolean): Promise<void>;
|
|
103
|
+
/** Sends a link to friends from the share sheet: how many it went to. */
|
|
104
|
+
sendToFriends(friends: readonly string[], item: {
|
|
105
|
+
link: string;
|
|
106
|
+
title: string;
|
|
107
|
+
}): Promise<number>;
|
|
108
|
+
/** What friends sent the user. */
|
|
109
|
+
friendShares(): Promise<RelayFriendShare[]>;
|
|
110
|
+
/** The user opened one (`keep`) or let it go. */
|
|
111
|
+
answerFriendShare(id: string, keep: boolean): void;
|
|
93
112
|
protected isFriends(live: Live): boolean;
|
|
94
113
|
protected friendIds(): Set<string>;
|
|
95
114
|
protected heardAsk(live: Live, ask: RelayHubAskBody): void;
|
package/esm/common/relay-hubs.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { RelayFriendSends } from './relay-friend-sends.js';
|
|
1
2
|
import { RELAY_FRIENDS_KIND, RelayFriends, RelayFriendsUtil } from './relay-friends.js';
|
|
3
|
+
import { RelayGroupInvites } from './relay-group-invites.js';
|
|
2
4
|
import { RelayHubUtil } from './relay-hub-util.js';
|
|
3
5
|
import { Live, OPEN, READY_MS } from './relay-hubs-connection.js';
|
|
4
6
|
import { RelayHubsIdentity } from './relay-hubs-identity.js';
|
|
@@ -34,6 +36,27 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
34
36
|
setState: (room, key, value) => this.setState(room, key, value),
|
|
35
37
|
offer: (room, member, link) => this.sendBody(this.member(room), { friend: link }, member),
|
|
36
38
|
}, this.options.store, event => this.notify(event));
|
|
39
|
+
this.groups = new RelayGroupInvites({
|
|
40
|
+
identity: () => this.identity(),
|
|
41
|
+
list: () => this.list(),
|
|
42
|
+
record: room => { var _a; return (_a = this.live.get(room)) === null || _a === void 0 ? void 0 : _a.record; },
|
|
43
|
+
save: () => this.save(),
|
|
44
|
+
friends: () => this.friends(),
|
|
45
|
+
friendRoom: () => this.friendRoom(),
|
|
46
|
+
invite: (room, options) => this.invite(room, options),
|
|
47
|
+
join: link => this.join(link),
|
|
48
|
+
getState: (room, prefix) => this.getState(room, prefix),
|
|
49
|
+
setState: (room, key, value) => this.setState(room, key, value),
|
|
50
|
+
}, this.options.store);
|
|
51
|
+
this.sends = new RelayFriendSends({
|
|
52
|
+
identity: () => this.identity(),
|
|
53
|
+
list: () => this.list(),
|
|
54
|
+
record: room => { var _a; return (_a = this.live.get(room)) === null || _a === void 0 ? void 0 : _a.record; },
|
|
55
|
+
friends: () => this.friends(),
|
|
56
|
+
friendRoom: () => this.friendRoom(),
|
|
57
|
+
getState: (room, prefix) => this.getState(room, prefix),
|
|
58
|
+
setState: (room, key, value) => this.setState(room, key, value),
|
|
59
|
+
}, this.options.store);
|
|
37
60
|
}
|
|
38
61
|
/** Connects to the rooms of rooms.json, and keeps connected. */
|
|
39
62
|
start() {
|
|
@@ -379,6 +402,31 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
379
402
|
removeFriend(id) {
|
|
380
403
|
return this.book.remove(id);
|
|
381
404
|
}
|
|
405
|
+
/** Invites friends into a group chat of the user's own: they join on their word, let in at once. How many were. */
|
|
406
|
+
inviteFriends(roomId, friends) {
|
|
407
|
+
return this.groups.invite(roomId, friends);
|
|
408
|
+
}
|
|
409
|
+
/** The group chats friends invited the user into. */
|
|
410
|
+
groupInvites() {
|
|
411
|
+
return this.groups.list();
|
|
412
|
+
}
|
|
413
|
+
/** The user's answer to an invitation into a group chat. */
|
|
414
|
+
answerGroupInvite(roomId, accept) {
|
|
415
|
+
return this.groups.answer(roomId, accept);
|
|
416
|
+
}
|
|
417
|
+
/** Sends a link to friends from the share sheet: how many it went to. */
|
|
418
|
+
sendToFriends(friends, item) {
|
|
419
|
+
return this.sends.send(friends, item);
|
|
420
|
+
}
|
|
421
|
+
/** What friends sent the user. */
|
|
422
|
+
friendShares() {
|
|
423
|
+
return this.sends.list();
|
|
424
|
+
}
|
|
425
|
+
/** The user opened one (`keep`) or let it go. */
|
|
426
|
+
answerFriendShare(id, keep) {
|
|
427
|
+
this.sends.answer(id, keep);
|
|
428
|
+
this.emit({ type: 'rooms' });
|
|
429
|
+
}
|
|
382
430
|
isFriends(live) {
|
|
383
431
|
return live.record.own && live.record.kind === RELAY_FRIENDS_KIND;
|
|
384
432
|
}
|
|
@@ -389,6 +437,10 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
389
437
|
if (this.isFriends(live)) {
|
|
390
438
|
this.book.asked(ask);
|
|
391
439
|
}
|
|
440
|
+
else if (this.groups.admits(live.record, ask)) {
|
|
441
|
+
// A friend the user invited: in at once, as the user chose it; asked as any other should that fail.
|
|
442
|
+
void this.answer(live.record.id, ask.member, true).then(() => this.groups.admitted(live.record, ask.id), () => super.heardAsk(live, ask));
|
|
443
|
+
}
|
|
392
444
|
else {
|
|
393
445
|
super.heardAsk(live, ask);
|
|
394
446
|
}
|
|
@@ -405,9 +457,15 @@ export class RelayHubs extends RelayHubsIdentity {
|
|
|
405
457
|
}
|
|
406
458
|
/** What changes the friends: rooms coming and going, members, the links friends leave to join back. */
|
|
407
459
|
after(event) {
|
|
460
|
+
var _a;
|
|
408
461
|
if (!this.options.guest && (event.type === 'rooms' || (event.type === 'state' && event.key.startsWith('back:')))) {
|
|
409
462
|
this.book.changed();
|
|
410
463
|
}
|
|
464
|
+
// A friend invited the user into a group chat, or took it back: the pages read the rooms again.
|
|
465
|
+
const record = (_a = this.live.get(event.type === 'state' ? event.room : '')) === null || _a === void 0 ? void 0 : _a.record;
|
|
466
|
+
if (!this.options.guest && event.type === 'state' && (RelayGroupInvites.heard(record, event.key) || RelayFriendSends.heard(record, event.key))) {
|
|
467
|
+
this.emit({ type: 'rooms' });
|
|
468
|
+
}
|
|
411
469
|
}
|
|
412
470
|
owned(roomId) {
|
|
413
471
|
const live = this.member(roomId);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A link of Ta handed to the Ta app by the system (docs/design/ta-links.md 5): `ta://open?link=<the link>`, which the
|
|
3
|
+
* pages of the relay offer as "Open in Ta" and the app takes as its own (a scheme of its own on the computer and the
|
|
4
|
+
* phone). The link inside opens as any link of Ta, asking first wherever it would do something. Pure, for the tests.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace RelayOpenInTa {
|
|
7
|
+
const SCHEME = "ta:";
|
|
8
|
+
function link(href: string): string;
|
|
9
|
+
/** The link of Ta inside, or undefined for what is not one (another `ta://`, a page of the web, one too long). */
|
|
10
|
+
function inner(text: string): string | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A link of Ta handed to the Ta app by the system (docs/design/ta-links.md 5): `ta://open?link=<the link>`, which the
|
|
3
|
+
* pages of the relay offer as "Open in Ta" and the app takes as its own (a scheme of its own on the computer and the
|
|
4
|
+
* phone). The link inside opens as any link of Ta, asking first wherever it would do something. Pure, for the tests.
|
|
5
|
+
*/
|
|
6
|
+
export var RelayOpenInTa;
|
|
7
|
+
(function (RelayOpenInTa) {
|
|
8
|
+
RelayOpenInTa.SCHEME = 'ta:';
|
|
9
|
+
const MAX = 4096;
|
|
10
|
+
function link(href) {
|
|
11
|
+
return `ta://open?link=${encodeURIComponent(href)}`;
|
|
12
|
+
}
|
|
13
|
+
RelayOpenInTa.link = link;
|
|
14
|
+
/** The link of Ta inside, or undefined for what is not one (another `ta://`, a page of the web, one too long). */
|
|
15
|
+
function inner(text) {
|
|
16
|
+
const trimmed = text.trim();
|
|
17
|
+
if (trimmed.length > MAX * 3 || !/^ta:\/\/open\?/i.test(trimmed)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const found = /[?&]link=([^&#]+)/.exec(trimmed);
|
|
21
|
+
if (!found) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const link = decodeURIComponent(found[1]).trim();
|
|
26
|
+
return /^https?:\/\/\S+$/i.test(link) && link.length <= MAX ? link : undefined;
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
RelayOpenInTa.inner = inner;
|
|
33
|
+
})(RelayOpenInTa || (RelayOpenInTa = {}));
|
|
34
|
+
//# sourceMappingURL=relay-open-in-ta.js.map
|
|
@@ -40,9 +40,9 @@ export declare const RELAY_VIEWER_HEADERS: {
|
|
|
40
40
|
/** The copies of content kept on the relay, sealed, for when the computer that shared it is off (RelayBlobs). */
|
|
41
41
|
export declare const RELAY_BLOB_PATH = "/v1/blob/";
|
|
42
42
|
/** The page a pairing link opens in a browser: the link is for the app, and the key in it stays in the fragment. */
|
|
43
|
-
export declare const RELAY_PAIR_PAGE = "<!doctype html><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>Ta</title>\n<body style=\"font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em\">\n<h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>\n<p>\u6253\u5F00 Ta \u5E94\u7528\uFF0C\u7C98\u8D34\u8FD9\u4E2A\u94FE\u63A5\uFF0C\u5C31\u80FD\u4ECE\u8FD9\u53F0\u8BBE\u5907\u8FDE\u5230\u4F60\u7684 Ta\u3002</p></body>";
|
|
43
|
+
export declare const RELAY_PAIR_PAGE = "<!doctype html><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>Ta</title>\n<body style=\"font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em\">\n<h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>\n<p>\u6253\u5F00 Ta \u5E94\u7528\uFF0C\u7C98\u8D34\u8FD9\u4E2A\u94FE\u63A5\uFF0C\u5C31\u80FD\u4ECE\u8FD9\u53F0\u8BBE\u5907\u8FDE\u5230\u4F60\u7684 Ta\u3002</p><p><a id=\"open\" style=\"display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600\">Open in Ta \u00B7 \u5728 Ta \u4E2D\u6253\u5F00</a></p>\n<script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script></body>";
|
|
44
44
|
/** The page a link of an extension opens in a browser. */
|
|
45
|
-
export declare const RELAY_SHARE_PAGE = "<!doctype html><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>Ta</title>\n<body style=\"font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em\">\n<h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>\n<p>\u6709\u4EBA\u5206\u4EAB\u4E86\u4E00\u4E2A Ta \u6269\u5C55\u3002\u5728 Ta \u5E94\u7528\u91CC\u626B\u7801\uFF0C\u6216\u628A\u8FD9\u4E2A\u94FE\u63A5\u7C98\u8D34\u5230\u201C\u5FEB\u6377\u6253\u5F00\u201D\uFF0C\u5C31\u80FD\u6253\u5F00\u5B83\u3002</p></body>";
|
|
45
|
+
export declare const RELAY_SHARE_PAGE = "<!doctype html><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><title>Ta</title>\n<body style=\"font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em\">\n<h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>\n<p>\u6709\u4EBA\u5206\u4EAB\u4E86\u4E00\u4E2A Ta \u6269\u5C55\u3002\u5728 Ta \u5E94\u7528\u91CC\u626B\u7801\uFF0C\u6216\u628A\u8FD9\u4E2A\u94FE\u63A5\u7C98\u8D34\u5230\u201C\u5FEB\u6377\u6253\u5F00\u201D\uFF0C\u5C31\u80FD\u6253\u5F00\u5B83\u3002</p><p><a id=\"open\" style=\"display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600\">Open in Ta \u00B7 \u5728 Ta \u4E2D\u6253\u5F00</a></p>\n<script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script></body>";
|
|
46
46
|
/**
|
|
47
47
|
* A package handed on through the relay (RelayShare): the host, asked on a channel by the key of the share,
|
|
48
48
|
* sends what the package is, then its bytes in chunks small enough for any relay, then the end; sealed as the
|
|
@@ -44,16 +44,19 @@ export const RELAY_VIEWER_HEADERS = {
|
|
|
44
44
|
};
|
|
45
45
|
/** The copies of content kept on the relay, sealed, for when the computer that shared it is off (RelayBlobs). */
|
|
46
46
|
export const RELAY_BLOB_PATH = '/v1/blob/';
|
|
47
|
+
/** Open in Ta on the plain pages of the relay: the link of the page, its fragment too, to the Ta app (RelayOpenInTa). */
|
|
48
|
+
const OPEN_IN_TA = `<p><a id="open" style="display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600">Open in Ta · 在 Ta 中打开</a></p>
|
|
49
|
+
<script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script>`;
|
|
47
50
|
/** The page a pairing link opens in a browser: the link is for the app, and the key in it stays in the fragment. */
|
|
48
51
|
export const RELAY_PAIR_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
|
|
49
52
|
<body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
|
|
50
53
|
<h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>
|
|
51
|
-
<p>打开 Ta 应用,粘贴这个链接,就能从这台设备连到你的 Ta。</p
|
|
54
|
+
<p>打开 Ta 应用,粘贴这个链接,就能从这台设备连到你的 Ta。</p>${OPEN_IN_TA}</body>`;
|
|
52
55
|
/** The page a link of an extension opens in a browser. */
|
|
53
56
|
export const RELAY_SHARE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
|
|
54
57
|
<body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
|
|
55
58
|
<h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>
|
|
56
|
-
<p>有人分享了一个 Ta 扩展。在 Ta 应用里扫码,或把这个链接粘贴到“快捷打开”,就能打开它。</p
|
|
59
|
+
<p>有人分享了一个 Ta 扩展。在 Ta 应用里扫码,或把这个链接粘贴到“快捷打开”,就能打开它。</p>${OPEN_IN_TA}</body>`;
|
|
57
60
|
/** The largest package that is handed on: a gzipped tar of a package of the user, its code and a few assets. */
|
|
58
61
|
export const RELAY_SHARE_MAX_BYTES = 8 * 1024 * 1024;
|
|
59
62
|
/** The bytes of a chunk, base64 in a sealed message: well under the 1 MiB of a message of Cloudflare. */
|
package/esm/guest/guest-i18n.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { pageLanguage } from '../common/page-language.js';
|
|
2
2
|
const zh = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
openInTa: '在 Ta 中打开',
|
|
4
|
+
title: 'Ta 群聊',
|
|
5
|
+
invalid: '这不是一个完整的 Ta 群聊邀请链接,请检查是否复制完整。',
|
|
5
6
|
inTa: '这是{by}在 Ta 里的加好友链接,要在 Ta 里打开:用 Ta 扫码,或把链接粘贴到 Ta 的快捷打开。',
|
|
6
7
|
invited: '{by}邀请你加入',
|
|
7
|
-
joinHint: '
|
|
8
|
+
joinHint: '群主同意后,就能在这里和大家聊天。',
|
|
8
9
|
name: '你的名字',
|
|
9
10
|
namePlaceholder: '大家看到的名字',
|
|
10
11
|
join: '申请加入',
|
|
@@ -16,16 +17,16 @@ const zh = {
|
|
|
16
17
|
cancel: '取消申请',
|
|
17
18
|
refused: '{by}没有同意你加入',
|
|
18
19
|
again: '再申请一次',
|
|
19
|
-
removed: '
|
|
20
|
-
closed: '
|
|
21
|
-
inviteGone: '
|
|
22
|
-
own: '
|
|
20
|
+
removed: '你已被移出这个群聊',
|
|
21
|
+
closed: '这个群聊已被群主解散',
|
|
22
|
+
inviteGone: '邀请已失效,请向群主要一个新链接',
|
|
23
|
+
own: '这是你自己的群聊,请在 Ta 里打开。',
|
|
23
24
|
connecting: '连接中…',
|
|
24
25
|
online: '另有 {n} 人在线',
|
|
25
26
|
nobody: '其他人都不在线',
|
|
26
27
|
onlineNow: '在线',
|
|
27
28
|
members: '成员',
|
|
28
|
-
owner: '
|
|
29
|
+
owner: '群主',
|
|
29
30
|
you: '我',
|
|
30
31
|
guest: '网页访客',
|
|
31
32
|
doubleOf: '{name}的分身',
|
|
@@ -33,10 +34,10 @@ const zh = {
|
|
|
33
34
|
task: '任务',
|
|
34
35
|
agentOf: '{name}的智能体',
|
|
35
36
|
rename: '修改我的名字',
|
|
36
|
-
leave: '
|
|
37
|
+
leave: '退出群聊',
|
|
37
38
|
leaveAsk: '退出「{title}」?退出后要有新的邀请才能再进来。',
|
|
38
|
-
game: '
|
|
39
|
-
empty: '
|
|
39
|
+
game: '这个群里有 Ta 的游戏,装了 Ta 才能一起玩;在这里可以聊天。',
|
|
40
|
+
empty: '还没有人说话。只有群里的人能看到,中继保存的是密文。',
|
|
40
41
|
placeholder: '发消息',
|
|
41
42
|
send: '发送',
|
|
42
43
|
failed: '没发出去:{reason}',
|
|
@@ -44,11 +45,12 @@ const zh = {
|
|
|
44
45
|
close: '关闭',
|
|
45
46
|
};
|
|
46
47
|
const zhTw = {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
openInTa: '在 Ta 中開啟',
|
|
49
|
+
title: 'Ta 群聊',
|
|
50
|
+
invalid: '這不是一個完整的 Ta 群聊邀請連結,請檢查是否複製完整。',
|
|
49
51
|
inTa: '這是{by}在 Ta 裡的加好友連結,要在 Ta 裡開啟:用 Ta 掃碼,或把連結貼上到 Ta 的快捷開啟。',
|
|
50
52
|
invited: '{by}邀請你加入',
|
|
51
|
-
joinHint: '
|
|
53
|
+
joinHint: '群主同意後,就能在這裡和大家聊天。',
|
|
52
54
|
name: '你的名字',
|
|
53
55
|
namePlaceholder: '大家看到的名字',
|
|
54
56
|
join: '申請加入',
|
|
@@ -60,16 +62,16 @@ const zhTw = {
|
|
|
60
62
|
cancel: '取消申請',
|
|
61
63
|
refused: '{by}沒有同意你加入',
|
|
62
64
|
again: '再申請一次',
|
|
63
|
-
removed: '
|
|
64
|
-
closed: '
|
|
65
|
-
inviteGone: '
|
|
66
|
-
own: '
|
|
65
|
+
removed: '你已被移出這個群聊',
|
|
66
|
+
closed: '這個群聊已被群主解散',
|
|
67
|
+
inviteGone: '邀請已失效,請向群主要一個新連結',
|
|
68
|
+
own: '這是你自己的群聊,請在 Ta 裡開啟。',
|
|
67
69
|
connecting: '連線中…',
|
|
68
70
|
online: '另有 {n} 人線上',
|
|
69
71
|
nobody: '其他人都不線上',
|
|
70
72
|
onlineNow: '線上',
|
|
71
73
|
members: '成員',
|
|
72
|
-
owner: '
|
|
74
|
+
owner: '群主',
|
|
73
75
|
you: '我',
|
|
74
76
|
guest: '網頁訪客',
|
|
75
77
|
doubleOf: '{name}的分身',
|
|
@@ -77,10 +79,10 @@ const zhTw = {
|
|
|
77
79
|
task: '任務',
|
|
78
80
|
agentOf: '{name}的智慧體',
|
|
79
81
|
rename: '修改我的名字',
|
|
80
|
-
leave: '
|
|
82
|
+
leave: '退出群聊',
|
|
81
83
|
leaveAsk: '退出「{title}」?退出後要有新的邀請才能再進來。',
|
|
82
|
-
game: '
|
|
83
|
-
empty: '
|
|
84
|
+
game: '這個群裡有 Ta 的遊戲,裝了 Ta 才能一起玩;在這裡可以聊天。',
|
|
85
|
+
empty: '還沒有人說話。只有群裡的人能看到,中繼儲存的是密文。',
|
|
84
86
|
placeholder: '發訊息',
|
|
85
87
|
send: '傳送',
|
|
86
88
|
failed: '沒發出去:{reason}',
|
|
@@ -88,8 +90,9 @@ const zhTw = {
|
|
|
88
90
|
close: '關閉',
|
|
89
91
|
};
|
|
90
92
|
const en = {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
openInTa: 'Open in Ta',
|
|
94
|
+
title: 'A group chat of Ta',
|
|
95
|
+
invalid: 'This is not a whole link that invites into a group chat of Ta: check it was copied in full.',
|
|
93
96
|
inTa: 'This link of {by} adds them as a friend in Ta, and opens in Ta: scan it with Ta, or paste it in Quick open of Ta.',
|
|
94
97
|
invited: '{by} invites you to join',
|
|
95
98
|
joinHint: 'Once the owner lets you in, you chat with everyone here.',
|
|
@@ -104,10 +107,10 @@ const en = {
|
|
|
104
107
|
cancel: 'Cancel',
|
|
105
108
|
refused: '{by} did not let you in',
|
|
106
109
|
again: 'Ask again',
|
|
107
|
-
removed: 'You were taken out of this
|
|
108
|
-
closed: 'This
|
|
110
|
+
removed: 'You were taken out of this group chat',
|
|
111
|
+
closed: 'This group chat was closed by its owner',
|
|
109
112
|
inviteGone: 'The invitation no longer works: ask the owner for a new link',
|
|
110
|
-
own: 'This is a
|
|
113
|
+
own: 'This is a group chat of your own: open it in Ta.',
|
|
111
114
|
connecting: 'Connecting…',
|
|
112
115
|
online: '{n} more online',
|
|
113
116
|
nobody: 'Nobody else online',
|
|
@@ -121,10 +124,10 @@ const en = {
|
|
|
121
124
|
task: 'Task',
|
|
122
125
|
agentOf: "{name}'s agent",
|
|
123
126
|
rename: 'Change my name',
|
|
124
|
-
leave: 'Leave the
|
|
127
|
+
leave: 'Leave the group chat',
|
|
125
128
|
leaveAsk: 'Leave “{title}”? You come back only by a new invitation.',
|
|
126
|
-
game: 'This
|
|
127
|
-
empty: 'Nothing said yet. Only those in the
|
|
129
|
+
game: 'This group chat plays a game of Ta, which takes Ta to play; here you chat.',
|
|
130
|
+
empty: 'Nothing said yet. Only those in the group chat read it: the relay keeps it sealed.',
|
|
128
131
|
placeholder: 'Message',
|
|
129
132
|
send: 'Send',
|
|
130
133
|
failed: 'Not sent: {reason}',
|
|
@@ -132,11 +135,12 @@ const en = {
|
|
|
132
135
|
close: 'Close',
|
|
133
136
|
};
|
|
134
137
|
const ja = {
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
openInTa: 'Ta で開く',
|
|
139
|
+
title: 'Ta のグループチャット',
|
|
140
|
+
invalid: 'これは Ta グループチャットへの完全な招待リンクではありません。全体がコピーされているか確認してください。',
|
|
137
141
|
inTa: 'これは {by} さんが Ta で友だちを追加するリンクで、Ta で開きます。Ta でスキャンするか、Ta のクイックオープンにペーストしてください。',
|
|
138
142
|
invited: '{by}さんがあなたを招待しています',
|
|
139
|
-
joinHint: '
|
|
143
|
+
joinHint: 'グループチャット管理者が承認すると、ここでみんなとチャットできます。',
|
|
140
144
|
name: 'あなたの名前',
|
|
141
145
|
namePlaceholder: 'みんなに見える名前',
|
|
142
146
|
join: '参加をリクエスト',
|
|
@@ -148,16 +152,16 @@ const ja = {
|
|
|
148
152
|
cancel: 'キャンセル',
|
|
149
153
|
refused: '{by}さんはあなたの参加を承認しませんでした',
|
|
150
154
|
again: 'もう一度リクエスト',
|
|
151
|
-
removed: '
|
|
152
|
-
closed: '
|
|
153
|
-
inviteGone: '
|
|
154
|
-
own: '
|
|
155
|
+
removed: 'このグループチャットから削除されました',
|
|
156
|
+
closed: 'このグループチャットはグループチャット管理者に閉じられました',
|
|
157
|
+
inviteGone: '招待が無効です。グループチャット管理者に新しいリンクをリクエストしてください',
|
|
158
|
+
own: 'これはあなた自身のグループチャットです。Ta で開いてください。',
|
|
155
159
|
connecting: '接続中…',
|
|
156
160
|
online: '他に {n} 人がオンライン',
|
|
157
161
|
nobody: '他に誰もオンラインではありません',
|
|
158
162
|
onlineNow: 'オンライン',
|
|
159
163
|
members: 'メンバー',
|
|
160
|
-
owner: '
|
|
164
|
+
owner: 'グループチャット管理者',
|
|
161
165
|
you: '私',
|
|
162
166
|
guest: 'ウェブゲスト',
|
|
163
167
|
doubleOf: '{name}の分身',
|
|
@@ -165,10 +169,10 @@ const ja = {
|
|
|
165
169
|
task: 'タスク',
|
|
166
170
|
agentOf: '{name}のエージェント',
|
|
167
171
|
rename: '名前を変更',
|
|
168
|
-
leave: '
|
|
172
|
+
leave: 'グループチャットを退出',
|
|
169
173
|
leaveAsk: '「{title}」を退出しますか?退出後は新しい招待でのみ戻ることができます。',
|
|
170
|
-
game: '
|
|
171
|
-
empty: '
|
|
174
|
+
game: 'このグループチャットには Ta のゲームがあり、プレイするには Ta が必要です。ここでチャットできます。',
|
|
175
|
+
empty: 'まだ誰も話していません。グループ内の人だけが見ることができ、リレーは暗号化されて保存されます。',
|
|
172
176
|
placeholder: 'メッセージ',
|
|
173
177
|
send: '送信',
|
|
174
178
|
failed: '送信されませんでした:{reason}',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
|
|
1
|
+
export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
|
package/esm/guest/guest-style.js
CHANGED
|
@@ -6,6 +6,8 @@ html,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.
|
|
|
6
6
|
button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
7
7
|
.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}
|
|
8
8
|
.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}
|
|
9
|
+
.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}
|
|
10
|
+
.open-in-ta:active{opacity:.8}
|
|
9
11
|
.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}
|
|
10
12
|
.heading{flex:1;min-width:0;display:flex;flex-direction:column}
|
|
11
13
|
.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
package/esm/guest/guest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FaceUtil } from '../common/relay-faces.js';
|
|
2
2
|
import { RelayHubUtil } from '../common/relay-hub-util.js';
|
|
3
3
|
import { RelayHubs } from '../common/relay-hubs.js';
|
|
4
|
+
import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
|
|
4
5
|
import { RelayRoomChat } from '../common/relay-room-chat.js';
|
|
5
6
|
import { ViewerMarkdown } from '../viewer/viewer-markdown.js';
|
|
6
7
|
import { GuestI18n } from './guest-i18n.js';
|
|
@@ -36,6 +37,10 @@ class BrowserStore {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
/** Open in Ta: the link of this page, handed to the Ta app by the system (`ta://open?link=`). */
|
|
41
|
+
function openInTa() {
|
|
42
|
+
return Object.assign(el('a', t('openInTa')), { className: 'open-in-ta', href: RelayOpenInTa.link(location.href) });
|
|
43
|
+
}
|
|
39
44
|
function div(className, ...children) {
|
|
40
45
|
const node = el('div');
|
|
41
46
|
node.className = className;
|
|
@@ -142,7 +147,7 @@ class GuestPage {
|
|
|
142
147
|
const logo = el('span', 'Ta');
|
|
143
148
|
logo.className = 'logo';
|
|
144
149
|
const heading = div('heading', Object.assign(el('b'), { textContent: t('title') }));
|
|
145
|
-
return div('top', logo, heading);
|
|
150
|
+
return div('top', logo, heading, openInTa());
|
|
146
151
|
}
|
|
147
152
|
join(error) {
|
|
148
153
|
document.title = t('title');
|
|
@@ -382,7 +387,7 @@ function main() {
|
|
|
382
387
|
if (link.kind) {
|
|
383
388
|
// A room a package keeps for itself (friends of Moments): only a Ta joins it.
|
|
384
389
|
const logo = Object.assign(el('span', 'Ta'), { className: 'logo' });
|
|
385
|
-
document.body.replaceChildren(div('app', div('top', logo), div('center', Object.assign(el('p', t('inTa', { by: link.by })), { className: 'hint' }))));
|
|
390
|
+
document.body.replaceChildren(div('app', div('top', logo, openInTa()), div('center', Object.assign(el('p', t('inTa', { by: link.by })), { className: 'hint' }))));
|
|
386
391
|
return;
|
|
387
392
|
}
|
|
388
393
|
new GuestPage(link).start();
|
package/esm/join/join-i18n.d.ts
CHANGED
package/esm/join/join-i18n.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { linkLanguage } from '../common/page-language.js';
|
|
2
2
|
const zh = {
|
|
3
|
+
openInTa: '在 Ta 中打开',
|
|
3
4
|
title: '加入 Ta',
|
|
4
5
|
invalid: '这不是一个完整的 Ta 邀请链接,请检查是否复制完整。',
|
|
5
6
|
invited: '{owner}邀请你一起用 Ta',
|
|
@@ -47,6 +48,7 @@ const zh = {
|
|
|
47
48
|
'role.guest': '访客',
|
|
48
49
|
};
|
|
49
50
|
const zhTw = {
|
|
51
|
+
openInTa: '在 Ta 中開啟',
|
|
50
52
|
title: '加入 Ta',
|
|
51
53
|
invalid: '這不是一個完整的 Ta 邀請連結,請檢查是否複製完整。',
|
|
52
54
|
invited: '{owner}邀請你一起用 Ta',
|
|
@@ -94,6 +96,7 @@ const zhTw = {
|
|
|
94
96
|
'role.guest': '訪客',
|
|
95
97
|
};
|
|
96
98
|
const en = {
|
|
99
|
+
openInTa: 'Open in Ta',
|
|
97
100
|
title: 'Join a Ta',
|
|
98
101
|
invalid: 'This is not a whole link that invites into a Ta: check that it was copied in full.',
|
|
99
102
|
invited: '{owner} invites you to work in their Ta',
|
|
@@ -141,6 +144,7 @@ const en = {
|
|
|
141
144
|
'role.guest': 'Guest',
|
|
142
145
|
};
|
|
143
146
|
const ja = {
|
|
147
|
+
openInTa: 'Ta で開く',
|
|
144
148
|
title: 'Ta に参加',
|
|
145
149
|
invalid: 'これは Ta への完全な招待リンクではありません。全体がコピーされているか確認してください。',
|
|
146
150
|
invited: '{owner}さんが Ta での作業にあなたを招待しています',
|
package/esm/join/join.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
|
|
2
3
|
import { RELAY_WEB_PATH, RelayTeamJoining, RelayTeamLinkUtil, } from '../common/relay-team.js';
|
|
3
4
|
import { GUEST_STYLE } from '../guest/guest-style.js';
|
|
4
5
|
import { JoinI18n } from './join-i18n.js';
|
|
@@ -224,7 +225,9 @@ class JoinPage {
|
|
|
224
225
|
const heading = el('div', 'heading');
|
|
225
226
|
heading.append(el('b', undefined, t('title')));
|
|
226
227
|
const top = el('div', 'top');
|
|
227
|
-
|
|
228
|
+
const open = el('a', 'open-in-ta', t('openInTa'));
|
|
229
|
+
open.href = RelayOpenInTa.link(location.href);
|
|
230
|
+
top.append(logo, heading, open);
|
|
228
231
|
const center = el('div', 'center');
|
|
229
232
|
center.append(...children);
|
|
230
233
|
const app = el('div', 'app');
|
package/esm/node/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './relay-host.js';
|
|
|
5
5
|
export * from './relay-hub-files.js';
|
|
6
6
|
export * from './relay-memory-storage.js';
|
|
7
7
|
export * from './relay-server.js';
|
|
8
|
+
export * from './relay-server-accounts.js';
|
|
8
9
|
export * from './relay-store.js';
|
|
9
10
|
export * from './relay-viewer.js';
|
|
10
11
|
export * from './relays-file.js';
|
package/esm/node/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './relay-host.js';
|
|
|
5
5
|
export * from './relay-hub-files.js';
|
|
6
6
|
export * from './relay-memory-storage.js';
|
|
7
7
|
export * from './relay-server.js';
|
|
8
|
+
export * from './relay-server-accounts.js';
|
|
8
9
|
export * from './relay-store.js';
|
|
9
10
|
export * from './relay-viewer.js';
|
|
10
11
|
export * from './relays-file.js';
|
|
@@ -16,6 +16,8 @@ export declare class RelayFilesHost {
|
|
|
16
16
|
protected readonly base: string;
|
|
17
17
|
protected reading: number;
|
|
18
18
|
protected readonly running: Set<AbortController>;
|
|
19
|
+
/** Asked for past {@link RELAY_FILES_MAX_PARALLEL}: read in turn, not turned away (a page of an older Ta asks for all at once). */
|
|
20
|
+
protected readonly waiting: ((go: boolean) => void)[];
|
|
19
21
|
constructor(options: RelayFilesHostOptions);
|
|
20
22
|
/** A frame of the device: a file to read, or something of a version it does not know. */
|
|
21
23
|
receive(text: string): Promise<void>;
|