@celljs/ta-rooms 4.22.0 → 4.23.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/extension/index.mjs +201 -2
- package/host/index.mjs +2542 -1296
- package/package.json +4 -4
- package/web/index.js +1015 -71
package/web/index.js
CHANGED
|
@@ -67,6 +67,8 @@ var RELAY_ROOM_PATH = "/r";
|
|
|
67
67
|
var RELAY_HUB_MAX_VALUE = 96 * 1024;
|
|
68
68
|
var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
|
|
69
69
|
var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
|
|
70
|
+
var RELAY_HUB_LOG_CHARS = 4 * 1024 * 1024;
|
|
71
|
+
var RELAY_HUB_HISTORY_MAX = 500;
|
|
70
72
|
|
|
71
73
|
// ../ta-relay/esm/common/relay-identity.js
|
|
72
74
|
var encoder = new TextEncoder;
|
|
@@ -221,12 +223,14 @@ var RelayHubCharterUtil;
|
|
|
221
223
|
return;
|
|
222
224
|
}
|
|
223
225
|
const capacity = Math.round(Number(body.capacity));
|
|
226
|
+
const history = Math.min(Math.round(Number(body.history) || 0), RELAY_HUB_HISTORY_MAX);
|
|
224
227
|
return {
|
|
225
228
|
room,
|
|
226
229
|
v: Number(body.v),
|
|
227
230
|
admins: body.admins.filter((admin) => admin && typeof admin.member === "string" && typeof admin.id === "string").slice(0, RELAY_HUB_MAX_ADMINS).map((admin) => ({ member: admin.member, id: admin.id })),
|
|
228
231
|
rules: rules(body.rules),
|
|
229
|
-
...capacity >= 2 ? { capacity } : {}
|
|
232
|
+
...capacity >= 2 ? { capacity } : {},
|
|
233
|
+
...history > 0 ? { history } : {}
|
|
230
234
|
};
|
|
231
235
|
} catch (_a) {
|
|
232
236
|
return;
|
|
@@ -801,6 +805,8 @@ var TASK_MESSAGE_TYPE = "ta-rooms:task";
|
|
|
801
805
|
var ROOM_CAPABILITIES = ["files", "commands"];
|
|
802
806
|
var DoubleKeys;
|
|
803
807
|
((DoubleKeys) => {
|
|
808
|
+
DoubleKeys.PICTURES = "pictures.came";
|
|
809
|
+
DoubleKeys.FILES = "files.came";
|
|
804
810
|
DoubleKeys.QUIET = "doubles.quiet";
|
|
805
811
|
DoubleKeys.REPLY = "doubles.reply";
|
|
806
812
|
DoubleKeys.DRAFTS = "doubles.drafts";
|
|
@@ -857,10 +863,19 @@ var DirectUtil;
|
|
|
857
863
|
})(DirectUtil ||= {});
|
|
858
864
|
|
|
859
865
|
// ../ta-relay/esm/common/relay-room-chat.js
|
|
866
|
+
var RELAY_CHAT_FILE_BYTES = { file: 50 * 1024 * 1024, video: 30 * 1024 * 1024, voice: 2 * 1024 * 1024 };
|
|
867
|
+
var RELAY_CHAT_VOICE_MS = 60000;
|
|
868
|
+
var RELAY_CHAT_VIDEO_MS = 3 * 60000;
|
|
869
|
+
var RELAY_CHAT_FILES = 9;
|
|
860
870
|
var RELAY_CHAT_KEY = "chat:";
|
|
861
871
|
var RELAY_CHAT_PART_BYTES = 8 * 1024;
|
|
862
872
|
var RELAY_CHAT_PARTS = 6;
|
|
863
873
|
var RELAY_CHAT_TEXT_MAX = 2000;
|
|
874
|
+
var RELAY_CHAT_IMAGES = 9;
|
|
875
|
+
var RELAY_CHAT_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
876
|
+
var RELAY_CHAT_THUMB_CHARS = 900;
|
|
877
|
+
var IMAGE_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
878
|
+
var RELAY_CHAT_WINDOW = 500;
|
|
864
879
|
var TRIES = 6;
|
|
865
880
|
var RelayRoomChatUtil;
|
|
866
881
|
(function(RelayRoomChatUtil2) {
|
|
@@ -895,18 +910,99 @@ var RelayRoomChatUtil;
|
|
|
895
910
|
...to.length ? { to } : {},
|
|
896
911
|
...line.person === true && to.length && line.double !== true && !line.agent ? { person: true } : {},
|
|
897
912
|
...typeof line.re === "string" ? { re: line.re } : {},
|
|
898
|
-
...line.task === true && to.length ? { task: true } : {}
|
|
913
|
+
...line.task === true && to.length ? { task: true } : {},
|
|
914
|
+
...images(line.images),
|
|
915
|
+
...files(line.files)
|
|
899
916
|
};
|
|
900
917
|
}
|
|
901
918
|
RelayRoomChatUtil2.extra = extra;
|
|
919
|
+
function files(value) {
|
|
920
|
+
if (!Array.isArray(value)) {
|
|
921
|
+
return {};
|
|
922
|
+
}
|
|
923
|
+
const files2 = [];
|
|
924
|
+
for (const file of value.slice(0, RELAY_CHAT_FILES)) {
|
|
925
|
+
const kind = file === null || file === undefined ? undefined : file.kind;
|
|
926
|
+
if (!file || kind !== "file" && kind !== "voice" && kind !== "video" || typeof file.id !== "string" || !/^[a-f0-9]{24}$/.test(file.id) || typeof file.sha !== "string" || !/^[0-9a-f]{64}$/.test(file.sha) || !Number.isInteger(file.bytes) || file.bytes <= 0 || file.bytes > RELAY_CHAT_FILE_BYTES[kind]) {
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
const name = [...typeof file.name === "string" ? file.name : ""].filter((char) => char.charCodeAt(0) >= 32 && char !== "/" && char !== "\\").join("").slice(0, 120) || kind;
|
|
930
|
+
const type = typeof file.type === "string" && /^[\w.+-]+\/[\w.+-]+$/.test(file.type) ? file.type.slice(0, 100) : "application/octet-stream";
|
|
931
|
+
const most = kind === "voice" ? RELAY_CHAT_VOICE_MS : RELAY_CHAT_VIDEO_MS;
|
|
932
|
+
const ms = kind !== "file" && Number.isFinite(file.ms) ? Math.min(Math.max(Math.round(file.ms), 0), most) : undefined;
|
|
933
|
+
const size = kind === "video" && Number.isInteger(file.w) && Number.isInteger(file.h) && file.w > 0 && file.h > 0;
|
|
934
|
+
const thumb = kind === "video" && typeof file.thumb === "string" && file.thumb.length <= RELAY_CHAT_THUMB_CHARS && /^data:image\/(jpeg|png|webp);base64,/.test(file.thumb) ? file.thumb : undefined;
|
|
935
|
+
files2.push({
|
|
936
|
+
id: file.id,
|
|
937
|
+
kind,
|
|
938
|
+
name,
|
|
939
|
+
type,
|
|
940
|
+
bytes: file.bytes,
|
|
941
|
+
sha: file.sha,
|
|
942
|
+
...ms !== undefined ? { ms } : {},
|
|
943
|
+
...size ? { w: file.w, h: file.h } : {},
|
|
944
|
+
...thumb ? { thumb } : {}
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
return files2.length ? { files: files2 } : {};
|
|
948
|
+
}
|
|
949
|
+
RelayRoomChatUtil2.files = files;
|
|
950
|
+
function images(value) {
|
|
951
|
+
if (!Array.isArray(value)) {
|
|
952
|
+
return {};
|
|
953
|
+
}
|
|
954
|
+
const images2 = [];
|
|
955
|
+
for (const image of value.slice(0, RELAY_CHAT_IMAGES)) {
|
|
956
|
+
if (image && typeof image.id === "string" && /^[A-Za-z0-9-]{8,64}$/.test(image.id) && typeof image.type === "string" && IMAGE_TYPES.includes(image.type) && typeof image.sha === "string" && /^[0-9a-f]{64}$/.test(image.sha) && Number.isInteger(image.w) && Number.isInteger(image.h) && Number.isInteger(image.bytes) && image.w > 0 && image.h > 0 && image.bytes > 0 && image.bytes <= RELAY_CHAT_IMAGE_BYTES) {
|
|
957
|
+
const thumb = typeof image.thumb === "string" && image.thumb.length <= RELAY_CHAT_THUMB_CHARS && /^data:image\/(jpeg|png|webp);base64,/.test(image.thumb) ? image.thumb : undefined;
|
|
958
|
+
const blob = image.blob;
|
|
959
|
+
const ok = !!blob && typeof blob.id === "string" && /^[A-Za-z0-9_-]{16,64}$/.test(blob.id) && typeof blob.read === "string" && /^[A-Za-z0-9_-]{43}$/.test(blob.read) && typeof blob.key === "string" && /^[A-Za-z0-9_-]{43}$/.test(blob.key) && Number.isFinite(blob.until);
|
|
960
|
+
images2.push({
|
|
961
|
+
id: image.id,
|
|
962
|
+
type: image.type,
|
|
963
|
+
w: image.w,
|
|
964
|
+
h: image.h,
|
|
965
|
+
bytes: image.bytes,
|
|
966
|
+
sha: image.sha,
|
|
967
|
+
...thumb ? { thumb } : {},
|
|
968
|
+
...ok && blob ? { blob: { id: blob.id, read: blob.read, key: blob.key, until: blob.until } } : {}
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
return images2.length ? { images: images2 } : {};
|
|
973
|
+
}
|
|
974
|
+
function preview(line, picture, words = { file: "[file]", voice: "[voice]", video: "[video]" }) {
|
|
975
|
+
var _a;
|
|
976
|
+
var _b;
|
|
977
|
+
const pictures = ((_a = line.images) === null || _a === undefined ? undefined : _a.length) ? line.images.length > 1 ? `${picture}×${line.images.length}` : picture : "";
|
|
978
|
+
const files2 = ((_b = line.files) !== null && _b !== undefined ? _b : []).map((file) => file.kind === "file" ? `${words.file} ${file.name}` : words[file.kind]);
|
|
979
|
+
return [pictures, ...files2, line.text].filter(Boolean).join(" ");
|
|
980
|
+
}
|
|
981
|
+
RelayRoomChatUtil2.preview = preview;
|
|
902
982
|
function stored(lines2) {
|
|
903
|
-
return lines2.map(({ from: _from, ...line }) => line);
|
|
983
|
+
return lines2.map(({ from: _from, seq: _seq, pending: _pending, failed: _failed, ...line }) => line);
|
|
904
984
|
}
|
|
905
985
|
RelayRoomChatUtil2.stored = stored;
|
|
986
|
+
function signed(member, value, seq) {
|
|
987
|
+
const line = value;
|
|
988
|
+
if (!line || typeof line.id !== "string" || typeof line.text !== "string" || typeof line.at !== "number") {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
const name = typeof line.name === "string" ? line.name.slice(0, 64) : "";
|
|
992
|
+
const text = line.text.slice(0, RELAY_CHAT_TEXT_MAX);
|
|
993
|
+
return { id: line.id.slice(0, 40), from: member, name, text, at: line.at, ...extra(line), ...seq ? { seq } : {} };
|
|
994
|
+
}
|
|
995
|
+
RelayRoomChatUtil2.signed = signed;
|
|
906
996
|
function bytes(lines2) {
|
|
907
997
|
return new TextEncoder().encode(JSON.stringify(lines2)).length;
|
|
908
998
|
}
|
|
909
999
|
RelayRoomChatUtil2.bytes = bytes;
|
|
1000
|
+
function unknownMethod(error) {
|
|
1001
|
+
var _a;
|
|
1002
|
+
const found = error;
|
|
1003
|
+
return (found === null || found === undefined ? undefined : found.code) === -32601 || /method not found|not a function|unknown method|no such method/i.test(String((_a = found === null || found === undefined ? undefined : found.message) !== null && _a !== undefined ? _a : error));
|
|
1004
|
+
}
|
|
1005
|
+
RelayRoomChatUtil2.unknownMethod = unknownMethod;
|
|
910
1006
|
function id() {
|
|
911
1007
|
return `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
912
1008
|
}
|
|
@@ -920,6 +1016,8 @@ class RelayRoomChat {
|
|
|
920
1016
|
this.parts = new Map;
|
|
921
1017
|
this.listeners = new Set;
|
|
922
1018
|
this.all = [];
|
|
1019
|
+
this.olderKept = false;
|
|
1020
|
+
this.log = typeof rooms.readChat === "function" && typeof rooms.say === "function";
|
|
923
1021
|
}
|
|
924
1022
|
get lines() {
|
|
925
1023
|
return this.all;
|
|
@@ -928,7 +1026,25 @@ class RelayRoomChat {
|
|
|
928
1026
|
this.listeners.add(listener);
|
|
929
1027
|
return () => this.listeners.delete(listener);
|
|
930
1028
|
}
|
|
1029
|
+
get more() {
|
|
1030
|
+
return this.olderKept;
|
|
1031
|
+
}
|
|
931
1032
|
async load() {
|
|
1033
|
+
if (this.log && this.rooms.readChat) {
|
|
1034
|
+
const read = await this.rooms.readChat(this.room, { limit: RELAY_CHAT_WINDOW }).catch((error) => {
|
|
1035
|
+
if (!RelayRoomChatUtil.unknownMethod(error)) {
|
|
1036
|
+
throw error;
|
|
1037
|
+
}
|
|
1038
|
+
this.log = false;
|
|
1039
|
+
return;
|
|
1040
|
+
});
|
|
1041
|
+
if (read) {
|
|
1042
|
+
this.olderKept = read.more;
|
|
1043
|
+
this.all = Array.isArray(read.lines) ? read.lines : [];
|
|
1044
|
+
this.tell();
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
932
1048
|
const state = await this.rooms.getState(this.room, RELAY_CHAT_KEY);
|
|
933
1049
|
this.parts.clear();
|
|
934
1050
|
for (const [key, value] of Object.entries(state)) {
|
|
@@ -936,7 +1052,51 @@ class RelayRoomChat {
|
|
|
936
1052
|
}
|
|
937
1053
|
this.changed();
|
|
938
1054
|
}
|
|
1055
|
+
async older(limit = 100) {
|
|
1056
|
+
const first = this.all[0];
|
|
1057
|
+
if (!this.log || !this.rooms.readChat || !first || !this.olderKept) {
|
|
1058
|
+
return 0;
|
|
1059
|
+
}
|
|
1060
|
+
const read = await this.rooms.readChat(this.room, { before: first.id, limit });
|
|
1061
|
+
const known = new Set(this.all.map((line) => line.id));
|
|
1062
|
+
const lines = read.lines.filter((line) => !known.has(line.id));
|
|
1063
|
+
this.olderKept = read.more;
|
|
1064
|
+
this.all = [...lines, ...this.all];
|
|
1065
|
+
this.tell();
|
|
1066
|
+
return lines.length;
|
|
1067
|
+
}
|
|
1068
|
+
hear(event) {
|
|
1069
|
+
if (event.room !== undefined && event.room !== this.room) {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
if (event.type === "chat" && event.line) {
|
|
1073
|
+
this.heardLine(event.line);
|
|
1074
|
+
return true;
|
|
1075
|
+
}
|
|
1076
|
+
return event.type === "state" && typeof event.key === "string" && this.heard(event.key, event);
|
|
1077
|
+
}
|
|
1078
|
+
heardLine(line) {
|
|
1079
|
+
const index = this.all.findIndex((each) => each.id === line.id);
|
|
1080
|
+
if (index >= 0) {
|
|
1081
|
+
const next = [...this.all];
|
|
1082
|
+
next[index] = line;
|
|
1083
|
+
this.all = next;
|
|
1084
|
+
} else {
|
|
1085
|
+
const next = [...this.all, line];
|
|
1086
|
+
const pending = next.findIndex((each) => each.pending);
|
|
1087
|
+
if (pending >= 0 && !line.pending) {
|
|
1088
|
+
next.splice(next.length - 1, 1);
|
|
1089
|
+
next.splice(pending, 0, line);
|
|
1090
|
+
}
|
|
1091
|
+
this.all = next.length > RELAY_CHAT_WINDOW * 2 ? next.slice(-RELAY_CHAT_WINDOW) : next;
|
|
1092
|
+
this.olderKept || (this.olderKept = next.length > this.all.length);
|
|
1093
|
+
}
|
|
1094
|
+
this.tell();
|
|
1095
|
+
}
|
|
939
1096
|
heard(key, value) {
|
|
1097
|
+
if (this.log) {
|
|
1098
|
+
return !!RelayRoomChatUtil.parse(key);
|
|
1099
|
+
}
|
|
940
1100
|
if (!RelayRoomChatUtil.parse(key)) {
|
|
941
1101
|
return false;
|
|
942
1102
|
}
|
|
@@ -949,16 +1109,23 @@ class RelayRoomChat {
|
|
|
949
1109
|
return true;
|
|
950
1110
|
}
|
|
951
1111
|
async say(text, self, extra = {}) {
|
|
952
|
-
var _a;
|
|
953
|
-
var
|
|
1112
|
+
var _a, _b, _c;
|
|
1113
|
+
var _d, _e;
|
|
954
1114
|
const said = text.trim().slice(0, RELAY_CHAT_TEXT_MAX);
|
|
955
|
-
if (!said) {
|
|
1115
|
+
if (!said && !((_a = extra.images) === null || _a === undefined ? undefined : _a.length) && !((_b = extra.files) === null || _b === undefined ? undefined : _b.length)) {
|
|
956
1116
|
return;
|
|
957
1117
|
}
|
|
1118
|
+
if (this.log && this.rooms.say) {
|
|
1119
|
+
const line = await this.rooms.say(this.room, said, RelayRoomChatUtil.extra(extra));
|
|
1120
|
+
if (line) {
|
|
1121
|
+
this.heardLine(line);
|
|
1122
|
+
}
|
|
1123
|
+
return line;
|
|
1124
|
+
}
|
|
958
1125
|
for (let tries = 0;tries < TRIES; tries++) {
|
|
959
1126
|
const latest = this.latest(self.member);
|
|
960
1127
|
const last = latest === null || latest === undefined ? undefined : latest.lines[latest.lines.length - 1];
|
|
961
|
-
const at = Math.max(Date.now(), ((
|
|
1128
|
+
const at = Math.max(Date.now(), ((_d = last === null || last === undefined ? undefined : last.at) !== null && _d !== undefined ? _d : 0) + 1);
|
|
962
1129
|
const line = {
|
|
963
1130
|
id: RelayRoomChatUtil.id(),
|
|
964
1131
|
from: self.member,
|
|
@@ -972,7 +1139,7 @@ class RelayRoomChat {
|
|
|
972
1139
|
const lines = fits && latest ? [...latest.lines, line] : [line];
|
|
973
1140
|
const key = RelayRoomChatUtil.key(self.member, part);
|
|
974
1141
|
const value = RelayRoomChatUtil.stored(lines);
|
|
975
|
-
const result = await this.rooms.setState(this.room, key, value, (
|
|
1142
|
+
const result = await this.rooms.setState(this.room, key, value, (_e = (_c = this.parts.get(key)) === null || _c === undefined ? undefined : _c.version) !== null && _e !== undefined ? _e : 0);
|
|
976
1143
|
if (result.ok) {
|
|
977
1144
|
this.put(key, { value, version: result.version, by: self.member });
|
|
978
1145
|
this.changed();
|
|
@@ -1013,6 +1180,9 @@ class RelayRoomChat {
|
|
|
1013
1180
|
}
|
|
1014
1181
|
changed() {
|
|
1015
1182
|
this.all = [...this.parts.values()].flatMap((part) => part.lines).sort((a, b) => a.at - b.at || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
1183
|
+
this.tell();
|
|
1184
|
+
}
|
|
1185
|
+
tell() {
|
|
1016
1186
|
for (const listener of this.listeners) {
|
|
1017
1187
|
listener();
|
|
1018
1188
|
}
|
|
@@ -1140,8 +1310,28 @@ var EN = {
|
|
|
1140
1310
|
openPage: "Open {name}",
|
|
1141
1311
|
apps: "Apps",
|
|
1142
1312
|
pageLine: "A group chat of {name}: play in it together",
|
|
1313
|
+
unsent: "Not sent: too long",
|
|
1143
1314
|
chatEmpty: "Nothing said yet. Only those in the group chat read it: the relay keeps it sealed.",
|
|
1144
1315
|
chatPlaceholder: "Message",
|
|
1316
|
+
file: "[File]",
|
|
1317
|
+
voice: "[Voice]",
|
|
1318
|
+
video: "[Video]",
|
|
1319
|
+
sendFile: "File",
|
|
1320
|
+
sendVideo: "Video",
|
|
1321
|
+
sendVoice: "Voice",
|
|
1322
|
+
fileTooLarge: "Too large to send: {mb} MB at most",
|
|
1323
|
+
videoTooLong: "A video is 3 minutes at most",
|
|
1324
|
+
fileComing: "Receiving {percent}%",
|
|
1325
|
+
fileWait: "Opens once {name} is online",
|
|
1326
|
+
fileSending: "Sending {name} {percent}%",
|
|
1327
|
+
voiceTitle: "Voice message",
|
|
1328
|
+
voiceLong: "60 seconds at most",
|
|
1329
|
+
voiceCancel: "Cancel",
|
|
1330
|
+
voiceSend: "Send",
|
|
1331
|
+
voiceNoMic: "The microphone cannot be used",
|
|
1332
|
+
picture: "[Picture]",
|
|
1333
|
+
pictureAlt: "A picture from {name}",
|
|
1334
|
+
pictureWait: "Comes once {name} is online",
|
|
1145
1335
|
showOnHome: "Show group chats on the double's home",
|
|
1146
1336
|
showOnHomeHint: "With group chats, the double's home has a Group chats section, beside members and channels.",
|
|
1147
1337
|
friendsDetail: "{n} friends",
|
|
@@ -1290,8 +1480,28 @@ var ZH = {
|
|
|
1290
1480
|
openPage: "打开{name}",
|
|
1291
1481
|
apps: "应用",
|
|
1292
1482
|
pageLine: "{name}的群聊,大家可以一起玩",
|
|
1483
|
+
unsent: "未发出:内容太长",
|
|
1293
1484
|
chatEmpty: "还没有人说话。只有群里的人能看到,中继保存的是密文。",
|
|
1294
1485
|
chatPlaceholder: "发消息",
|
|
1486
|
+
file: "[文件]",
|
|
1487
|
+
voice: "[语音]",
|
|
1488
|
+
video: "[视频]",
|
|
1489
|
+
sendFile: "文件",
|
|
1490
|
+
sendVideo: "视频",
|
|
1491
|
+
sendVoice: "语音",
|
|
1492
|
+
fileTooLarge: "文件太大,最多 {mb} MB",
|
|
1493
|
+
videoTooLong: "视频最长 3 分钟",
|
|
1494
|
+
fileComing: "正在接收 {percent}%",
|
|
1495
|
+
fileWait: "等{name}上线后可以打开",
|
|
1496
|
+
fileSending: "正在发送 {name} {percent}%",
|
|
1497
|
+
voiceTitle: "语音消息",
|
|
1498
|
+
voiceLong: "最长 60 秒",
|
|
1499
|
+
voiceCancel: "取消",
|
|
1500
|
+
voiceSend: "发送",
|
|
1501
|
+
voiceNoMic: "无法使用麦克风",
|
|
1502
|
+
picture: "[图片]",
|
|
1503
|
+
pictureAlt: "{name}发的图片",
|
|
1504
|
+
pictureWait: "等{name}上线后显示",
|
|
1295
1505
|
showOnHome: "在分身首页显示群聊",
|
|
1296
1506
|
showOnHomeHint: "有群聊时,分身首页多一个“群聊”分类,和成员、频道放在一起。",
|
|
1297
1507
|
friendsDetail: "{n} 位好友",
|
|
@@ -1440,8 +1650,28 @@ var ZH_TW = {
|
|
|
1440
1650
|
openPage: "開啟{name}",
|
|
1441
1651
|
apps: "應用",
|
|
1442
1652
|
pageLine: "{name}的群聊,大家可以一起玩",
|
|
1653
|
+
unsent: "未送出:內容太長",
|
|
1443
1654
|
chatEmpty: "還沒有人說話。只有群裡的人能看到,中繼儲存的是密文。",
|
|
1444
1655
|
chatPlaceholder: "發訊息",
|
|
1656
|
+
file: "[檔案]",
|
|
1657
|
+
voice: "[語音]",
|
|
1658
|
+
video: "[影片]",
|
|
1659
|
+
sendFile: "檔案",
|
|
1660
|
+
sendVideo: "影片",
|
|
1661
|
+
sendVoice: "語音",
|
|
1662
|
+
fileTooLarge: "檔案太大,最多 {mb} MB",
|
|
1663
|
+
videoTooLong: "影片最長 3 分鐘",
|
|
1664
|
+
fileComing: "正在接收 {percent}%",
|
|
1665
|
+
fileWait: "等{name}上線後可以打開",
|
|
1666
|
+
fileSending: "正在傳送 {name} {percent}%",
|
|
1667
|
+
voiceTitle: "語音訊息",
|
|
1668
|
+
voiceLong: "最長 60 秒",
|
|
1669
|
+
voiceCancel: "取消",
|
|
1670
|
+
voiceSend: "傳送",
|
|
1671
|
+
voiceNoMic: "無法使用麥克風",
|
|
1672
|
+
picture: "[圖片]",
|
|
1673
|
+
pictureAlt: "{name}傳的圖片",
|
|
1674
|
+
pictureWait: "等{name}上線後顯示",
|
|
1445
1675
|
showOnHome: "在分身首頁顯示群聊",
|
|
1446
1676
|
showOnHomeHint: "有群聊時,分身首頁多一個「群聊」分類,和成員、頻道放在一起。",
|
|
1447
1677
|
friendsDetail: "{n} 位好友",
|
|
@@ -1590,8 +1820,28 @@ var JA = {
|
|
|
1590
1820
|
openPage: "{name} を開く",
|
|
1591
1821
|
apps: "アプリ",
|
|
1592
1822
|
pageLine: "{name} のグループチャット:一緒にプレイします",
|
|
1823
|
+
unsent: "送信できませんでした:長すぎます",
|
|
1593
1824
|
chatEmpty: "まだ何も言われていません。グループ内の人だけが見ることができます。リレーは暗号化されて保存します。",
|
|
1594
1825
|
chatPlaceholder: "メッセージ",
|
|
1826
|
+
file: "[ファイル]",
|
|
1827
|
+
voice: "[ボイス]",
|
|
1828
|
+
video: "[動画]",
|
|
1829
|
+
sendFile: "ファイル",
|
|
1830
|
+
sendVideo: "動画",
|
|
1831
|
+
sendVoice: "ボイス",
|
|
1832
|
+
fileTooLarge: "大きすぎます(最大 {mb} MB)",
|
|
1833
|
+
videoTooLong: "動画は最長 3 分です",
|
|
1834
|
+
fileComing: "受信中 {percent}%",
|
|
1835
|
+
fileWait: "{name}がオンラインになると開けます",
|
|
1836
|
+
fileSending: "{name} を送信中 {percent}%",
|
|
1837
|
+
voiceTitle: "ボイスメッセージ",
|
|
1838
|
+
voiceLong: "最長 60 秒",
|
|
1839
|
+
voiceCancel: "キャンセル",
|
|
1840
|
+
voiceSend: "送信",
|
|
1841
|
+
voiceNoMic: "マイクを使えません",
|
|
1842
|
+
picture: "[画像]",
|
|
1843
|
+
pictureAlt: "{name}からの画像",
|
|
1844
|
+
pictureWait: "{name}がオンラインになると表示",
|
|
1595
1845
|
showOnHome: "分身のホームにグループチャットを表示",
|
|
1596
1846
|
showOnHomeHint: "グループチャットがあると、分身のホームに「グループチャット」セクションが追加され、メンバーとチャンネルと一緒に表示されます。",
|
|
1597
1847
|
friendsDetail: "友だち {n} 人",
|
|
@@ -1814,10 +2064,10 @@ class RoomBook {
|
|
|
1814
2064
|
this.putAgents(room, { ...known, [key]: { value: agents, by: member, version: known[key]?.version ?? 0 } });
|
|
1815
2065
|
}
|
|
1816
2066
|
heard(event) {
|
|
2067
|
+
this.chats.get("room" in event ? event.room : "")?.hear(event);
|
|
1817
2068
|
if (event.type !== "state") {
|
|
1818
2069
|
return;
|
|
1819
2070
|
}
|
|
1820
|
-
this.chats.get(event.room)?.heard(event.key, event);
|
|
1821
2071
|
const known = this.agentStates.get(event.room);
|
|
1822
2072
|
if (known && event.key.startsWith(ROOM_AGENTS_KEY) && (known[event.key]?.version ?? 0) < event.version) {
|
|
1823
2073
|
this.putAgents(event.room, { ...known, [event.key]: event });
|
|
@@ -3024,7 +3274,7 @@ var EN3 = {
|
|
|
3024
3274
|
drafted: "Drafted",
|
|
3025
3275
|
message: "Message",
|
|
3026
3276
|
directEmpty: "Your chat with {name}",
|
|
3027
|
-
directHint: "
|
|
3277
|
+
directHint: "End-to-end encrypted, just the two of you",
|
|
3028
3278
|
directWaiting: "{name} gets it in their Ta",
|
|
3029
3279
|
directDelete: "Delete the chat",
|
|
3030
3280
|
directDeleteTitle: "Delete your chat with {name}?",
|
|
@@ -3062,7 +3312,8 @@ var EN3 = {
|
|
|
3062
3312
|
approveTitle: "{name} hands your double a task",
|
|
3063
3313
|
approveTake: "Take it",
|
|
3064
3314
|
approveDecline: "Not this time",
|
|
3065
|
-
approveWaiting: "Waits for you to take it"
|
|
3315
|
+
approveWaiting: "Waits for you to take it",
|
|
3316
|
+
approveHint: "Taken, it counts as yours: within what you let {name} have, pushing and deploying are not blocked either."
|
|
3066
3317
|
};
|
|
3067
3318
|
var ZH3 = {
|
|
3068
3319
|
replyTitle: "别人与我的分身",
|
|
@@ -3103,7 +3354,7 @@ var ZH3 = {
|
|
|
3103
3354
|
drafted: "已拟稿",
|
|
3104
3355
|
message: "发消息",
|
|
3105
3356
|
directEmpty: "和{name}的聊天",
|
|
3106
|
-
directHint: "
|
|
3357
|
+
directHint: "端到端加密,只有你们两人可见",
|
|
3107
3358
|
directWaiting: "{name}会在自己的 Ta 里收到",
|
|
3108
3359
|
directDelete: "删除聊天",
|
|
3109
3360
|
directDeleteTitle: "删除和{name}的聊天?",
|
|
@@ -3141,7 +3392,8 @@ var ZH3 = {
|
|
|
3141
3392
|
approveTitle: "{name}给你的分身派了任务",
|
|
3142
3393
|
approveTake: "接",
|
|
3143
3394
|
approveDecline: "这次不接",
|
|
3144
|
-
approveWaiting: "等你决定接不接"
|
|
3395
|
+
approveWaiting: "等你决定接不接",
|
|
3396
|
+
approveHint: "接下后按你发起的算:在你给{name}授权的范围内,推送、部署也不再拦。"
|
|
3145
3397
|
};
|
|
3146
3398
|
var ZH_TW3 = {
|
|
3147
3399
|
replyTitle: "別人與我的分身",
|
|
@@ -3182,7 +3434,7 @@ var ZH_TW3 = {
|
|
|
3182
3434
|
drafted: "已擬稿",
|
|
3183
3435
|
message: "傳訊息",
|
|
3184
3436
|
directEmpty: "和{name}的聊天",
|
|
3185
|
-
directHint: "
|
|
3437
|
+
directHint: "端對端加密,只有你們兩人可見",
|
|
3186
3438
|
directWaiting: "{name}會在自己的 Ta 裡收到",
|
|
3187
3439
|
directDelete: "刪除聊天",
|
|
3188
3440
|
directDeleteTitle: "刪除和{name}的聊天?",
|
|
@@ -3220,7 +3472,8 @@ var ZH_TW3 = {
|
|
|
3220
3472
|
approveTitle: "{name}給你的分身派了任務",
|
|
3221
3473
|
approveTake: "接",
|
|
3222
3474
|
approveDecline: "這次不接",
|
|
3223
|
-
approveWaiting: "等你決定接不接"
|
|
3475
|
+
approveWaiting: "等你決定接不接",
|
|
3476
|
+
approveHint: "接下後按你發起的算:在你給{name}授權的範圍內,推送、部署也不再攔。"
|
|
3224
3477
|
};
|
|
3225
3478
|
var JA3 = {
|
|
3226
3479
|
replyTitle: "ほかの人と分身",
|
|
@@ -3261,7 +3514,7 @@ var JA3 = {
|
|
|
3261
3514
|
drafted: "下書き済み",
|
|
3262
3515
|
message: "メッセージ",
|
|
3263
3516
|
directEmpty: "{name} とのチャット",
|
|
3264
|
-
directHint: "
|
|
3517
|
+
directHint: "エンドツーエンド暗号化、ふたりだけに表示",
|
|
3265
3518
|
directWaiting: "{name} の Ta に届きます",
|
|
3266
3519
|
directDelete: "チャットを削除",
|
|
3267
3520
|
directDeleteTitle: "{name} とのチャットを削除しますか?",
|
|
@@ -3299,7 +3552,8 @@ var JA3 = {
|
|
|
3299
3552
|
approveTitle: "{name}があなたの分身にタスクを依頼しました",
|
|
3300
3553
|
approveTake: "受ける",
|
|
3301
3554
|
approveDecline: "今回は受けない",
|
|
3302
|
-
approveWaiting: "受けるかどうか待っています"
|
|
3555
|
+
approveWaiting: "受けるかどうか待っています",
|
|
3556
|
+
approveHint: "受けると、あなたが頼んだものとして扱います。{name}に許可した範囲内では、プッシュやデプロイもブロックしません。"
|
|
3303
3557
|
};
|
|
3304
3558
|
var REPLY_WORDS = { "zh-CN": ZH3, "zh-TW": ZH_TW3, "en-US": EN3, "ja-JP": JA3 };
|
|
3305
3559
|
function rt(key, values = {}) {
|
|
@@ -3509,7 +3763,9 @@ function ApproveDialog({ task, close }) {
|
|
|
3509
3763
|
size: 36
|
|
3510
3764
|
}), /* @__PURE__ */ React.createElement("p", {
|
|
3511
3765
|
className: "trm-lead"
|
|
3512
|
-
}, task.text)), /* @__PURE__ */ React.createElement("
|
|
3766
|
+
}, task.text)), /* @__PURE__ */ React.createElement("p", {
|
|
3767
|
+
className: "trm-note"
|
|
3768
|
+
}, rt("approveHint", { name: task.name })), /* @__PURE__ */ React.createElement("div", {
|
|
3513
3769
|
className: "trm-actions"
|
|
3514
3770
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
3515
3771
|
type: "button",
|
|
@@ -4244,6 +4500,623 @@ function AgentRow({ room, agent }) {
|
|
|
4244
4500
|
})));
|
|
4245
4501
|
}
|
|
4246
4502
|
|
|
4503
|
+
// web-src/files-view.tsx
|
|
4504
|
+
var CALL_BYTES = 384 * 1024;
|
|
4505
|
+
var AGAIN_MS = 1500;
|
|
4506
|
+
var KEPT = 6;
|
|
4507
|
+
var THUMB_SIDE = 16;
|
|
4508
|
+
var FilesUtil;
|
|
4509
|
+
((FilesUtil) => {
|
|
4510
|
+
function size(bytes) {
|
|
4511
|
+
return bytes < 1024 * 1024 ? `${Math.max(1, Math.round(bytes / 1024))} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
4512
|
+
}
|
|
4513
|
+
FilesUtil.size = size;
|
|
4514
|
+
function seconds(ms = 0) {
|
|
4515
|
+
const all = Math.max(1, Math.round(ms / 1000));
|
|
4516
|
+
return all < 60 ? `${all}″` : `${Math.floor(all / 60)}:${String(all % 60).padStart(2, "0")}`;
|
|
4517
|
+
}
|
|
4518
|
+
FilesUtil.seconds = seconds;
|
|
4519
|
+
function base64(bytes) {
|
|
4520
|
+
let binary = "";
|
|
4521
|
+
for (let at = 0;at < bytes.length; at += 32768) {
|
|
4522
|
+
binary += String.fromCharCode(...bytes.subarray(at, at + 32768));
|
|
4523
|
+
}
|
|
4524
|
+
return btoa(binary);
|
|
4525
|
+
}
|
|
4526
|
+
FilesUtil.base64 = base64;
|
|
4527
|
+
})(FilesUtil ||= {});
|
|
4528
|
+
|
|
4529
|
+
class FileStore {
|
|
4530
|
+
urls = new Map;
|
|
4531
|
+
progress = new Map;
|
|
4532
|
+
listeners = new Set;
|
|
4533
|
+
url(room, id) {
|
|
4534
|
+
return this.urls.get(`${room}:${id}`);
|
|
4535
|
+
}
|
|
4536
|
+
coming(room, id) {
|
|
4537
|
+
return this.progress.get(`${room}:${id}`);
|
|
4538
|
+
}
|
|
4539
|
+
subscribe(listener) {
|
|
4540
|
+
this.listeners.add(listener);
|
|
4541
|
+
return () => this.listeners.delete(listener);
|
|
4542
|
+
}
|
|
4543
|
+
async open(room, file) {
|
|
4544
|
+
const key = `${room}:${file.id}`;
|
|
4545
|
+
const known = this.urls.get(key);
|
|
4546
|
+
if (known) {
|
|
4547
|
+
return known;
|
|
4548
|
+
}
|
|
4549
|
+
const parts = [];
|
|
4550
|
+
for (let offset = 0;offset < file.bytes; ) {
|
|
4551
|
+
const read = await callDoubles({ kind: "fileRead", room, id: file.id, offset });
|
|
4552
|
+
if (read.status !== "here") {
|
|
4553
|
+
this.set(key, read.status === "coming" ? read.got / Math.max(read.bytes, 1) : -1);
|
|
4554
|
+
return;
|
|
4555
|
+
}
|
|
4556
|
+
const bytes = Uint8Array.from(atob(read.data), (char) => char.charCodeAt(0));
|
|
4557
|
+
if (!bytes.length) {
|
|
4558
|
+
return;
|
|
4559
|
+
}
|
|
4560
|
+
parts.push(bytes);
|
|
4561
|
+
offset += bytes.length;
|
|
4562
|
+
if (offset < file.bytes) {
|
|
4563
|
+
this.set(key, offset / file.bytes);
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
const url = URL.createObjectURL(new Blob(parts, { type: file.type }));
|
|
4567
|
+
this.urls.set(key, url);
|
|
4568
|
+
this.progress.delete(key);
|
|
4569
|
+
for (const old of this.urls.keys()) {
|
|
4570
|
+
if (this.urls.size <= KEPT) {
|
|
4571
|
+
break;
|
|
4572
|
+
}
|
|
4573
|
+
URL.revokeObjectURL(this.urls.get(old));
|
|
4574
|
+
this.urls.delete(old);
|
|
4575
|
+
}
|
|
4576
|
+
this.tell();
|
|
4577
|
+
return url;
|
|
4578
|
+
}
|
|
4579
|
+
set(key, value) {
|
|
4580
|
+
this.progress.set(key, value);
|
|
4581
|
+
this.tell();
|
|
4582
|
+
}
|
|
4583
|
+
tell() {
|
|
4584
|
+
for (const listener of this.listeners) {
|
|
4585
|
+
listener();
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
}
|
|
4589
|
+
var store = new FileStore;
|
|
4590
|
+
function use(file, url) {
|
|
4591
|
+
if (file.kind === "voice") {
|
|
4592
|
+
new Audio(url).play().catch(() => {
|
|
4593
|
+
return;
|
|
4594
|
+
});
|
|
4595
|
+
} else if (file.kind === "video") {
|
|
4596
|
+
show(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
4597
|
+
title: file.name,
|
|
4598
|
+
onClose: close
|
|
4599
|
+
}, /* @__PURE__ */ React.createElement("video", {
|
|
4600
|
+
className: "trm-video-play",
|
|
4601
|
+
src: url,
|
|
4602
|
+
controls: true,
|
|
4603
|
+
autoPlay: true,
|
|
4604
|
+
playsInline: true
|
|
4605
|
+
})));
|
|
4606
|
+
} else {
|
|
4607
|
+
const link = document.createElement("a");
|
|
4608
|
+
link.href = url;
|
|
4609
|
+
link.download = file.name;
|
|
4610
|
+
link.click();
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
function useOpen(room, file) {
|
|
4614
|
+
const read = () => `${store.url(room, file.id) ? "here" : ""}:${store.coming(room, file.id) ?? ""}`;
|
|
4615
|
+
const state = React.useSyncExternalStore((listener) => store.subscribe(listener), read);
|
|
4616
|
+
const [wanted, setWanted] = React.useState(false);
|
|
4617
|
+
const [here, coming] = state.split(":");
|
|
4618
|
+
React.useEffect(() => {
|
|
4619
|
+
if (!wanted) {
|
|
4620
|
+
return;
|
|
4621
|
+
}
|
|
4622
|
+
let opened = false;
|
|
4623
|
+
const again = () => void store.open(room, file).then((url) => {
|
|
4624
|
+
if (url && !opened) {
|
|
4625
|
+
opened = true;
|
|
4626
|
+
setWanted(false);
|
|
4627
|
+
use(file, url);
|
|
4628
|
+
}
|
|
4629
|
+
}, (error) => pi.ui.notify(message(error), "error"));
|
|
4630
|
+
again();
|
|
4631
|
+
const timer = setInterval(again, AGAIN_MS);
|
|
4632
|
+
const came = pi.storage?.onChange((keys) => keys.includes(DoubleKeys.FILES) && again());
|
|
4633
|
+
return () => {
|
|
4634
|
+
clearInterval(timer);
|
|
4635
|
+
came?.();
|
|
4636
|
+
};
|
|
4637
|
+
}, [wanted, room, file]);
|
|
4638
|
+
return {
|
|
4639
|
+
here: !!here,
|
|
4640
|
+
...wanted && coming !== "" ? { coming: Number(coming) } : {},
|
|
4641
|
+
open: () => {
|
|
4642
|
+
const url = store.url(room, file.id);
|
|
4643
|
+
if (url) {
|
|
4644
|
+
use(file, url);
|
|
4645
|
+
} else {
|
|
4646
|
+
setWanted(true);
|
|
4647
|
+
}
|
|
4648
|
+
}
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
function FileItem({ room, file, name }) {
|
|
4652
|
+
const { open, coming } = useOpen(room, file);
|
|
4653
|
+
const status = coming === undefined ? FilesUtil.size(file.bytes) : coming < 0 ? t("fileWait", { name }) : t("fileComing", { percent: Math.floor(coming * 100) });
|
|
4654
|
+
if (file.kind === "voice") {
|
|
4655
|
+
const Mic = icon("Mic");
|
|
4656
|
+
const width = 72 + Math.min(1, (file.ms ?? 0) / RELAY_CHAT_VOICE_MS) * 120;
|
|
4657
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
4658
|
+
type: "button",
|
|
4659
|
+
className: "trm-voice",
|
|
4660
|
+
style: { width },
|
|
4661
|
+
onClick: open,
|
|
4662
|
+
"aria-label": t("voice")
|
|
4663
|
+
}, /* @__PURE__ */ React.createElement(Mic, {
|
|
4664
|
+
size: 15
|
|
4665
|
+
}), /* @__PURE__ */ React.createElement("span", null, coming === undefined ? FilesUtil.seconds(file.ms) : status));
|
|
4666
|
+
}
|
|
4667
|
+
if (file.kind === "video") {
|
|
4668
|
+
const Play = icon("Play");
|
|
4669
|
+
const ratio = file.w && file.h ? file.w / file.h : 16 / 9;
|
|
4670
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
4671
|
+
type: "button",
|
|
4672
|
+
className: "trm-video",
|
|
4673
|
+
style: { aspectRatio: String(ratio), ...file.thumb ? { backgroundImage: `url(${file.thumb})` } : {} },
|
|
4674
|
+
onClick: open,
|
|
4675
|
+
"aria-label": file.name
|
|
4676
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4677
|
+
className: "trm-video-mark"
|
|
4678
|
+
}, /* @__PURE__ */ React.createElement(Play, {
|
|
4679
|
+
size: 18
|
|
4680
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
4681
|
+
className: "trm-video-time"
|
|
4682
|
+
}, coming === undefined ? FilesUtil.seconds(file.ms) : status));
|
|
4683
|
+
}
|
|
4684
|
+
const File = icon("FileText");
|
|
4685
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
4686
|
+
type: "button",
|
|
4687
|
+
className: "trm-file",
|
|
4688
|
+
onClick: open
|
|
4689
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4690
|
+
className: "trm-file-text"
|
|
4691
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4692
|
+
className: "trm-file-name"
|
|
4693
|
+
}, file.name), /* @__PURE__ */ React.createElement("span", {
|
|
4694
|
+
className: "trm-file-size"
|
|
4695
|
+
}, status)), /* @__PURE__ */ React.createElement(File, {
|
|
4696
|
+
size: 28
|
|
4697
|
+
}));
|
|
4698
|
+
}
|
|
4699
|
+
function LineFiles({ room, line, name }) {
|
|
4700
|
+
if (!line.files?.length) {
|
|
4701
|
+
return null;
|
|
4702
|
+
}
|
|
4703
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4704
|
+
className: "trm-files"
|
|
4705
|
+
}, line.files.map((file) => /* @__PURE__ */ React.createElement(FileItem, {
|
|
4706
|
+
key: file.id,
|
|
4707
|
+
room,
|
|
4708
|
+
file,
|
|
4709
|
+
name
|
|
4710
|
+
})));
|
|
4711
|
+
}
|
|
4712
|
+
function videoLook(blob) {
|
|
4713
|
+
return new Promise((resolve) => {
|
|
4714
|
+
const url = URL.createObjectURL(blob);
|
|
4715
|
+
const video = document.createElement("video");
|
|
4716
|
+
const done = (look) => {
|
|
4717
|
+
URL.revokeObjectURL(url);
|
|
4718
|
+
resolve(look);
|
|
4719
|
+
};
|
|
4720
|
+
const timer = setTimeout(() => done({}), 8000);
|
|
4721
|
+
video.muted = true;
|
|
4722
|
+
video.playsInline = true;
|
|
4723
|
+
video.preload = "auto";
|
|
4724
|
+
video.onloadeddata = () => {
|
|
4725
|
+
video.currentTime = Math.min(0.1, video.duration || 0);
|
|
4726
|
+
};
|
|
4727
|
+
video.onseeked = () => {
|
|
4728
|
+
clearTimeout(timer);
|
|
4729
|
+
const w = video.videoWidth;
|
|
4730
|
+
const h = video.videoHeight;
|
|
4731
|
+
const ms = Number.isFinite(video.duration) ? Math.round(video.duration * 1000) : undefined;
|
|
4732
|
+
const scale = THUMB_SIDE / Math.max(w, h, 1);
|
|
4733
|
+
const canvas = document.createElement("canvas");
|
|
4734
|
+
canvas.width = Math.max(1, Math.round(w * scale));
|
|
4735
|
+
canvas.height = Math.max(1, Math.round(h * scale));
|
|
4736
|
+
const context = canvas.getContext("2d");
|
|
4737
|
+
context?.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
4738
|
+
const thumb = context ? [canvas.toDataURL("image/webp", 0.5), canvas.toDataURL("image/jpeg", 0.3), canvas.toDataURL("image/png")].find((each) => each.length <= 900) : undefined;
|
|
4739
|
+
done({ ...w && h ? { w, h } : {}, ...ms ? { ms } : {}, ...thumb && thumb.length <= 900 ? { thumb } : {} });
|
|
4740
|
+
};
|
|
4741
|
+
video.onerror = () => {
|
|
4742
|
+
clearTimeout(timer);
|
|
4743
|
+
done({});
|
|
4744
|
+
};
|
|
4745
|
+
video.src = url;
|
|
4746
|
+
});
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4749
|
+
class Uploads {
|
|
4750
|
+
going = new Map;
|
|
4751
|
+
listeners = new Set;
|
|
4752
|
+
tell() {
|
|
4753
|
+
for (const listener of this.listeners) {
|
|
4754
|
+
listener();
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
var uploads = new Uploads;
|
|
4759
|
+
async function sendFile(room, blob, kind, name, known = {}) {
|
|
4760
|
+
const most = RELAY_CHAT_FILE_BYTES[kind];
|
|
4761
|
+
if (blob.size > most) {
|
|
4762
|
+
throw new Error(t("fileTooLarge", { mb: Math.round(most / (1024 * 1024)) }));
|
|
4763
|
+
}
|
|
4764
|
+
const look = kind === "video" ? await videoLook(blob) : {};
|
|
4765
|
+
if (kind === "video" && (look.ms ?? 0) > RELAY_CHAT_VIDEO_MS) {
|
|
4766
|
+
throw new Error(t("videoTooLong"));
|
|
4767
|
+
}
|
|
4768
|
+
const type = blob.type || "application/octet-stream";
|
|
4769
|
+
const upload = await callDoubles({ kind: "fileBegin", room: room.id, fileKind: kind, type, bytes: blob.size });
|
|
4770
|
+
uploads.going.set(upload, { room: room.id, name, done: 0 });
|
|
4771
|
+
uploads.tell();
|
|
4772
|
+
try {
|
|
4773
|
+
for (let offset = 0;offset < blob.size; offset += CALL_BYTES) {
|
|
4774
|
+
const bytes = new Uint8Array(await blob.slice(offset, offset + CALL_BYTES).arrayBuffer());
|
|
4775
|
+
await callDoubles({ kind: "fileAppend", upload, offset, data: FilesUtil.base64(bytes) });
|
|
4776
|
+
uploads.going.set(upload, { room: room.id, name, done: Math.min(1, (offset + bytes.length) / blob.size) });
|
|
4777
|
+
uploads.tell();
|
|
4778
|
+
}
|
|
4779
|
+
return await callDoubles({ kind: "fileFinish", upload, name, ...look, ...known });
|
|
4780
|
+
} finally {
|
|
4781
|
+
uploads.going.delete(upload);
|
|
4782
|
+
uploads.tell();
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
function FileUploads({ room }) {
|
|
4786
|
+
const read = () => [...uploads.going.values()].filter((each) => each.room === room).map((each) => `${each.name} ${Math.floor(each.done * 100)}`).join(`
|
|
4787
|
+
`);
|
|
4788
|
+
const going = React.useSyncExternalStore((listener) => {
|
|
4789
|
+
uploads.listeners.add(listener);
|
|
4790
|
+
return () => uploads.listeners.delete(listener);
|
|
4791
|
+
}, read);
|
|
4792
|
+
if (!going) {
|
|
4793
|
+
return null;
|
|
4794
|
+
}
|
|
4795
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4796
|
+
className: "trm-uploads",
|
|
4797
|
+
role: "status"
|
|
4798
|
+
}, going.split(`
|
|
4799
|
+
`).map((each) => {
|
|
4800
|
+
const [name, percent] = each.split("\t");
|
|
4801
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
4802
|
+
key: name,
|
|
4803
|
+
className: "trm-upload"
|
|
4804
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
4805
|
+
className: "ta-spinner"
|
|
4806
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
4807
|
+
className: "trm-ellipsis"
|
|
4808
|
+
}, t("fileSending", { name, percent })));
|
|
4809
|
+
}));
|
|
4810
|
+
}
|
|
4811
|
+
function pickFile(accept) {
|
|
4812
|
+
return new Promise((resolve) => {
|
|
4813
|
+
const input = document.createElement("input");
|
|
4814
|
+
input.type = "file";
|
|
4815
|
+
input.accept = accept;
|
|
4816
|
+
input.onchange = () => resolve(input.files?.[0]);
|
|
4817
|
+
input.oncancel = () => resolve(undefined);
|
|
4818
|
+
input.click();
|
|
4819
|
+
});
|
|
4820
|
+
}
|
|
4821
|
+
function VoiceRecorder({ close, onDone }) {
|
|
4822
|
+
const [elapsed, setElapsed] = React.useState(0);
|
|
4823
|
+
const [error, setError] = React.useState("");
|
|
4824
|
+
const recorder = React.useRef(undefined);
|
|
4825
|
+
const keep = React.useRef(false);
|
|
4826
|
+
React.useEffect(() => {
|
|
4827
|
+
let stream;
|
|
4828
|
+
let timer;
|
|
4829
|
+
const started = Date.now();
|
|
4830
|
+
const chunks = [];
|
|
4831
|
+
navigator.mediaDevices?.getUserMedia({ audio: true }).then((got) => {
|
|
4832
|
+
stream = got;
|
|
4833
|
+
const made = new MediaRecorder(got);
|
|
4834
|
+
recorder.current = made;
|
|
4835
|
+
made.ondataavailable = (event) => event.data.size && chunks.push(event.data);
|
|
4836
|
+
made.onstop = () => {
|
|
4837
|
+
for (const track of got.getTracks()) {
|
|
4838
|
+
track.stop();
|
|
4839
|
+
}
|
|
4840
|
+
if (keep.current && chunks.length) {
|
|
4841
|
+
onDone(new Blob(chunks, { type: made.mimeType || "audio/webm" }), Math.min(Date.now() - started, RELAY_CHAT_VOICE_MS));
|
|
4842
|
+
}
|
|
4843
|
+
};
|
|
4844
|
+
made.start();
|
|
4845
|
+
timer = setInterval(() => {
|
|
4846
|
+
const ms = Date.now() - started;
|
|
4847
|
+
setElapsed(ms);
|
|
4848
|
+
if (ms >= RELAY_CHAT_VOICE_MS) {
|
|
4849
|
+
keep.current = true;
|
|
4850
|
+
made.stop();
|
|
4851
|
+
close();
|
|
4852
|
+
}
|
|
4853
|
+
}, 200);
|
|
4854
|
+
}).catch(() => setError(t("voiceNoMic")));
|
|
4855
|
+
if (!navigator.mediaDevices) {
|
|
4856
|
+
setError(t("voiceNoMic"));
|
|
4857
|
+
}
|
|
4858
|
+
return () => {
|
|
4859
|
+
clearInterval(timer);
|
|
4860
|
+
if (recorder.current?.state === "recording") {
|
|
4861
|
+
recorder.current.stop();
|
|
4862
|
+
}
|
|
4863
|
+
for (const track of stream?.getTracks() ?? []) {
|
|
4864
|
+
track.stop();
|
|
4865
|
+
}
|
|
4866
|
+
};
|
|
4867
|
+
}, []);
|
|
4868
|
+
const stop = (send) => {
|
|
4869
|
+
keep.current = send;
|
|
4870
|
+
if (recorder.current?.state === "recording") {
|
|
4871
|
+
recorder.current.stop();
|
|
4872
|
+
}
|
|
4873
|
+
close();
|
|
4874
|
+
};
|
|
4875
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
4876
|
+
title: t("voiceTitle"),
|
|
4877
|
+
onClose: () => stop(false)
|
|
4878
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
4879
|
+
className: "trm-recorder"
|
|
4880
|
+
}, error ? /* @__PURE__ */ React.createElement("p", {
|
|
4881
|
+
className: "trm-note"
|
|
4882
|
+
}, error) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
4883
|
+
className: "trm-recorder-dot"
|
|
4884
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
4885
|
+
className: "trm-recorder-time"
|
|
4886
|
+
}, FilesUtil.seconds(elapsed)), /* @__PURE__ */ React.createElement("span", {
|
|
4887
|
+
className: "trm-note"
|
|
4888
|
+
}, t("voiceLong"))), /* @__PURE__ */ React.createElement("div", {
|
|
4889
|
+
className: "trm-answers"
|
|
4890
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
4891
|
+
type: "button",
|
|
4892
|
+
className: "ta-button",
|
|
4893
|
+
onClick: () => stop(false)
|
|
4894
|
+
}, t("voiceCancel")), !error && /* @__PURE__ */ React.createElement("button", {
|
|
4895
|
+
type: "button",
|
|
4896
|
+
className: "ta-button ta-primary",
|
|
4897
|
+
onClick: () => stop(true)
|
|
4898
|
+
}, t("voiceSend")))));
|
|
4899
|
+
}
|
|
4900
|
+
function fileActions(room, said) {
|
|
4901
|
+
const sendOne = async (blob, kind, name, known = {}) => {
|
|
4902
|
+
try {
|
|
4903
|
+
await said([await sendFile(room, blob, kind, name, known)]);
|
|
4904
|
+
} catch (error) {
|
|
4905
|
+
pi.ui.notify(message(error), "error");
|
|
4906
|
+
}
|
|
4907
|
+
};
|
|
4908
|
+
const pick = (accept, kind) => () => void pickFile(accept).then((file) => file && sendOne(file, kind, file.name));
|
|
4909
|
+
return [
|
|
4910
|
+
{ key: "send-video", label: t("sendVideo"), icon: icon("Film"), run: pick("video/*", "video") },
|
|
4911
|
+
{ key: "send-file", label: t("sendFile"), icon: icon("FileText"), run: pick("*/*", "file") },
|
|
4912
|
+
{
|
|
4913
|
+
key: "send-voice",
|
|
4914
|
+
label: t("sendVoice"),
|
|
4915
|
+
icon: icon("Mic"),
|
|
4916
|
+
run: () => void show(({ close }) => /* @__PURE__ */ React.createElement(VoiceRecorder, {
|
|
4917
|
+
close,
|
|
4918
|
+
onDone: (blob, ms) => void sendOne(blob, "voice", t("voice"), { ms })
|
|
4919
|
+
}))
|
|
4920
|
+
}
|
|
4921
|
+
];
|
|
4922
|
+
}
|
|
4923
|
+
|
|
4924
|
+
// web-src/pictures-view.tsx
|
|
4925
|
+
var PICTURE_LIMITS = { side: 1600, bytes: 1024 * 1024 };
|
|
4926
|
+
var THUMB_SIDE2 = 16;
|
|
4927
|
+
var KEPT2 = 60;
|
|
4928
|
+
var AGAIN_MS2 = 15000;
|
|
4929
|
+
|
|
4930
|
+
class PictureStore {
|
|
4931
|
+
kept = new Map;
|
|
4932
|
+
loading = new Set;
|
|
4933
|
+
wanted = new Map;
|
|
4934
|
+
listeners = new Set;
|
|
4935
|
+
watching;
|
|
4936
|
+
get(room, id) {
|
|
4937
|
+
return this.kept.get(`${room}:${id}`);
|
|
4938
|
+
}
|
|
4939
|
+
subscribe(listener) {
|
|
4940
|
+
this.listeners.add(listener);
|
|
4941
|
+
this.watch();
|
|
4942
|
+
return () => this.listeners.delete(listener);
|
|
4943
|
+
}
|
|
4944
|
+
want(room, id) {
|
|
4945
|
+
const key = `${room}:${id}`;
|
|
4946
|
+
this.wanted.set(key, (this.wanted.get(key) ?? 0) + 1);
|
|
4947
|
+
this.load(room, id);
|
|
4948
|
+
}
|
|
4949
|
+
unwant(room, id) {
|
|
4950
|
+
const key = `${room}:${id}`;
|
|
4951
|
+
const left2 = (this.wanted.get(key) ?? 1) - 1;
|
|
4952
|
+
if (left2 > 0) {
|
|
4953
|
+
this.wanted.set(key, left2);
|
|
4954
|
+
} else {
|
|
4955
|
+
this.wanted.delete(key);
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
load(room, id) {
|
|
4959
|
+
const key = `${room}:${id}`;
|
|
4960
|
+
if (this.kept.has(key) || this.loading.has(key)) {
|
|
4961
|
+
return;
|
|
4962
|
+
}
|
|
4963
|
+
this.loading.add(key);
|
|
4964
|
+
callDoubles({ kind: "picture", room, id }).then((data) => {
|
|
4965
|
+
if (typeof data === "string" && data.startsWith("data:image/")) {
|
|
4966
|
+
this.keep(key, data);
|
|
4967
|
+
}
|
|
4968
|
+
}).catch(() => {
|
|
4969
|
+
return;
|
|
4970
|
+
}).finally(() => this.loading.delete(key));
|
|
4971
|
+
}
|
|
4972
|
+
again() {
|
|
4973
|
+
for (const key of this.wanted.keys()) {
|
|
4974
|
+
const at = key.indexOf(":");
|
|
4975
|
+
this.load(key.slice(0, at), key.slice(at + 1));
|
|
4976
|
+
}
|
|
4977
|
+
}
|
|
4978
|
+
keep(key, data) {
|
|
4979
|
+
this.kept.delete(key);
|
|
4980
|
+
this.kept.set(key, data);
|
|
4981
|
+
for (const old of this.kept.keys()) {
|
|
4982
|
+
if (this.kept.size <= KEPT2) {
|
|
4983
|
+
break;
|
|
4984
|
+
}
|
|
4985
|
+
if (!this.wanted.has(old)) {
|
|
4986
|
+
this.kept.delete(old);
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
for (const listener of this.listeners) {
|
|
4990
|
+
listener();
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
watch() {
|
|
4994
|
+
if (this.watching || !pi.storage) {
|
|
4995
|
+
return;
|
|
4996
|
+
}
|
|
4997
|
+
this.watching = pi.storage.onChange((keys) => keys.includes(DoubleKeys.PICTURES) && this.again());
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
var store2 = new PictureStore;
|
|
5001
|
+
function useSources(room, images) {
|
|
5002
|
+
const ids = images.map((image) => image.id).join(",");
|
|
5003
|
+
const read = () => images.map((image) => store2.get(room, image.id) ?? "").join(`
|
|
5004
|
+
`);
|
|
5005
|
+
const joined = React.useSyncExternalStore((listener) => store2.subscribe(listener), read);
|
|
5006
|
+
const sources = joined.split(`
|
|
5007
|
+
`).map((source) => source || undefined);
|
|
5008
|
+
const missing = images.filter((_, at) => !sources[at]).map((image) => image.id).join(",");
|
|
5009
|
+
React.useEffect(() => {
|
|
5010
|
+
if (!missing) {
|
|
5011
|
+
return;
|
|
5012
|
+
}
|
|
5013
|
+
const wanted = missing.split(",");
|
|
5014
|
+
for (const id of wanted) {
|
|
5015
|
+
store2.want(room, id);
|
|
5016
|
+
}
|
|
5017
|
+
const timer = setInterval(() => {
|
|
5018
|
+
for (const id of wanted) {
|
|
5019
|
+
store2.load(room, id);
|
|
5020
|
+
}
|
|
5021
|
+
}, AGAIN_MS2);
|
|
5022
|
+
return () => {
|
|
5023
|
+
clearInterval(timer);
|
|
5024
|
+
for (const id of wanted) {
|
|
5025
|
+
store2.unwant(room, id);
|
|
5026
|
+
}
|
|
5027
|
+
};
|
|
5028
|
+
}, [room, missing]);
|
|
5029
|
+
return ids ? sources : [];
|
|
5030
|
+
}
|
|
5031
|
+
async function thumbOf(image) {
|
|
5032
|
+
const blob = await (await fetch(`data:${image.mimeType};base64,${image.data}`)).blob();
|
|
5033
|
+
const bitmap = await createImageBitmap(blob);
|
|
5034
|
+
try {
|
|
5035
|
+
const scale = THUMB_SIDE2 / Math.max(bitmap.width, bitmap.height);
|
|
5036
|
+
const canvas = document.createElement("canvas");
|
|
5037
|
+
canvas.width = Math.max(1, Math.round(bitmap.width * scale));
|
|
5038
|
+
canvas.height = Math.max(1, Math.round(bitmap.height * scale));
|
|
5039
|
+
const context = canvas.getContext("2d");
|
|
5040
|
+
let thumb;
|
|
5041
|
+
if (context) {
|
|
5042
|
+
context.fillStyle = "#fff";
|
|
5043
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
5044
|
+
context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
5045
|
+
thumb = canvas.toDataURL("image/jpeg", 0.5);
|
|
5046
|
+
}
|
|
5047
|
+
return { thumb: thumb && thumb.length <= 900 ? thumb : undefined, w: image.width ?? bitmap.width, h: image.height ?? bitmap.height };
|
|
5048
|
+
} finally {
|
|
5049
|
+
bitmap.close();
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
async function sendPictures(room, images) {
|
|
5053
|
+
return Promise.all(images.map(async (image) => {
|
|
5054
|
+
const [put, look] = await Promise.all([
|
|
5055
|
+
callDoubles({ kind: "putPicture", room: room.id, data: image.data, type: image.mimeType }),
|
|
5056
|
+
thumbOf(image)
|
|
5057
|
+
]);
|
|
5058
|
+
return { ...put, w: look.w, h: look.h, ...look.thumb ? { thumb: look.thumb } : {} };
|
|
5059
|
+
}));
|
|
5060
|
+
}
|
|
5061
|
+
function LinePictures({ room, line, name }) {
|
|
5062
|
+
const images = line.images ?? [];
|
|
5063
|
+
const sources = useSources(room, images);
|
|
5064
|
+
const ChatImages = pi.ui.ChatImages;
|
|
5065
|
+
if (!images.length) {
|
|
5066
|
+
return null;
|
|
5067
|
+
}
|
|
5068
|
+
if (!ChatImages) {
|
|
5069
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
5070
|
+
className: "trm-quiet"
|
|
5071
|
+
}, t("picture"));
|
|
5072
|
+
}
|
|
5073
|
+
const waiting = sources.some((source) => !source);
|
|
5074
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
5075
|
+
className: "trm-pics",
|
|
5076
|
+
title: waiting ? t("pictureWait", { name }) : undefined
|
|
5077
|
+
}, /* @__PURE__ */ React.createElement(ChatImages, {
|
|
5078
|
+
alt: t("pictureAlt", { name }),
|
|
5079
|
+
images: images.map((image, at) => ({ key: image.id, src: sources[at], thumb: image.thumb, width: image.w, height: image.h }))
|
|
5080
|
+
}));
|
|
5081
|
+
}
|
|
5082
|
+
|
|
5083
|
+
// web-src/room-rules.ts
|
|
5084
|
+
var ROOM_RULES = ["agents", "doubles", "tasks"];
|
|
5085
|
+
var RoomRulesUtil;
|
|
5086
|
+
((RoomRulesUtil) => {
|
|
5087
|
+
function allows(room, rule) {
|
|
5088
|
+
return room?.rules?.[rule] !== false;
|
|
5089
|
+
}
|
|
5090
|
+
RoomRulesUtil.allows = allows;
|
|
5091
|
+
function approves(room) {
|
|
5092
|
+
return room?.rules?.approve === true;
|
|
5093
|
+
}
|
|
5094
|
+
RoomRulesUtil.approves = approves;
|
|
5095
|
+
function refused(rule, language) {
|
|
5096
|
+
return TaLanguageUtil.pick(language, {
|
|
5097
|
+
agents: {
|
|
5098
|
+
"zh-CN": "群主没有允许在这个群里用智能体",
|
|
5099
|
+
"zh-TW": "群主沒有允許在這個群裡用智慧體",
|
|
5100
|
+
"en-US": "the owner allows no agents in this group chat",
|
|
5101
|
+
"ja-JP": "このグループチャットではグループ主がエージェントを許可していません"
|
|
5102
|
+
},
|
|
5103
|
+
doubles: {
|
|
5104
|
+
"zh-CN": "群主没有允许分身在这个群里代答",
|
|
5105
|
+
"zh-TW": "群主沒有允許分身在這個群裡代答",
|
|
5106
|
+
"en-US": "the owner allows no double to answer in this group chat",
|
|
5107
|
+
"ja-JP": "このグループチャットではグループ主が分身の代理応答を許可していません"
|
|
5108
|
+
},
|
|
5109
|
+
tasks: {
|
|
5110
|
+
"zh-CN": "群主没有允许在这个群里给分身派任务",
|
|
5111
|
+
"zh-TW": "群主沒有允許在這個群裡給分身派任務",
|
|
5112
|
+
"en-US": "the owner allows no tasks for doubles in this group chat",
|
|
5113
|
+
"ja-JP": "このグループチャットではグループ主が分身へのタスクを許可していません"
|
|
5114
|
+
}
|
|
5115
|
+
}[rule]);
|
|
5116
|
+
}
|
|
5117
|
+
RoomRulesUtil.refused = refused;
|
|
5118
|
+
})(RoomRulesUtil ||= {});
|
|
5119
|
+
|
|
4247
5120
|
// web-src/tasks-view.tsx
|
|
4248
5121
|
function taskStatusWord(status) {
|
|
4249
5122
|
switch (status) {
|
|
@@ -4586,6 +5459,7 @@ function RoomView({ room, head, onBack }) {
|
|
|
4586
5459
|
const tasks = useTaskStates(room);
|
|
4587
5460
|
const list = React.useRef(null);
|
|
4588
5461
|
const stuck = React.useRef(true);
|
|
5462
|
+
const older = React.useRef(undefined);
|
|
4589
5463
|
const self = room.members.find((member) => member.self);
|
|
4590
5464
|
const personOf = (line) => room.members.find((member) => member.member === line.from)?.name ?? line.name;
|
|
4591
5465
|
const nameOf = (line) => line.agent ? line.agent.name : !line.double ? personOf(line) : line.from === self?.member ? dt("myDouble") : dt("doubleOf", { name: personOf(line) });
|
|
@@ -4616,13 +5490,30 @@ function RoomView({ room, head, onBack }) {
|
|
|
4616
5490
|
book.see(room.id, last.at);
|
|
4617
5491
|
}
|
|
4618
5492
|
}, [lines, room.id]);
|
|
4619
|
-
const
|
|
5493
|
+
const { apps } = useRoomApps(room);
|
|
5494
|
+
const actions = [
|
|
5495
|
+
fileActions(room, async (files) => {
|
|
5496
|
+
if (self && chat) {
|
|
5497
|
+
stuck.current = true;
|
|
5498
|
+
await chat.say("", self, { files });
|
|
5499
|
+
}
|
|
5500
|
+
}),
|
|
5501
|
+
[
|
|
5502
|
+
...RoomRulesUtil.allows(room, "agents") ? [{ key: "invite-agent", label: dt("inviteAgent"), icon: icon("Bot"), run: () => openAgentPicker(room) }] : [],
|
|
5503
|
+
...apps.map((app) => ({ key: `app:${app.id}`, label: app.label, detail: app.status, icon: app.icon, run: () => openApp(room, app) }))
|
|
5504
|
+
]
|
|
5505
|
+
];
|
|
5506
|
+
const say = async (text, images = []) => {
|
|
4620
5507
|
if (!self || !chat) {
|
|
4621
5508
|
throw new Error(t("connecting"));
|
|
4622
5509
|
}
|
|
4623
5510
|
stuck.current = true;
|
|
4624
5511
|
const { to, person } = addressed(text, room, agents);
|
|
4625
|
-
|
|
5512
|
+
const pictures = images.length ? await sendPictures(room, images) : [];
|
|
5513
|
+
await chat.say(text, self, {
|
|
5514
|
+
...to.length ? { to, ...person ? { person: true } : {} } : {},
|
|
5515
|
+
...pictures.length ? { images: pictures } : {}
|
|
5516
|
+
});
|
|
4626
5517
|
};
|
|
4627
5518
|
return /* @__PURE__ */ React.createElement("div", {
|
|
4628
5519
|
className: "trm-room-page"
|
|
@@ -4646,6 +5537,15 @@ function RoomView({ room, head, onBack }) {
|
|
|
4646
5537
|
onScroll: (event) => {
|
|
4647
5538
|
const element = event.currentTarget;
|
|
4648
5539
|
stuck.current = element.scrollHeight - element.scrollTop - element.clientHeight < 48;
|
|
5540
|
+
if (element.scrollTop < 120 && chat?.more && !older.current) {
|
|
5541
|
+
older.current = chat.older().then(() => {
|
|
5542
|
+
return;
|
|
5543
|
+
}, () => {
|
|
5544
|
+
return;
|
|
5545
|
+
}).finally(() => {
|
|
5546
|
+
older.current = undefined;
|
|
5547
|
+
});
|
|
5548
|
+
}
|
|
4649
5549
|
}
|
|
4650
5550
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
4651
5551
|
className: "trm-chat-col"
|
|
@@ -4677,13 +5577,23 @@ function RoomView({ room, head, onBack }) {
|
|
|
4677
5577
|
}, separator && /* @__PURE__ */ React.createElement("div", {
|
|
4678
5578
|
className: "trm-chat-time"
|
|
4679
5579
|
}, time(line.at)), line.from === self?.member && !line.double && !line.agent ? /* @__PURE__ */ React.createElement("div", {
|
|
4680
|
-
className:
|
|
5580
|
+
className: `ta-message ta-user trm-mine${line.pending ? " trm-pending" : ""}`,
|
|
4681
5581
|
title: time(line.at)
|
|
4682
|
-
}, /* @__PURE__ */ React.createElement(
|
|
5582
|
+
}, /* @__PURE__ */ React.createElement(LinePictures, {
|
|
5583
|
+
room: room.id,
|
|
5584
|
+
line,
|
|
5585
|
+
name: nameOf(line)
|
|
5586
|
+
}), /* @__PURE__ */ React.createElement(LineFiles, {
|
|
5587
|
+
room: room.id,
|
|
5588
|
+
line,
|
|
5589
|
+
name: nameOf(line)
|
|
5590
|
+
}), line.text && /* @__PURE__ */ React.createElement("div", {
|
|
4683
5591
|
className: "ta-bubble"
|
|
4684
5592
|
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
4685
5593
|
text: line.text
|
|
4686
|
-
}))
|
|
5594
|
+
})), line.failed && /* @__PURE__ */ React.createElement("div", {
|
|
5595
|
+
className: "trm-unsent"
|
|
5596
|
+
}, t("unsent"))) : /* @__PURE__ */ React.createElement("div", {
|
|
4687
5597
|
className: `trm-msg${first ? " trm-first" : ""}${line.double ? " trm-double" : ""}${line.agent ? " trm-agent" : ""}`
|
|
4688
5598
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
4689
5599
|
className: "trm-msg-face"
|
|
@@ -4700,7 +5610,15 @@ function RoomView({ room, head, onBack }) {
|
|
|
4700
5610
|
className: `trm-tag ${line.agent ? "trm-tag-agent" : "trm-tag-double"}`
|
|
4701
5611
|
}, tagOf(line)), line.task && /* @__PURE__ */ React.createElement("span", {
|
|
4702
5612
|
className: "trm-tag trm-tag-task"
|
|
4703
|
-
}, dt("taskTag"))), /* @__PURE__ */ React.createElement(
|
|
5613
|
+
}, dt("taskTag"))), /* @__PURE__ */ React.createElement(LinePictures, {
|
|
5614
|
+
room: room.id,
|
|
5615
|
+
line,
|
|
5616
|
+
name: nameOf(line)
|
|
5617
|
+
}), /* @__PURE__ */ React.createElement(LineFiles, {
|
|
5618
|
+
room: room.id,
|
|
5619
|
+
line,
|
|
5620
|
+
name: nameOf(line)
|
|
5621
|
+
}), line.text && /* @__PURE__ */ React.createElement("div", {
|
|
4704
5622
|
className: "trm-msg-bubble",
|
|
4705
5623
|
title: time(line.at)
|
|
4706
5624
|
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
@@ -4718,10 +5636,14 @@ function RoomView({ room, head, onBack }) {
|
|
|
4718
5636
|
className: "trm-chat-bottom"
|
|
4719
5637
|
}, /* @__PURE__ */ React.createElement(Drafts, {
|
|
4720
5638
|
room
|
|
5639
|
+
}), /* @__PURE__ */ React.createElement(FileUploads, {
|
|
5640
|
+
room: room.id
|
|
4721
5641
|
}), /* @__PURE__ */ React.createElement(pi.ui.Composer, {
|
|
4722
5642
|
placeholder: t("chatPlaceholder"),
|
|
4723
5643
|
draft: room.id,
|
|
4724
5644
|
onSend: say,
|
|
5645
|
+
images: PICTURE_LIMITS,
|
|
5646
|
+
actions,
|
|
4725
5647
|
mentions,
|
|
4726
5648
|
mentionLabel: rt("mentionPerson")
|
|
4727
5649
|
})));
|
|
@@ -4855,13 +5777,16 @@ function PersonDialog({ person, room, close }) {
|
|
|
4855
5777
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
4856
5778
|
type: "button",
|
|
4857
5779
|
className: "ta-button ta-danger",
|
|
4858
|
-
onClick: () => void
|
|
4859
|
-
await rooms()?.removeFriend(friend.id);
|
|
4860
|
-
close();
|
|
4861
|
-
await book.load();
|
|
4862
|
-
})
|
|
5780
|
+
onClick: () => void removeFriend(friend, close)
|
|
4863
5781
|
}, rt("removeFriendLong")))));
|
|
4864
5782
|
}
|
|
5783
|
+
function removeFriend(friend, then) {
|
|
5784
|
+
return confirmThen(t("removeFriendTitle", { name: friend.name }), t("removeFriendHint"), t("removeFriend"), async () => {
|
|
5785
|
+
await rooms()?.removeFriend(friend.id);
|
|
5786
|
+
then?.();
|
|
5787
|
+
await book.load();
|
|
5788
|
+
});
|
|
5789
|
+
}
|
|
4865
5790
|
function openPerson(person, room) {
|
|
4866
5791
|
show(({ close }) => /* @__PURE__ */ React.createElement(PersonDialog, {
|
|
4867
5792
|
person,
|
|
@@ -5865,43 +6790,6 @@ function openGroupInvite(invite) {
|
|
|
5865
6790
|
}));
|
|
5866
6791
|
}
|
|
5867
6792
|
|
|
5868
|
-
// web-src/room-rules.ts
|
|
5869
|
-
var ROOM_RULES = ["agents", "doubles", "tasks"];
|
|
5870
|
-
var RoomRulesUtil;
|
|
5871
|
-
((RoomRulesUtil) => {
|
|
5872
|
-
function allows(room, rule) {
|
|
5873
|
-
return room?.rules?.[rule] !== false;
|
|
5874
|
-
}
|
|
5875
|
-
RoomRulesUtil.allows = allows;
|
|
5876
|
-
function approves(room) {
|
|
5877
|
-
return room?.rules?.approve === true;
|
|
5878
|
-
}
|
|
5879
|
-
RoomRulesUtil.approves = approves;
|
|
5880
|
-
function refused(rule, language) {
|
|
5881
|
-
return TaLanguageUtil.pick(language, {
|
|
5882
|
-
agents: {
|
|
5883
|
-
"zh-CN": "群主没有允许在这个群里用智能体",
|
|
5884
|
-
"zh-TW": "群主沒有允許在這個群裡用智慧體",
|
|
5885
|
-
"en-US": "the owner allows no agents in this group chat",
|
|
5886
|
-
"ja-JP": "このグループチャットではグループ主がエージェントを許可していません"
|
|
5887
|
-
},
|
|
5888
|
-
doubles: {
|
|
5889
|
-
"zh-CN": "群主没有允许分身在这个群里代答",
|
|
5890
|
-
"zh-TW": "群主沒有允許分身在這個群裡代答",
|
|
5891
|
-
"en-US": "the owner allows no double to answer in this group chat",
|
|
5892
|
-
"ja-JP": "このグループチャットではグループ主が分身の代理応答を許可していません"
|
|
5893
|
-
},
|
|
5894
|
-
tasks: {
|
|
5895
|
-
"zh-CN": "群主没有允许在这个群里给分身派任务",
|
|
5896
|
-
"zh-TW": "群主沒有允許在這個群裡給分身派任務",
|
|
5897
|
-
"en-US": "the owner allows no tasks for doubles in this group chat",
|
|
5898
|
-
"ja-JP": "このグループチャットではグループ主が分身へのタスクを許可していません"
|
|
5899
|
-
}
|
|
5900
|
-
}[rule]);
|
|
5901
|
-
}
|
|
5902
|
-
RoomRulesUtil.refused = refused;
|
|
5903
|
-
})(RoomRulesUtil ||= {});
|
|
5904
|
-
|
|
5905
6793
|
// web-src/rules-i18n.ts
|
|
5906
6794
|
var EN4 = {
|
|
5907
6795
|
rulesManage: "Manage the group chat",
|
|
@@ -5924,6 +6812,9 @@ var EN4 = {
|
|
|
5924
6812
|
joining: "Joining",
|
|
5925
6813
|
capacity: "Members at most",
|
|
5926
6814
|
capacityValue: "Up to {n}",
|
|
6815
|
+
history: "Chat history for new members",
|
|
6816
|
+
historyNone: "None",
|
|
6817
|
+
historyValue: "Last {n} messages",
|
|
5927
6818
|
linkDays: "The link that invites works",
|
|
5928
6819
|
linkDaysValue7: "7 days",
|
|
5929
6820
|
linkDaysValue30: "30 days",
|
|
@@ -5957,6 +6848,9 @@ var ZH4 = {
|
|
|
5957
6848
|
joining: "加入",
|
|
5958
6849
|
capacity: "人数上限",
|
|
5959
6850
|
capacityValue: "最多 {n} 人",
|
|
6851
|
+
history: "新成员可见的聊天记录",
|
|
6852
|
+
historyNone: "不可见",
|
|
6853
|
+
historyValue: "最近 {n} 条",
|
|
5960
6854
|
linkDays: "邀请链接有效期",
|
|
5961
6855
|
linkDaysValue7: "7 天",
|
|
5962
6856
|
linkDaysValue30: "30 天",
|
|
@@ -5990,6 +6884,9 @@ var ZH_TW4 = {
|
|
|
5990
6884
|
joining: "加入",
|
|
5991
6885
|
capacity: "人數上限",
|
|
5992
6886
|
capacityValue: "最多 {n} 人",
|
|
6887
|
+
history: "新成員可見的聊天記錄",
|
|
6888
|
+
historyNone: "不可見",
|
|
6889
|
+
historyValue: "最近 {n} 則",
|
|
5993
6890
|
linkDays: "邀請連結有效期",
|
|
5994
6891
|
linkDaysValue7: "7 天",
|
|
5995
6892
|
linkDaysValue30: "30 天",
|
|
@@ -6023,6 +6920,9 @@ var JA4 = {
|
|
|
6023
6920
|
joining: "参加",
|
|
6024
6921
|
capacity: "人数の上限",
|
|
6025
6922
|
capacityValue: "最大 {n} 人",
|
|
6923
|
+
history: "新しいメンバーが見られる履歴",
|
|
6924
|
+
historyNone: "見られない",
|
|
6925
|
+
historyValue: "直近 {n} 件",
|
|
6026
6926
|
linkDays: "招待リンクの有効期限",
|
|
6027
6927
|
linkDaysValue7: "7 日",
|
|
6028
6928
|
linkDaysValue30: "30 日",
|
|
@@ -6074,6 +6974,7 @@ function GroupRulesRow({ room }) {
|
|
|
6074
6974
|
size: 15
|
|
6075
6975
|
}));
|
|
6076
6976
|
}
|
|
6977
|
+
var HISTORY_CHOICES = [0, 50, 100, 200, 500];
|
|
6077
6978
|
function configure(room, options) {
|
|
6078
6979
|
const call = rooms()?.configureRoom(room.id, options);
|
|
6079
6980
|
return (call ?? Promise.resolve()).catch((error) => {
|
|
@@ -6107,6 +7008,7 @@ function Joining({ room }) {
|
|
|
6107
7008
|
const Check = icon("Check");
|
|
6108
7009
|
const choose = (event, items) => openMenu(event, [items.map((item) => ({ key: item.key, label: item.label, ...item.on ? { icon: Check } : {}, run: item.run }))]);
|
|
6109
7010
|
const capacity = room.capacity ?? MEMBER_CHOICES[0];
|
|
7011
|
+
const history = room.history ?? 0;
|
|
6110
7012
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
6111
7013
|
className: "trm-panel-label"
|
|
6112
7014
|
}, gt("joining")), /* @__PURE__ */ React.createElement(JoinRow, {
|
|
@@ -6129,6 +7031,17 @@ function Joining({ room }) {
|
|
|
6129
7031
|
on: n === days,
|
|
6130
7032
|
run: () => void setLinkDays(room.id, n).then(() => pi.ui.notify(gt("linkDaysHint"))).catch((error) => pi.ui.notify(message(error), "error"))
|
|
6131
7033
|
})))
|
|
7034
|
+
}), /* @__PURE__ */ React.createElement(JoinRow, {
|
|
7035
|
+
label: gt("history"),
|
|
7036
|
+
value: history ? gt("historyValue", { n: history }) : gt("historyNone"),
|
|
7037
|
+
onClick: (event) => choose(event, HISTORY_CHOICES.map((n) => ({
|
|
7038
|
+
key: String(n),
|
|
7039
|
+
label: n ? gt("historyValue", { n }) : gt("historyNone"),
|
|
7040
|
+
on: n === history,
|
|
7041
|
+
run: () => void configure(room, { history: n }).catch(() => {
|
|
7042
|
+
return;
|
|
7043
|
+
})
|
|
7044
|
+
})))
|
|
6132
7045
|
}), menu, /* @__PURE__ */ React.createElement("div", {
|
|
6133
7046
|
className: "trm-panel-sep"
|
|
6134
7047
|
}));
|
|
@@ -6590,11 +7503,12 @@ function roomPreview(room, last) {
|
|
|
6590
7503
|
}
|
|
6591
7504
|
const self = room.members.find((each) => each.self)?.member;
|
|
6592
7505
|
if (direct && !last.agent && !last.double) {
|
|
6593
|
-
return plain(last
|
|
7506
|
+
return plain(RelayRoomChatUtil.preview(last, t("picture"), { file: t("file"), voice: t("voice"), video: t("video") }));
|
|
6594
7507
|
}
|
|
6595
7508
|
const person = room.members.find((each) => each.member === last.from)?.name ?? last.name;
|
|
6596
7509
|
const name = last.agent?.name ?? (!last.double ? person : last.from === self ? dt("myDouble") : dt("doubleOf", { name: person }));
|
|
6597
|
-
|
|
7510
|
+
const said = plain(RelayRoomChatUtil.preview(last, t("picture"), { file: t("file"), voice: t("voice"), video: t("video") }));
|
|
7511
|
+
return last.from === self && !last.agent && !last.double ? said : t("said", { name, text: said });
|
|
6598
7512
|
}
|
|
6599
7513
|
function lastAt(room) {
|
|
6600
7514
|
const lines = room.status === "member" ? book.chat(room.id)?.lines : undefined;
|
|
@@ -7259,9 +8173,15 @@ class RoomsPartners {
|
|
|
7259
8173
|
icon: icon("Contact"),
|
|
7260
8174
|
...friend.status === "adding" ? { status: "waiting", about: t("friendAdding") } : {},
|
|
7261
8175
|
...online ? { online } : {},
|
|
7262
|
-
chat: shared ? { last: t("friendShareRow", { title: shared.title || shared.link }), at: shared.at, unseen: true } : direct ? {
|
|
8176
|
+
chat: shared ? { last: t("friendShareRow", { title: shared.title || shared.link }), at: shared.at, unseen: true } : direct ? {
|
|
8177
|
+
last: roomPreview(direct, said.at(-1)) || undefined,
|
|
8178
|
+
at,
|
|
8179
|
+
unseen: unseen(direct, said, book.get().seen),
|
|
8180
|
+
close: { key: "close", label: rt("directDelete"), danger: true, run: () => void leaveRoom(direct) }
|
|
8181
|
+
} : undefined,
|
|
7263
8182
|
open: () => shared ? openFriendShare(shared) : friend.status === "friend" ? openDirect(friend) : openFriend(friend.id),
|
|
7264
|
-
|
|
8183
|
+
info: () => openPerson({ id: friend.id, name: friend.name }),
|
|
8184
|
+
remove: { key: "remove", label: rt("removeFriendLong"), danger: true, run: () => void removeFriend(friend) }
|
|
7265
8185
|
};
|
|
7266
8186
|
}
|
|
7267
8187
|
groupOf(room) {
|
|
@@ -7275,10 +8195,12 @@ class RoomsPartners {
|
|
|
7275
8195
|
size
|
|
7276
8196
|
})),
|
|
7277
8197
|
icon: icon("Users"),
|
|
8198
|
+
friends: true,
|
|
7278
8199
|
about: t("roomOf", { name: room.ownerName }),
|
|
7279
8200
|
chat: { last: roomPreview(room, said.at(-1)) || undefined, at: lastAt(room), unseen: unseen(room, said, book.get().seen) },
|
|
7280
8201
|
open: () => openRoom(room.id, true),
|
|
7281
|
-
|
|
8202
|
+
info: () => void openRoom(room.id, true).then(() => pi.ui.showView(MEMBERS_VIEW)),
|
|
8203
|
+
remove: { key: "leave", label: room.owner ? t("close") : t("leave"), danger: true, run: () => void leaveRoom(room) }
|
|
7282
8204
|
};
|
|
7283
8205
|
}
|
|
7284
8206
|
asking(request) {
|
|
@@ -7480,6 +8402,8 @@ var STYLE = `
|
|
|
7480
8402
|
.trm-chat-empty strong { margin-top: 6px; color: var(--ta-text); font-size: calc(16px * var(--ta-font-scale)); }
|
|
7481
8403
|
.trm-chat-hint { margin-top: 4px; font-size: calc(12px * var(--ta-font-scale)); line-height: 1.6; }
|
|
7482
8404
|
.trm-mine { margin: 6px 0 2px; }
|
|
8405
|
+
.trm-pending .ta-bubble { opacity: 0.6; transition: opacity 0.2s; }
|
|
8406
|
+
.trm-unsent { align-self: flex-end; margin-top: 2px; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
|
|
7483
8407
|
.trm-msg { display: flex; align-items: flex-start; gap: 10px; }
|
|
7484
8408
|
.trm-msg.trm-first { margin-top: 10px; }
|
|
7485
8409
|
.trm-msg-face { display: flex; justify-content: center; width: 28px; flex: none; }
|
|
@@ -7487,6 +8411,26 @@ var STYLE = `
|
|
|
7487
8411
|
.trm-msg-name { margin: 0 2px 4px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); line-height: calc(16px * var(--ta-font-scale)); }
|
|
7488
8412
|
.trm-msg-bubble { min-width: 0; max-width: 100%; padding: 9px 14px; border: 1px solid var(--ta-border-muted); border-radius: 5px 16px 16px 16px; background: var(--ta-side); color: var(--ta-body); line-height: 1.6; overflow-wrap: anywhere; }
|
|
7489
8413
|
.trm-msg-bubble pre { max-width: 100%; overflow-x: auto; }
|
|
8414
|
+
/* Pictures of a line (ui.ChatImages), no bubble around them, on the side of who sent them. */
|
|
8415
|
+
.trm-pics { margin: 1px 0 3px; }
|
|
8416
|
+
.trm-mine .trm-pics { align-self: flex-end; }
|
|
8417
|
+
.trm-files { display: flex; flex-direction: column; gap: 6px; margin: 1px 0 3px; max-width: min(78%, 280px); }
|
|
8418
|
+
.trm-mine .trm-files { align-self: flex-end; align-items: flex-end; }
|
|
8419
|
+
.trm-file { display: flex; align-items: center; gap: 12px; width: 240px; max-width: 100%; padding: 10px 12px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-side); color: var(--ta-secondary); text-align: left; cursor: pointer; }
|
|
8420
|
+
.trm-file-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
|
|
8421
|
+
.trm-file-name { color: var(--ta-body); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
|
|
8422
|
+
.trm-file-size { font-size: calc(11.5px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
|
|
8423
|
+
.trm-voice { display: inline-flex; align-items: center; gap: 8px; min-width: 72px; max-width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--ta-border-muted); border-radius: 5px 16px 16px 16px; background: var(--ta-side); color: var(--ta-body); font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; cursor: pointer; }
|
|
8424
|
+
.trm-mine .trm-voice { flex-direction: row-reverse; border: 0; border-radius: 16px 16px 5px 16px; background: var(--ta-user); color: var(--ta-text); }
|
|
8425
|
+
.trm-video { position: relative; width: 200px; max-height: 300px; border: 0; border-radius: 10px; background: #222 center / cover no-repeat; overflow: hidden; cursor: pointer; }
|
|
8426
|
+
.trm-video-mark { position: absolute; inset: 0; margin: auto; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0, 0, 0, 0.45); color: #fff; }
|
|
8427
|
+
.trm-video-time { position: absolute; right: 8px; bottom: 6px; color: #fff; font-size: calc(11.5px * var(--ta-font-scale)); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); font-variant-numeric: tabular-nums; }
|
|
8428
|
+
.trm-video-play { display: block; width: 100%; max-height: 70vh; border-radius: 8px; background: #000; }
|
|
8429
|
+
.trm-uploads { display: flex; flex-direction: column; gap: 4px; padding: 4px 12px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8430
|
+
.trm-upload { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
8431
|
+
.trm-recorder { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 4px; }
|
|
8432
|
+
.trm-recorder-dot { width: 12px; height: 12px; border-radius: 50%; background: #e5484d; animation: trm-breathe 1.2s ease-in-out infinite; }
|
|
8433
|
+
.trm-recorder-time { font-size: calc(28px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; color: var(--ta-body); }
|
|
7490
8434
|
.trm-chat-bottom { flex: none; width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
7491
8435
|
/* Above the keyboard the home indicator is not there: no room for it, as under the box of a conversation. */
|
|
7492
8436
|
:root[data-keyboard] .trm-chat-bottom { padding-bottom: 8px; }
|