@celljs/ta-sync 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +9 -7
- package/README.md +9 -7
- package/host/index.mjs +571 -35
- package/package.json +4 -4
- package/web/index.js +559 -86
package/web/index.js
CHANGED
|
@@ -37,6 +37,69 @@ var TaLanguageUtil;
|
|
|
37
37
|
TaLanguageUtil2.list = list;
|
|
38
38
|
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
39
39
|
|
|
40
|
+
// web-src/sync-protocol.ts
|
|
41
|
+
var SYNC_PACKAGE = "@celljs/ta-sync";
|
|
42
|
+
var SYNC_VIEW = `${SYNC_PACKAGE}/devices`;
|
|
43
|
+
var SYNC_RESOURCES = [
|
|
44
|
+
"settings",
|
|
45
|
+
"instructions",
|
|
46
|
+
"skills",
|
|
47
|
+
"models",
|
|
48
|
+
"extensions",
|
|
49
|
+
"data",
|
|
50
|
+
"conversations",
|
|
51
|
+
"secrets",
|
|
52
|
+
"identity"
|
|
53
|
+
];
|
|
54
|
+
var SyncWhere;
|
|
55
|
+
((SyncWhere) => {
|
|
56
|
+
function conversations(where, store) {
|
|
57
|
+
return where === "folder" || where === "store" && store !== "git";
|
|
58
|
+
}
|
|
59
|
+
SyncWhere.conversations = conversations;
|
|
60
|
+
function of(service) {
|
|
61
|
+
return service.type === "ta-relay" ? { where: "relay" } : service.type === "folder" ? { where: "folder" } : { where: "store", store: service.type };
|
|
62
|
+
}
|
|
63
|
+
SyncWhere.of = of;
|
|
64
|
+
})(SyncWhere ||= {});
|
|
65
|
+
var SyncKeys;
|
|
66
|
+
((SyncKeys) => {
|
|
67
|
+
SyncKeys.RESOURCES = "resources";
|
|
68
|
+
SyncKeys.REPORT = "report";
|
|
69
|
+
SyncKeys.STATUS = "status";
|
|
70
|
+
SyncKeys.JOINING = "joining";
|
|
71
|
+
})(SyncKeys ||= {});
|
|
72
|
+
var SyncStateKeys;
|
|
73
|
+
((SyncStateKeys) => {
|
|
74
|
+
SyncStateKeys.ITEM = "item:";
|
|
75
|
+
SyncStateKeys.BLOB = "blob:";
|
|
76
|
+
SyncStateKeys.DEVICE = "device:";
|
|
77
|
+
function item(id) {
|
|
78
|
+
return `${SyncStateKeys.ITEM}${id}`;
|
|
79
|
+
}
|
|
80
|
+
SyncStateKeys.item = item;
|
|
81
|
+
function blob(hash, index) {
|
|
82
|
+
return `${SyncStateKeys.BLOB}${hash}:${index}`;
|
|
83
|
+
}
|
|
84
|
+
SyncStateKeys.blob = blob;
|
|
85
|
+
function device(member) {
|
|
86
|
+
return `${SyncStateKeys.DEVICE}${member}`;
|
|
87
|
+
}
|
|
88
|
+
SyncStateKeys.device = device;
|
|
89
|
+
})(SyncStateKeys ||= {});
|
|
90
|
+
var SyncDeclarations;
|
|
91
|
+
((SyncDeclarations) => {
|
|
92
|
+
SyncDeclarations.SHELL = {
|
|
93
|
+
"@celljs/ta-web": ["settings", "assistant.species", "assistant.gait"]
|
|
94
|
+
};
|
|
95
|
+
function keys(manifest) {
|
|
96
|
+
const pi = manifest && typeof manifest === "object" ? manifest.pi : undefined;
|
|
97
|
+
const sync = pi?.sync;
|
|
98
|
+
return Array.isArray(sync) ? [...new Set(sync.filter((key) => typeof key === "string" && key.length > 0 && key.length <= 200))] : [];
|
|
99
|
+
}
|
|
100
|
+
SyncDeclarations.keys = keys;
|
|
101
|
+
})(SyncDeclarations ||= {});
|
|
102
|
+
|
|
40
103
|
// web-src/i18n.ts
|
|
41
104
|
var en = {
|
|
42
105
|
title: "Sync",
|
|
@@ -50,7 +113,7 @@ var en = {
|
|
|
50
113
|
joinHint: "Paste the link of Add a device on a computer that syncs.",
|
|
51
114
|
joinAction: "Join",
|
|
52
115
|
leadShort: "Your settings, skills, instructions and extensions the same on each of your computers. No account; sealed end to end.",
|
|
53
|
-
leadFolderShort: "Your settings, skills, instructions and
|
|
116
|
+
leadFolderShort: "Your settings, skills, instructions, extensions and conversations the same on each of your computers, through a folder of your cloud drive. No relay at all.",
|
|
54
117
|
viaRelay: "Through {name}",
|
|
55
118
|
viaFolder: "Through the folder {name}",
|
|
56
119
|
leadStoreShort: "Your settings, skills, instructions and extensions the same on each of your computers, through storage of your own (WebDAV, S3, a git repository), sealed before it leaves. No relay at all.",
|
|
@@ -59,7 +122,7 @@ var en = {
|
|
|
59
122
|
waitingHint: "It goes on by itself once allowed.",
|
|
60
123
|
replacedShort: "What a sync replaced here is kept. ",
|
|
61
124
|
showFolder: "Show in folder",
|
|
62
|
-
leadFolder: "Keep your settings, skills, instructions and
|
|
125
|
+
leadFolder: "Keep your settings, skills, instructions, extensions and conversations the same on your other computers through the folder {path}, which your cloud drive keeps the same on them. No relay, no account: Ta seals everything it writes there.",
|
|
63
126
|
inFolder: "Through the folder {path}",
|
|
64
127
|
inviteFolderHint: "On the other computer, open Settings → Sync → Join a sync in Ta and paste this link. It holds the key of the sync for good: show it only to your own computers. The other computer needs the same folder of the drive.",
|
|
65
128
|
stopFolder: "This computer stops syncing and keeps what it has now; the others go on through the folder.",
|
|
@@ -116,6 +179,37 @@ var en = {
|
|
|
116
179
|
extensionsHint: "Packages installed from npm or git, and the extensions you made",
|
|
117
180
|
data: "Data of extensions",
|
|
118
181
|
dataHint: "What extensions keep for you everywhere, as the look of Ta and of your double",
|
|
182
|
+
conversations: "Conversations",
|
|
183
|
+
conversationsHint: "Every conversation, to go on with it on another computer; only through a drive, WebDAV or S3 of your own, never a relay",
|
|
184
|
+
conversationsOff: "Synced only through a folder of a drive, WebDAV or S3; not through a relay or git",
|
|
185
|
+
secrets: "Vault",
|
|
186
|
+
secretsHint: "Sign-ins, keys and personal details of the vault, sealed end to end, but those you keep to one computer",
|
|
187
|
+
whereTitle: "Where it syncs",
|
|
188
|
+
official: "Official relay",
|
|
189
|
+
whereRelay: "Relay",
|
|
190
|
+
whereFolder: "Drive folder",
|
|
191
|
+
withTalks: "With conversations",
|
|
192
|
+
withoutTalks: "No conversations",
|
|
193
|
+
whereRelayNote: "Through a relay: settings, skills, extensions and the like. Through a drive, WebDAV or S3 the conversations come too, so a new computer that joins has them.",
|
|
194
|
+
whereOwnNote: "Through {name}: sealed before it leaves this computer, no relay at all.",
|
|
195
|
+
whereGitNote: "Through {name}, without the conversations: git keeps every change of them in its history.",
|
|
196
|
+
whereLocked: "Sync is on: stop it to choose another place.",
|
|
197
|
+
whereRelayMore: "Relays of your own are added in Settings → Relays.",
|
|
198
|
+
useThis: "Use",
|
|
199
|
+
inUse: "In use",
|
|
200
|
+
folderHint: "A folder your cloud drive keeps the same on your computers",
|
|
201
|
+
folderPlaceholder: "A folder, as ~/Dropbox/Ta",
|
|
202
|
+
useDrive: "Use {name}",
|
|
203
|
+
add: "Add",
|
|
204
|
+
storeName: "Name",
|
|
205
|
+
optional: "optional",
|
|
206
|
+
storeNote: "Ta tries it first: it writes a small file and removes it. What sync puts there is sealed on this computer; the password stays in relays.json here alone.",
|
|
207
|
+
storeAdd: "Add and sync there",
|
|
208
|
+
moveTitle: "Move at once",
|
|
209
|
+
moveOutHint: "Straight over your network, conversations and sign-ins too",
|
|
210
|
+
moveInHint: "Scan a code, or take it from a computer nearby",
|
|
211
|
+
moveFileHint: "Keep it all in one file, with a password if you like",
|
|
212
|
+
moveNote: "Syncing through a drive, WebDAV or S3, a new computer that joins gets the conversations: no move needed.",
|
|
119
213
|
identity: "Identity and group chats",
|
|
120
214
|
identityHint: "The same you in group chats on every computer, with your group chats and friends; the one in use answers when someone asks your double",
|
|
121
215
|
identityAskTitle: "Be the same you in group chats on your computers?",
|
|
@@ -134,7 +228,7 @@ var zh = {
|
|
|
134
228
|
joinHint: "粘贴已同步的电脑上“添加设备”给出的链接。",
|
|
135
229
|
joinAction: "加入",
|
|
136
230
|
leadShort: "让你的每台电脑都有同样的设置、技能、指令和扩展。不用账号,端到端加密。",
|
|
137
|
-
leadFolderShort: "
|
|
231
|
+
leadFolderShort: "经网盘里的文件夹,让你的每台电脑都有同样的设置、技能、指令、扩展和对话。完全不经过中继。",
|
|
138
232
|
viaRelay: "经 {name}",
|
|
139
233
|
viaFolder: "经文件夹 {name}",
|
|
140
234
|
leadStoreShort: "经你自己的存储(WebDAV、S3、git 仓库),让你的每台电脑都有同样的设置、技能、指令和扩展。离开电脑前就已加密,完全不经过中继。",
|
|
@@ -143,7 +237,7 @@ var zh = {
|
|
|
143
237
|
waitingHint: "对方同意后自动开始。",
|
|
144
238
|
replacedShort: "同步覆盖的原有内容已留底。",
|
|
145
239
|
showFolder: "在文件夹中显示",
|
|
146
|
-
leadFolder: "通过网盘在几台电脑间保持一致的文件夹 {path}
|
|
240
|
+
leadFolder: "通过网盘在几台电脑间保持一致的文件夹 {path},让你的其他电脑也有同样的设置、技能、指令、扩展和对话。不经过中继,不用账号:Ta 写进去的内容都先加密。",
|
|
147
241
|
inFolder: "经文件夹 {path} 同步",
|
|
148
242
|
inviteFolderHint: "在另一台电脑的 Ta 里打开 设置 → 设备同步 → 加入已有的同步,粘贴这个链接。链接里有同步的密钥且长期有效,只给你自己的电脑。另一台电脑需要能访问网盘里的同一个文件夹。",
|
|
149
243
|
stopFolder: "这台电脑停止同步,保留现在的内容;其他电脑继续经文件夹同步。",
|
|
@@ -200,6 +294,37 @@ var zh = {
|
|
|
200
294
|
extensionsHint: "从 npm、git 安装的扩展包,以及你自己做的扩展",
|
|
201
295
|
data: "扩展数据",
|
|
202
296
|
dataHint: "扩展声明要同步的数据,比如 Ta 的外观设置和分身的样子",
|
|
297
|
+
conversations: "对话",
|
|
298
|
+
conversationsHint: "所有对话,换一台电脑也能接着聊;只经你自己的网盘、WebDAV 或 S3,不经中继",
|
|
299
|
+
conversationsOff: "用网盘文件夹、WebDAV 或 S3 同步时才同步对话;经中继或 git 时不同步",
|
|
300
|
+
secrets: "保险箱",
|
|
301
|
+
secretsHint: "保险箱里的登录、密钥和个人信息,端到端加密;设为只留本机的不同步",
|
|
302
|
+
whereTitle: "同步存在哪",
|
|
303
|
+
official: "官方中继",
|
|
304
|
+
whereRelay: "中继",
|
|
305
|
+
whereFolder: "网盘文件夹",
|
|
306
|
+
withTalks: "含对话",
|
|
307
|
+
withoutTalks: "不含对话",
|
|
308
|
+
whereRelayNote: "经中继只同步设置、技能、扩展等;换成网盘、WebDAV 或 S3,对话也会一起同步,新电脑加入就等于迁入。",
|
|
309
|
+
whereOwnNote: "经 {name}:内容离开电脑前就已加密,不经过中继。",
|
|
310
|
+
whereGitNote: "经 {name},不含对话:git 会把对话的每次变化都留在历史里。",
|
|
311
|
+
whereLocked: "同步进行中:停止同步后才能换地方。",
|
|
312
|
+
whereRelayMore: "自己的中继在 设置 → 中继服务 里添加。",
|
|
313
|
+
useThis: "使用",
|
|
314
|
+
inUse: "正在用",
|
|
315
|
+
folderHint: "由网盘在你几台电脑间保持一致的文件夹",
|
|
316
|
+
folderPlaceholder: "文件夹路径,如 ~/Dropbox/Ta",
|
|
317
|
+
useDrive: "用 {name}",
|
|
318
|
+
add: "添加",
|
|
319
|
+
storeName: "名称",
|
|
320
|
+
optional: "可不填",
|
|
321
|
+
storeNote: "Ta 会先试一下:写入再删掉一个小文件。同步放进去的内容在本机就已加密;密码只存在这台电脑的 relays.json 里。",
|
|
322
|
+
storeAdd: "添加并用于同步",
|
|
323
|
+
moveTitle: "一次搬过去",
|
|
324
|
+
moveOutHint: "同一网络直连,含对话和登录",
|
|
325
|
+
moveInHint: "扫码或从附近的电脑接收",
|
|
326
|
+
moveFileHint: "存成一个文件带过去,可设密码",
|
|
327
|
+
moveNote: "已用网盘、WebDAV 或 S3 同步时,新电脑加入同步就会拿到对话,不必再迁移。",
|
|
203
328
|
identity: "身份与群聊",
|
|
204
329
|
identityHint: "每台电脑在群里都是同一个你,群聊和好友也一样;别人 @ 你的分身时,由正在用的那台回答",
|
|
205
330
|
identityAskTitle: "让这几台电脑在群里都是同一个你?",
|
|
@@ -218,7 +343,7 @@ var zhTw = {
|
|
|
218
343
|
joinHint: "貼上已同步的電腦上「新增裝置」給出的連結。",
|
|
219
344
|
joinAction: "加入",
|
|
220
345
|
leadShort: "讓你的每台電腦都有同樣的設定、技能、指令和擴充功能。不用帳號,端到端加密。",
|
|
221
|
-
leadFolderShort: "
|
|
346
|
+
leadFolderShort: "經網盤裡的資料夾,讓你的每台電腦都有同樣的設定、技能、指令、擴充功能和對話。完全不經過中繼。",
|
|
222
347
|
viaRelay: "經 {name}",
|
|
223
348
|
viaFolder: "經資料夾 {name}",
|
|
224
349
|
leadStoreShort: "經你自己的儲存(WebDAV、S3、git 儲存庫),讓你的每台電腦都有同樣的設定、技能、指令和擴充功能。離開電腦前就已加密,完全不經過中繼。",
|
|
@@ -227,7 +352,7 @@ var zhTw = {
|
|
|
227
352
|
waitingHint: "對方同意後自動開始。",
|
|
228
353
|
replacedShort: "同步覆蓋的原有內容已留底。",
|
|
229
354
|
showFolder: "在資料夾中顯示",
|
|
230
|
-
leadFolder: "通過網盤在幾台電腦間保持一致的資料夾 {path}
|
|
355
|
+
leadFolder: "通過網盤在幾台電腦間保持一致的資料夾 {path},讓你的其他電腦也有同樣的設定、技能、指令、擴充功能和對話。不經過中繼,不用帳號:Ta 寫進去的內容都先加密。",
|
|
231
356
|
inFolder: "經資料夾 {path} 同步",
|
|
232
357
|
inviteFolderHint: "在另一台電腦的 Ta 裡開啟 設定 → 裝置同步 → 加入已有的同步,貼上這個連結。連結裡有同步的金鑰且長期有效,只給你自己的電腦。另一台電腦需要能存取網盤裡的同一個資料夾。",
|
|
233
358
|
stopFolder: "這台電腦停止同步,保留現在的內容;其他電腦繼續經資料夾同步。",
|
|
@@ -284,6 +409,37 @@ var zhTw = {
|
|
|
284
409
|
extensionsHint: "從 npm、git 安裝的擴充功能包,以及你自己做的擴充功能",
|
|
285
410
|
data: "擴充功能資料",
|
|
286
411
|
dataHint: "擴充功能宣告要同步的資料,比如 Ta 的外觀設定和分身的樣子",
|
|
412
|
+
conversations: "對話",
|
|
413
|
+
conversationsHint: "所有對話,換一台電腦也能接著聊;只經你自己的網盤、WebDAV 或 S3,不經中繼",
|
|
414
|
+
conversationsOff: "用網盤資料夾、WebDAV 或 S3 同步時才同步對話;經中繼或 git 時不同步",
|
|
415
|
+
secrets: "保險箱",
|
|
416
|
+
secretsHint: "保險箱裡的登入、金鑰和個人資訊,端到端加密;設為只留本機的不同步",
|
|
417
|
+
whereTitle: "同步存在哪",
|
|
418
|
+
official: "官方中繼",
|
|
419
|
+
whereRelay: "中繼",
|
|
420
|
+
whereFolder: "網盤資料夾",
|
|
421
|
+
withTalks: "含對話",
|
|
422
|
+
withoutTalks: "不含對話",
|
|
423
|
+
whereRelayNote: "經中繼只同步設定、技能、擴充功能等;換成網盤、WebDAV 或 S3,對話也會一起同步,新電腦加入就等於遷入。",
|
|
424
|
+
whereOwnNote: "經 {name}:內容離開電腦前就已加密,不經過中繼。",
|
|
425
|
+
whereGitNote: "經 {name},不含對話:git 會把對話的每次變化都留在歷史裡。",
|
|
426
|
+
whereLocked: "同步進行中:停止同步後才能換地方。",
|
|
427
|
+
whereRelayMore: "自己的中繼在 設定 → 中繼服務 裡新增。",
|
|
428
|
+
useThis: "使用",
|
|
429
|
+
inUse: "正在用",
|
|
430
|
+
folderHint: "由網盤在你幾台電腦間保持一致的資料夾",
|
|
431
|
+
folderPlaceholder: "資料夾路徑,如 ~/Dropbox/Ta",
|
|
432
|
+
useDrive: "用 {name}",
|
|
433
|
+
add: "新增",
|
|
434
|
+
storeName: "名稱",
|
|
435
|
+
optional: "可不填",
|
|
436
|
+
storeNote: "Ta 會先試一下:寫入再刪掉一個小檔案。同步放進去的內容在本機就已加密;密碼只存在這台電腦的 relays.json 裡。",
|
|
437
|
+
storeAdd: "新增並用於同步",
|
|
438
|
+
moveTitle: "一次搬過去",
|
|
439
|
+
moveOutHint: "同一網路直連,含對話和登入",
|
|
440
|
+
moveInHint: "掃碼或從附近的電腦接收",
|
|
441
|
+
moveFileHint: "存成一個檔案帶過去,可設密碼",
|
|
442
|
+
moveNote: "已用網盤、WebDAV 或 S3 同步時,新電腦加入同步就會拿到對話,不必再遷移。",
|
|
287
443
|
identity: "身份與群聊",
|
|
288
444
|
identityHint: "每台電腦在群裡都是同一個你,群聊和好友也一樣;別人 @ 你的分身時,由正在用的那台回答",
|
|
289
445
|
identityAskTitle: "讓這幾台電腦在群裡都是同一個你?",
|
|
@@ -302,7 +458,7 @@ var ja = {
|
|
|
302
458
|
joinHint: "同期済みのコンピューターで「デバイスを追加」から提供されたリンクを貼り付けます。",
|
|
303
459
|
joinAction: "参加",
|
|
304
460
|
leadShort: "各コンピューターが同じ設定、スキル、指示、拡張機能を持つようにします。アカウント不要、エンドツーエンド暗号化。",
|
|
305
|
-
leadFolderShort: "
|
|
461
|
+
leadFolderShort: "クラウドドライブ内のフォルダーを通じて、各コンピューターが同じ設定、スキル、指示、拡張機能、会話を持つようにします。リレーを完全に迂回します。",
|
|
306
462
|
viaRelay: "{name}経由",
|
|
307
463
|
viaFolder: "フォルダー {name} 経由",
|
|
308
464
|
leadStoreShort: "独自のストレージ(WebDAV、S3、git リポジトリ)を通じて、各コンピューターが同じ設定、スキル、指示、拡張機能を持つようにします。コンピューターを離れる前に暗号化されます。リレーを完全に迂回します。",
|
|
@@ -368,6 +524,37 @@ var ja = {
|
|
|
368
524
|
extensionsHint: "npm、git からインストールされた拡張機能パッケージ、および自分で作成した拡張機能",
|
|
369
525
|
data: "拡張機能のデータ",
|
|
370
526
|
dataHint: "拡張機能が同期することを宣言するデータ。Ta の外観設定や分身の外観など",
|
|
527
|
+
conversations: "会話",
|
|
528
|
+
conversationsHint: "すべての会話。別のコンピューターでも続きから話せます。自分のドライブ、WebDAV、S3 だけを通り、リレーは通りません",
|
|
529
|
+
conversationsOff: "ドライブのフォルダー、WebDAV、S3 で同期するときだけ会話を同期します。リレーや git では同期しません",
|
|
530
|
+
secrets: "金庫",
|
|
531
|
+
secretsHint: "金庫のサインイン、鍵、個人情報。エンドツーエンドで暗号化。この端末だけに置くものは同期しません",
|
|
532
|
+
whereTitle: "同期先",
|
|
533
|
+
official: "公式リレー",
|
|
534
|
+
whereRelay: "リレー",
|
|
535
|
+
whereFolder: "ドライブのフォルダー",
|
|
536
|
+
withTalks: "会話も",
|
|
537
|
+
withoutTalks: "会話なし",
|
|
538
|
+
whereRelayNote: "リレー経由では設定、スキル、拡張機能などを同期します。ドライブ、WebDAV、S3 なら会話も同期され、新しいコンピューターは参加するだけで移行できます。",
|
|
539
|
+
whereOwnNote: "{name} 経由:コンピューターを離れる前に暗号化され、リレーは通りません。",
|
|
540
|
+
whereGitNote: "{name} 経由、会話なし:git は会話の変更をすべて履歴に残すためです。",
|
|
541
|
+
whereLocked: "同期中です。停止すると同期先を変えられます。",
|
|
542
|
+
whereRelayMore: "自分のリレーは 設定 → リレー で追加します。",
|
|
543
|
+
useThis: "使う",
|
|
544
|
+
inUse: "使用中",
|
|
545
|
+
folderHint: "クラウドドライブが各コンピューターで同じに保つフォルダー",
|
|
546
|
+
folderPlaceholder: "フォルダー、例 ~/Dropbox/Ta",
|
|
547
|
+
useDrive: "{name} を使う",
|
|
548
|
+
add: "追加",
|
|
549
|
+
storeName: "名前",
|
|
550
|
+
optional: "任意",
|
|
551
|
+
storeNote: "Ta はまず小さなファイルを書いて消してみます。同期する内容はこのコンピューターで暗号化され、パスワードはここの relays.json にだけ保存されます。",
|
|
552
|
+
storeAdd: "追加して同期に使う",
|
|
553
|
+
moveTitle: "一度に移す",
|
|
554
|
+
moveOutHint: "同じネットワークで直接、会話とサインインも",
|
|
555
|
+
moveInHint: "コードを読み取るか、近くのコンピューターから受け取る",
|
|
556
|
+
moveFileHint: "ひとつのファイルにまとめて持っていく。パスワードも設定可",
|
|
557
|
+
moveNote: "ドライブ、WebDAV、S3 で同期していれば、新しいコンピューターは参加するだけで会話も届きます。移行は不要です。",
|
|
371
558
|
identity: "身元とグループチャット",
|
|
372
559
|
identityHint: "各コンピューターではグループ内で同じあなたです。グループチャットと友だちも同じです。誰かがあなたの分身に @-mention したとき、使用中のコンピューターが応答します",
|
|
373
560
|
identityAskTitle: "これらのコンピューターをグループ内で同じあなたにしますか?",
|
|
@@ -385,8 +572,9 @@ var SyncWords;
|
|
|
385
572
|
return text.replace(/\{(\w+)\}/g, (match, key) => values[key] === undefined ? match : String(values[key]));
|
|
386
573
|
}
|
|
387
574
|
SyncWords.format = format;
|
|
388
|
-
function resource(words, resource2) {
|
|
389
|
-
|
|
575
|
+
function resource(words, resource2, status) {
|
|
576
|
+
const off = resource2 === "conversations" && status && !SyncWhere.conversations(status.where, status.store?.type);
|
|
577
|
+
return { label: words[resource2], hint: off ? words.conversationsOff : words[`${resource2}Hint`] };
|
|
390
578
|
}
|
|
391
579
|
SyncWords.resource = resource;
|
|
392
580
|
function when(words, at, now = Date.now()) {
|
|
@@ -1588,10 +1776,10 @@ function FileView({ pi, store, chosen }) {
|
|
|
1588
1776
|
run: () => store.call("migrateImport", path.trim(), restorePassword)
|
|
1589
1777
|
})));
|
|
1590
1778
|
}
|
|
1591
|
-
function MovePanel({ pi, store }) {
|
|
1779
|
+
function MovePanel({ pi, store, initial = "out" }) {
|
|
1592
1780
|
const words = useWords(pi);
|
|
1593
1781
|
const status = useMove(store);
|
|
1594
|
-
const [tab, setTab] = React.useState(
|
|
1782
|
+
const [tab, setTab] = React.useState(initial);
|
|
1595
1783
|
const [chosen, setChosen] = React.useState(() => new Set(MIGRATE_CATEGORIES.filter((category) => DEFAULT_CATEGORIES[category])));
|
|
1596
1784
|
const [counts, setCounts] = React.useState();
|
|
1597
1785
|
React.useEffect(() => {
|
|
@@ -1719,6 +1907,56 @@ function MoveAskDialog({ pi, store, close }) {
|
|
|
1719
1907
|
}))))));
|
|
1720
1908
|
}
|
|
1721
1909
|
|
|
1910
|
+
// web-src/move-entries.tsx
|
|
1911
|
+
function MoveEntries({ pi, store }) {
|
|
1912
|
+
const words = SyncWords.of(pi.ui.language);
|
|
1913
|
+
const move = MoveWordsUtil.of(pi.ui.language);
|
|
1914
|
+
const title = move.title;
|
|
1915
|
+
const open = (initial) => pi.ui.custom(({ close }) => /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1916
|
+
title,
|
|
1917
|
+
onClose: close
|
|
1918
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1919
|
+
className: "tsy-move-dialog"
|
|
1920
|
+
}, /* @__PURE__ */ React.createElement(MovePanel, {
|
|
1921
|
+
pi,
|
|
1922
|
+
store,
|
|
1923
|
+
initial
|
|
1924
|
+
}))));
|
|
1925
|
+
const rows = [
|
|
1926
|
+
["out", "Upload", move.outTitle, words.moveOutHint],
|
|
1927
|
+
["in", "Download", move.inTitle, words.moveInHint],
|
|
1928
|
+
["file", "FileArchive", move.fileTitle, words.moveFileHint]
|
|
1929
|
+
];
|
|
1930
|
+
const Chevron = pi.ui.icons.ChevronRight;
|
|
1931
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1932
|
+
className: "tsy-moves"
|
|
1933
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1934
|
+
className: "tsy-devices"
|
|
1935
|
+
}, rows.map(([key, icon, label, hint]) => {
|
|
1936
|
+
const Icon = pi.ui.icons[icon];
|
|
1937
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
1938
|
+
key,
|
|
1939
|
+
type: "button",
|
|
1940
|
+
className: "tsy-device tsy-pick",
|
|
1941
|
+
onClick: () => void open(key)
|
|
1942
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1943
|
+
className: "tsy-device-icon"
|
|
1944
|
+
}, Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
1945
|
+
size: 17
|
|
1946
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1947
|
+
className: "tsy-device-text"
|
|
1948
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1949
|
+
className: "tsy-device-name"
|
|
1950
|
+
}, label), /* @__PURE__ */ React.createElement("span", {
|
|
1951
|
+
className: "tsy-device-line"
|
|
1952
|
+
}, hint)), Chevron && /* @__PURE__ */ React.createElement(Chevron, {
|
|
1953
|
+
size: 16
|
|
1954
|
+
}));
|
|
1955
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
1956
|
+
className: "tsy-line"
|
|
1957
|
+
}, words.moveNote));
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1722
1960
|
// web-src/move-store.ts
|
|
1723
1961
|
class MoveStore {
|
|
1724
1962
|
pi;
|
|
@@ -1758,50 +1996,255 @@ class MoveStore {
|
|
|
1758
1996
|
}
|
|
1759
1997
|
}
|
|
1760
1998
|
|
|
1761
|
-
//
|
|
1762
|
-
var
|
|
1763
|
-
var
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
((SyncStateKeys) => {
|
|
1774
|
-
SyncStateKeys.ITEM = "item:";
|
|
1775
|
-
SyncStateKeys.BLOB = "blob:";
|
|
1776
|
-
SyncStateKeys.DEVICE = "device:";
|
|
1777
|
-
function item(id) {
|
|
1778
|
-
return `${SyncStateKeys.ITEM}${id}`;
|
|
1999
|
+
// ../ta-protocol/esm/common/package-protocol.js
|
|
2000
|
+
var TaPackageServer = Symbol("TaPackageServer");
|
|
2001
|
+
var TaPackageTextUtil;
|
|
2002
|
+
(function(TaPackageTextUtil2) {
|
|
2003
|
+
function pick(text, language) {
|
|
2004
|
+
var _a, _b, _c, _d, _e;
|
|
2005
|
+
if (text === undefined || typeof text === "string") {
|
|
2006
|
+
return text;
|
|
2007
|
+
}
|
|
2008
|
+
const base = language.split("-")[0];
|
|
2009
|
+
const kin = Object.keys(text).find((key) => key.split("-")[0] === base);
|
|
2010
|
+
return (_e = (_d = (_c = (_b = (_a = text[language]) !== null && _a !== undefined ? _a : text[base]) !== null && _b !== undefined ? _b : kin === undefined ? undefined : text[kin]) !== null && _c !== undefined ? _c : text.en) !== null && _d !== undefined ? _d : text["en-US"]) !== null && _e !== undefined ? _e : Object.values(text)[0];
|
|
1779
2011
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
2012
|
+
TaPackageTextUtil2.pick = pick;
|
|
2013
|
+
})(TaPackageTextUtil || (TaPackageTextUtil = {}));
|
|
2014
|
+
|
|
2015
|
+
// web-src/places.tsx
|
|
2016
|
+
function message2(error) {
|
|
2017
|
+
return error instanceof Error ? error.message : String(error);
|
|
2018
|
+
}
|
|
2019
|
+
function nameOf(service, words, types, language) {
|
|
2020
|
+
if (service.builtin) {
|
|
2021
|
+
return words.official;
|
|
1783
2022
|
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
return `${SyncStateKeys.DEVICE}${member}`;
|
|
2023
|
+
if (service.name) {
|
|
2024
|
+
return service.name;
|
|
1787
2025
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
};
|
|
1795
|
-
function keys(manifest) {
|
|
1796
|
-
const pi = manifest && typeof manifest === "object" ? manifest.pi : undefined;
|
|
1797
|
-
const sync = pi?.sync;
|
|
1798
|
-
return Array.isArray(sync) ? [...new Set(sync.filter((key) => typeof key === "string" && key.length > 0 && key.length <= 200))] : [];
|
|
2026
|
+
if (service.type === "ta-relay") {
|
|
2027
|
+
try {
|
|
2028
|
+
return new URL(service.url ?? "").host;
|
|
2029
|
+
} catch {
|
|
2030
|
+
return service.url ?? words.whereRelay;
|
|
2031
|
+
}
|
|
1799
2032
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
2033
|
+
if (service.type === "folder") {
|
|
2034
|
+
return (service.path ?? "").split("/").filter(Boolean).pop() ?? words.whereFolder;
|
|
2035
|
+
}
|
|
2036
|
+
const type = types.find((each) => each.type === service.type);
|
|
2037
|
+
return type && TaPackageTextUtil.pick(type.title, language) || service.type;
|
|
2038
|
+
}
|
|
2039
|
+
function PlacePicker({ pi, store }) {
|
|
2040
|
+
const words = SyncWords.of(pi.ui.language);
|
|
2041
|
+
const [status, setStatus] = React.useState(store.status);
|
|
2042
|
+
const [places, setPlaces] = React.useState();
|
|
2043
|
+
const [form, setForm] = React.useState();
|
|
2044
|
+
const [busy, start] = useBusy(pi.ui);
|
|
2045
|
+
React.useEffect(() => store.subscribe(() => setStatus(store.status)), [store]);
|
|
2046
|
+
const read = React.useCallback(() => pi.callHost("places").then(setPlaces), [pi]);
|
|
2047
|
+
React.useEffect(() => void read().catch(() => {
|
|
2048
|
+
return;
|
|
2049
|
+
}), [read, status?.state, status?.via]);
|
|
2050
|
+
if (!places || !status) {
|
|
2051
|
+
return null;
|
|
2052
|
+
}
|
|
2053
|
+
const locked = status.state !== "off";
|
|
2054
|
+
const call = (method, ...params) => start(async () => {
|
|
2055
|
+
try {
|
|
2056
|
+
setPlaces(await pi.callHost(method, ...params));
|
|
2057
|
+
setForm(undefined);
|
|
2058
|
+
await store.call("status");
|
|
2059
|
+
} catch (error) {
|
|
2060
|
+
pi.ui.notify(SyncWords.format(words.failed, { message: message2(error) }), "error");
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
const language = pi.ui.language;
|
|
2064
|
+
const used = new Set(places.services.map((service) => service.type));
|
|
2065
|
+
const tiles = [
|
|
2066
|
+
...places.services.map((service) => {
|
|
2067
|
+
const where2 = SyncWhere.of(service);
|
|
2068
|
+
const on = places.use === service.id;
|
|
2069
|
+
return {
|
|
2070
|
+
key: service.id,
|
|
2071
|
+
label: nameOf(service, words, places.types, language),
|
|
2072
|
+
icon: service.type === "ta-relay" ? "Server" : service.type === "folder" ? "Folder" : places.types.find((type2) => type2.type === service.type)?.icon,
|
|
2073
|
+
talks: SyncWhere.conversations(where2.where, where2.store),
|
|
2074
|
+
on,
|
|
2075
|
+
act: () => call("choosePlace", service.id),
|
|
2076
|
+
...on || service.builtin || service.type === "ta-relay" ? {} : { remove: () => call("removePlace", service.id) }
|
|
2077
|
+
};
|
|
2078
|
+
}),
|
|
2079
|
+
...places.drives.map((drive) => ({
|
|
2080
|
+
key: `drive:${drive.path}`,
|
|
2081
|
+
label: drive.name,
|
|
2082
|
+
icon: "Cloud",
|
|
2083
|
+
talks: true,
|
|
2084
|
+
on: false,
|
|
2085
|
+
act: () => call("addFolderPlace", drive.path, drive.name)
|
|
2086
|
+
})),
|
|
2087
|
+
...used.has("folder") || places.drives.length ? [] : [
|
|
2088
|
+
{
|
|
2089
|
+
key: "folder",
|
|
2090
|
+
label: words.whereFolder,
|
|
2091
|
+
icon: "Folder",
|
|
2092
|
+
talks: true,
|
|
2093
|
+
on: form === "folder",
|
|
2094
|
+
act: () => setForm(form === "folder" ? undefined : "folder")
|
|
2095
|
+
}
|
|
2096
|
+
],
|
|
2097
|
+
...places.types.filter((type2) => !used.has(type2.type)).map((type2) => ({
|
|
2098
|
+
key: `type:${type2.type}`,
|
|
2099
|
+
label: TaPackageTextUtil.pick(type2.title, language) ?? type2.type,
|
|
2100
|
+
icon: type2.icon,
|
|
2101
|
+
talks: SyncWhere.conversations("store", type2.type),
|
|
2102
|
+
on: false,
|
|
2103
|
+
open: form === type2.type,
|
|
2104
|
+
act: () => setForm(form === type2.type ? undefined : type2.type)
|
|
2105
|
+
}))
|
|
2106
|
+
];
|
|
2107
|
+
const current = places.services.find((service) => service.id === places.use);
|
|
2108
|
+
const where = current ? SyncWhere.of(current) : { where: "relay" };
|
|
2109
|
+
const name = current ? nameOf(current, words, places.types, language) : words.official;
|
|
2110
|
+
const note = locked ? words.whereLocked : where.where === "relay" ? words.whereRelayNote : SyncWords.format(SyncWhere.conversations(where.where, where.store) ? words.whereOwnNote : words.whereGitNote, { name });
|
|
2111
|
+
const type = places.types.find((each) => each.type === form);
|
|
2112
|
+
const X = pi.ui.icons.X;
|
|
2113
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2114
|
+
className: "tsy-where"
|
|
2115
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2116
|
+
className: "tsy-tiles"
|
|
2117
|
+
}, tiles.map((tile) => {
|
|
2118
|
+
const Icon = tile.icon && pi.ui.icons[tile.icon];
|
|
2119
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2120
|
+
key: tile.key,
|
|
2121
|
+
className: `tsy-tile${tile.on ? " tsy-on" : ""}${tile.open ? " tsy-open" : ""}`
|
|
2122
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2123
|
+
type: "button",
|
|
2124
|
+
"aria-pressed": tile.on,
|
|
2125
|
+
className: "tsy-tile-button",
|
|
2126
|
+
disabled: busy || locked && !tile.on,
|
|
2127
|
+
onClick: () => void tile.act()
|
|
2128
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2129
|
+
className: "tsy-tile-name"
|
|
2130
|
+
}, Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
2131
|
+
size: 14
|
|
2132
|
+
}), /* @__PURE__ */ React.createElement("span", null, tile.label)), /* @__PURE__ */ React.createElement("span", {
|
|
2133
|
+
className: `tsy-tile-tag${tile.talks ? " tsy-talks" : ""}`
|
|
2134
|
+
}, tile.talks ? words.withTalks : words.withoutTalks)), tile.remove && !locked && X && /* @__PURE__ */ React.createElement("button", {
|
|
2135
|
+
type: "button",
|
|
2136
|
+
className: "tsy-tile-remove",
|
|
2137
|
+
"aria-label": words.remove,
|
|
2138
|
+
disabled: busy,
|
|
2139
|
+
onClick: () => void tile.remove?.()
|
|
2140
|
+
}, /* @__PURE__ */ React.createElement(X, {
|
|
2141
|
+
size: 11
|
|
2142
|
+
})));
|
|
2143
|
+
})), form === "folder" && /* @__PURE__ */ React.createElement(FolderForm, {
|
|
2144
|
+
words,
|
|
2145
|
+
busy,
|
|
2146
|
+
add: (path, title) => call("addFolderPlace", path, title)
|
|
2147
|
+
}), type && /* @__PURE__ */ React.createElement(StoreForm, {
|
|
2148
|
+
pi,
|
|
2149
|
+
words,
|
|
2150
|
+
type,
|
|
2151
|
+
busy,
|
|
2152
|
+
add: (options, title) => call("addStorePlace", type.type, options, title)
|
|
2153
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
2154
|
+
className: "tsy-line"
|
|
2155
|
+
}, note));
|
|
2156
|
+
}
|
|
2157
|
+
function FolderForm({ words, busy, add }) {
|
|
2158
|
+
const [path, setPath] = React.useState("");
|
|
2159
|
+
return /* @__PURE__ */ React.createElement("form", {
|
|
2160
|
+
className: "tsy-form",
|
|
2161
|
+
onSubmit: (event) => {
|
|
2162
|
+
event.preventDefault();
|
|
2163
|
+
add(path.trim());
|
|
2164
|
+
}
|
|
2165
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
2166
|
+
className: "tsy-line"
|
|
2167
|
+
}, words.folderHint), /* @__PURE__ */ React.createElement("div", {
|
|
2168
|
+
className: "tsy-row"
|
|
2169
|
+
}, /* @__PURE__ */ React.createElement("input", {
|
|
2170
|
+
className: "tsy-field",
|
|
2171
|
+
value: path,
|
|
2172
|
+
spellCheck: false,
|
|
2173
|
+
placeholder: words.folderPlaceholder,
|
|
2174
|
+
onChange: (event) => setPath(event.target.value)
|
|
2175
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
2176
|
+
type: "submit",
|
|
2177
|
+
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
2178
|
+
disabled: busy || !path.trim()
|
|
2179
|
+
}, words.add)));
|
|
2180
|
+
}
|
|
2181
|
+
function StoreForm({
|
|
2182
|
+
pi,
|
|
2183
|
+
words,
|
|
2184
|
+
type,
|
|
2185
|
+
busy,
|
|
2186
|
+
add
|
|
2187
|
+
}) {
|
|
2188
|
+
const language = pi.ui.language;
|
|
2189
|
+
const title = TaPackageTextUtil.pick(type.title, language) ?? type.type;
|
|
2190
|
+
const [values, setValues] = React.useState({});
|
|
2191
|
+
const [name, setName] = React.useState("");
|
|
2192
|
+
const missing = type.options.some((option) => !option.optional && !values[option.key]?.trim());
|
|
2193
|
+
const hint = type.hint ? TaPackageTextUtil.pick(type.hint, language) : undefined;
|
|
2194
|
+
return /* @__PURE__ */ React.createElement("form", {
|
|
2195
|
+
className: "tsy-form",
|
|
2196
|
+
onSubmit: (event) => {
|
|
2197
|
+
event.preventDefault();
|
|
2198
|
+
const given = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, value.trim()]));
|
|
2199
|
+
add(given, name.trim() || title);
|
|
2200
|
+
}
|
|
2201
|
+
}, hint && /* @__PURE__ */ React.createElement("p", {
|
|
2202
|
+
className: "tsy-line"
|
|
2203
|
+
}, hint), type.options.map((option) => /* @__PURE__ */ React.createElement("label", {
|
|
2204
|
+
key: option.key,
|
|
2205
|
+
className: "tsy-form-field"
|
|
2206
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2207
|
+
className: "tsy-form-label"
|
|
2208
|
+
}, (option.label ? TaPackageTextUtil.pick(option.label, language) : undefined) || option.key, option.optional && /* @__PURE__ */ React.createElement("span", {
|
|
2209
|
+
className: "tsy-form-optional"
|
|
2210
|
+
}, words.optional)), /* @__PURE__ */ React.createElement("input", {
|
|
2211
|
+
className: "tsy-field",
|
|
2212
|
+
type: option.secret ? "password" : "text",
|
|
2213
|
+
autoComplete: option.secret ? "new-password" : "off",
|
|
2214
|
+
spellCheck: false,
|
|
2215
|
+
placeholder: option.placeholder,
|
|
2216
|
+
value: values[option.key] ?? "",
|
|
2217
|
+
onChange: (event) => {
|
|
2218
|
+
const value = event.target.value;
|
|
2219
|
+
setValues((before) => ({ ...before, [option.key]: value }));
|
|
2220
|
+
}
|
|
2221
|
+
}))), /* @__PURE__ */ React.createElement("label", {
|
|
2222
|
+
className: "tsy-form-field"
|
|
2223
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2224
|
+
className: "tsy-form-label"
|
|
2225
|
+
}, words.storeName, /* @__PURE__ */ React.createElement("span", {
|
|
2226
|
+
className: "tsy-form-optional"
|
|
2227
|
+
}, words.optional)), /* @__PURE__ */ React.createElement("input", {
|
|
2228
|
+
className: "tsy-field",
|
|
2229
|
+
value: name,
|
|
2230
|
+
placeholder: title,
|
|
2231
|
+
spellCheck: false,
|
|
2232
|
+
onChange: (event) => setName(event.target.value)
|
|
2233
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
2234
|
+
className: "tsy-line"
|
|
2235
|
+
}, words.storeNote), /* @__PURE__ */ React.createElement("div", {
|
|
2236
|
+
className: "tsy-actions tsy-end"
|
|
2237
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2238
|
+
type: "submit",
|
|
2239
|
+
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
2240
|
+
disabled: missing || busy
|
|
2241
|
+
}, busy && /* @__PURE__ */ React.createElement("span", {
|
|
2242
|
+
className: "ta-spinner ta-busy-mark"
|
|
2243
|
+
}), /* @__PURE__ */ React.createElement("span", null, words.storeAdd))));
|
|
2244
|
+
}
|
|
1802
2245
|
|
|
1803
2246
|
// web-src/panel.tsx
|
|
1804
|
-
function
|
|
2247
|
+
function message3(error) {
|
|
1805
2248
|
return error instanceof Error ? error.message : String(error);
|
|
1806
2249
|
}
|
|
1807
2250
|
function useStatus(store) {
|
|
@@ -1822,7 +2265,7 @@ function Action2({ pi, label, primary, danger, run }) {
|
|
|
1822
2265
|
try {
|
|
1823
2266
|
await run();
|
|
1824
2267
|
} catch (error) {
|
|
1825
|
-
pi.ui.notify(SyncWords.format(words.failed, { message:
|
|
2268
|
+
pi.ui.notify(SyncWords.format(words.failed, { message: message3(error) }), "error");
|
|
1826
2269
|
}
|
|
1827
2270
|
});
|
|
1828
2271
|
const kind = primary ? " ta-primary" : danger ? " ta-danger" : "";
|
|
@@ -1896,7 +2339,7 @@ function InviteDialog({ pi, close, folder, store }) {
|
|
|
1896
2339
|
const make = React.useCallback((renew) => {
|
|
1897
2340
|
setError(undefined);
|
|
1898
2341
|
setCopied(false);
|
|
1899
|
-
pi.callHost("invite", renew).then((made) => setLink(made.link), (failure) => setError(
|
|
2342
|
+
pi.callHost("invite", renew).then((made) => setLink(made.link), (failure) => setError(message3(failure)));
|
|
1900
2343
|
}, [pi]);
|
|
1901
2344
|
React.useEffect(() => make(false), [make]);
|
|
1902
2345
|
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
@@ -1941,7 +2384,7 @@ function JoinDialog({ pi, store, close }) {
|
|
|
1941
2384
|
await store.call("join", text.trim());
|
|
1942
2385
|
close();
|
|
1943
2386
|
} catch (failure) {
|
|
1944
|
-
setError(
|
|
2387
|
+
setError(message3(failure));
|
|
1945
2388
|
}
|
|
1946
2389
|
});
|
|
1947
2390
|
const scan = async () => {
|
|
@@ -2018,7 +2461,7 @@ function DeviceRow({ pi, store, device, owner }) {
|
|
|
2018
2461
|
className: `tsy-link tsy-danger${removing ? " ta-busy" : ""}`,
|
|
2019
2462
|
"aria-busy": removing || undefined,
|
|
2020
2463
|
disabled: removing,
|
|
2021
|
-
onClick: () => void start(() => remove().catch((error) => pi.ui.notify(
|
|
2464
|
+
onClick: () => void start(() => remove().catch((error) => pi.ui.notify(message3(error), "error")))
|
|
2022
2465
|
}, removing && /* @__PURE__ */ React.createElement("span", {
|
|
2023
2466
|
className: "ta-spinner ta-busy-mark"
|
|
2024
2467
|
}), /* @__PURE__ */ React.createElement("span", null, words.remove)));
|
|
@@ -2105,10 +2548,7 @@ function SyncPanel({ pi, store }) {
|
|
|
2105
2548
|
className: "tsy-panel tsy-hero"
|
|
2106
2549
|
}, picture, /* @__PURE__ */ React.createElement("p", {
|
|
2107
2550
|
className: "tsy-lead"
|
|
2108
|
-
}, inStore ? words.leadStoreShort : folder ? words.leadFolderShort : words.leadShort), /* @__PURE__ */ React.createElement(
|
|
2109
|
-
pi,
|
|
2110
|
-
status
|
|
2111
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
2551
|
+
}, inStore ? words.leadStoreShort : folder ? words.leadFolderShort : words.leadShort), /* @__PURE__ */ React.createElement("div", {
|
|
2112
2552
|
className: "tsy-actions"
|
|
2113
2553
|
}, /* @__PURE__ */ React.createElement(Action2, {
|
|
2114
2554
|
pi,
|
|
@@ -2215,7 +2655,8 @@ function ResourceSwitch({ pi, store, resource }) {
|
|
|
2215
2655
|
const status = useStatus(store);
|
|
2216
2656
|
const words = useWords2(pi);
|
|
2217
2657
|
const { label } = SyncWords.resource(words, resource);
|
|
2218
|
-
const
|
|
2658
|
+
const unavailable = resource === "conversations" && !!status && !SyncWhere.conversations(status.where, status.store?.type);
|
|
2659
|
+
const checked = !unavailable && (status?.resources[resource] ?? false);
|
|
2219
2660
|
const change = async (on) => {
|
|
2220
2661
|
if (on && resource === "identity" && !await pi.ui.confirm(words.identityAskTitle, words.identityAskBody, { confirmLabel: words.identityAskConfirm })) {
|
|
2221
2662
|
return;
|
|
@@ -2227,8 +2668,8 @@ function ResourceSwitch({ pi, store, resource }) {
|
|
|
2227
2668
|
return /* @__PURE__ */ React.createElement(Switch, {
|
|
2228
2669
|
checked,
|
|
2229
2670
|
label,
|
|
2230
|
-
disabled: !status,
|
|
2231
|
-
onChange: (on) => change(on).catch((error) => pi.ui.notify(
|
|
2671
|
+
disabled: !status || unavailable,
|
|
2672
|
+
onChange: (on) => change(on).catch((error) => pi.ui.notify(message3(error), "error"))
|
|
2232
2673
|
});
|
|
2233
2674
|
}
|
|
2234
2675
|
return /* @__PURE__ */ React.createElement("input", {
|
|
@@ -2236,22 +2677,27 @@ function ResourceSwitch({ pi, store, resource }) {
|
|
|
2236
2677
|
role: "switch",
|
|
2237
2678
|
className: "ta-switch",
|
|
2238
2679
|
checked,
|
|
2680
|
+
disabled: !status || unavailable,
|
|
2239
2681
|
"aria-checked": checked,
|
|
2240
2682
|
"aria-label": label,
|
|
2241
|
-
onChange: (event) => void change(event.target.checked).catch((error) => pi.ui.notify(
|
|
2683
|
+
onChange: (event) => void change(event.target.checked).catch((error) => pi.ui.notify(message3(error), "error"))
|
|
2242
2684
|
});
|
|
2243
2685
|
}
|
|
2244
2686
|
function SyncPage({ pi, store }) {
|
|
2245
2687
|
const words = useWords2(pi);
|
|
2688
|
+
const status = useStatus(store);
|
|
2246
2689
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2247
2690
|
className: "tsy-page"
|
|
2248
|
-
}, /* @__PURE__ */ React.createElement(
|
|
2691
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words.whereTitle), /* @__PURE__ */ React.createElement(PlacePicker, {
|
|
2692
|
+
pi,
|
|
2693
|
+
store
|
|
2694
|
+
}), /* @__PURE__ */ React.createElement(SyncPanel, {
|
|
2249
2695
|
pi,
|
|
2250
2696
|
store
|
|
2251
2697
|
}), /* @__PURE__ */ React.createElement("h2", null, words.whatTitle), /* @__PURE__ */ React.createElement("div", {
|
|
2252
2698
|
className: "tsy-what"
|
|
2253
2699
|
}, SYNC_RESOURCES.map((resource) => {
|
|
2254
|
-
const { label, hint } = SyncWords.resource(words, resource);
|
|
2700
|
+
const { label, hint } = SyncWords.resource(words, resource, status);
|
|
2255
2701
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2256
2702
|
key: resource,
|
|
2257
2703
|
className: "tsy-what-row"
|
|
@@ -2351,7 +2797,7 @@ var STYLE = `
|
|
|
2351
2797
|
.tsy-qr { align-self: center; width: 188px; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--ta-border-muted); }
|
|
2352
2798
|
.tsy-qr svg { display: block; width: 100%; height: auto; }
|
|
2353
2799
|
.tsy-link-box { padding: 8px 10px; border-radius: 8px; background: var(--ta-code); font-family: var(--ta-mono); font-size: calc(11.5px * var(--ta-font-scale)); color: var(--ta-secondary); overflow-wrap: anywhere; }
|
|
2354
|
-
.tsy-field { width: 100%; box-sizing: border-box; height: 36px; padding: 0 10px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: transparent; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); }
|
|
2800
|
+
.tsy-field { width: 100%; box-sizing: border-box; height: 36px; padding: 0 10px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: transparent; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); outline: none; }
|
|
2355
2801
|
[data-touch] .tsy-field { font-size: max(16px, calc(13px * var(--ta-font-scale))); }
|
|
2356
2802
|
.tsy-error { margin: 0; color: var(--ta-red); font-size: calc(12px * var(--ta-font-scale)); }
|
|
2357
2803
|
.tsy-page { padding: 24px 20px 40px; max-width: var(--ta-page-width); margin: 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
|
|
@@ -2372,6 +2818,30 @@ var STYLE = `
|
|
|
2372
2818
|
.tsy-progress-bar { height: 100%; border-radius: 3px; background: var(--ta-green); transition: width 0.3s ease; }
|
|
2373
2819
|
.tsy-pick { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
|
|
2374
2820
|
.tsy-picked { background: var(--ta-hover); }
|
|
2821
|
+
.tsy-where { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
|
|
2822
|
+
.tsy-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
|
|
2823
|
+
.tsy-tile { position: relative; min-width: 0; }
|
|
2824
|
+
.tsy-tile-button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 8px 8px; border: 1px solid var(--ta-border-muted); border-radius: 10px; background: none; color: var(--ta-text); font: inherit; cursor: pointer; transition: border-color 120ms, background 120ms, box-shadow 120ms; }
|
|
2825
|
+
@media (hover: hover) { .tsy-tile-button:not(:disabled):hover { background: var(--ta-hover); } }
|
|
2826
|
+
.tsy-tile-button:disabled { cursor: default; opacity: .45; }
|
|
2827
|
+
.tsy-tile.tsy-on .tsy-tile-button { border-color: var(--ta-green); box-shadow: inset 0 0 0 1px var(--ta-green); opacity: 1; }
|
|
2828
|
+
.tsy-tile.tsy-open .tsy-tile-button { border-style: dashed; border-color: var(--ta-border-field); background: var(--ta-hover); }
|
|
2829
|
+
.tsy-tile-name { display: flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; font-size: calc(13px * var(--ta-font-scale)); font-weight: 600; }
|
|
2830
|
+
.tsy-tile-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2831
|
+
.tsy-tile-name svg { flex: none; color: var(--ta-secondary); }
|
|
2832
|
+
.tsy-tile-tag { color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); }
|
|
2833
|
+
.tsy-tile-tag.tsy-talks { color: var(--ta-green); }
|
|
2834
|
+
.tsy-tile-remove { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1px solid var(--ta-border-muted); border-radius: 50%; background: var(--ta-bg, var(--ta-raised)); color: var(--ta-muted); cursor: pointer; opacity: 0; transition: opacity 120ms; }
|
|
2835
|
+
.tsy-tile:hover .tsy-tile-remove, .tsy-tile-remove:focus-visible, [data-touch] .tsy-tile-remove { opacity: 1; }
|
|
2836
|
+
.tsy-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: var(--ta-raised); }
|
|
2837
|
+
.tsy-form-field { display: flex; flex-direction: column; gap: 4px; }
|
|
2838
|
+
.tsy-form-label { display: flex; align-items: baseline; gap: 6px; color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
|
|
2839
|
+
.tsy-form-optional { color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); }
|
|
2840
|
+
.tsy-moves { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
2841
|
+
.tsy-moves .tsy-pick { color: var(--ta-text); }
|
|
2842
|
+
.tsy-moves .tsy-pick > svg { flex: none; color: var(--ta-muted); }
|
|
2843
|
+
.tsy-move-dialog { width: min(440px, calc(100vw - 48px)); }
|
|
2844
|
+
.tsy-move-dialog .tsy-panel { width: 100%; min-width: 0; }
|
|
2375
2845
|
`;
|
|
2376
2846
|
function injectStyle() {
|
|
2377
2847
|
const element = document.createElement("style");
|
|
@@ -2421,13 +2891,23 @@ class SyncStore {
|
|
|
2421
2891
|
}
|
|
2422
2892
|
|
|
2423
2893
|
// web-src/index.tsx
|
|
2424
|
-
function settings(pi, store) {
|
|
2894
|
+
function settings(pi, store, moves) {
|
|
2425
2895
|
const words = () => SyncWords.of(pi.ui.language);
|
|
2426
2896
|
return {
|
|
2427
2897
|
title: () => words().title,
|
|
2428
2898
|
icon: pi.ui.icons.RefreshCw,
|
|
2429
2899
|
group: "devices",
|
|
2430
2900
|
rows: [
|
|
2901
|
+
{
|
|
2902
|
+
key: "where",
|
|
2903
|
+
label: () => words().whereTitle,
|
|
2904
|
+
search: () => `${words().whereTitle} WebDAV S3 git iCloud`,
|
|
2905
|
+
stacked: true,
|
|
2906
|
+
render: () => /* @__PURE__ */ React.createElement(PlacePicker, {
|
|
2907
|
+
pi,
|
|
2908
|
+
store
|
|
2909
|
+
})
|
|
2910
|
+
},
|
|
2431
2911
|
{
|
|
2432
2912
|
key: "devices",
|
|
2433
2913
|
label: "",
|
|
@@ -2441,13 +2921,23 @@ function settings(pi, store) {
|
|
|
2441
2921
|
...SYNC_RESOURCES.map((resource) => ({
|
|
2442
2922
|
key: resource,
|
|
2443
2923
|
label: () => SyncWords.resource(words(), resource).label,
|
|
2444
|
-
description: () => SyncWords.resource(words(), resource).hint,
|
|
2924
|
+
description: () => SyncWords.resource(words(), resource, store.status).hint,
|
|
2445
2925
|
render: () => /* @__PURE__ */ React.createElement(ResourceSwitch, {
|
|
2446
2926
|
pi,
|
|
2447
2927
|
store,
|
|
2448
2928
|
resource
|
|
2449
2929
|
})
|
|
2450
|
-
}))
|
|
2930
|
+
})),
|
|
2931
|
+
{
|
|
2932
|
+
key: "move",
|
|
2933
|
+
label: () => words().moveTitle,
|
|
2934
|
+
search: () => `${MoveWordsUtil.of(pi.ui.language).title} ${MoveWordsUtil.of(pi.ui.language).lead}`,
|
|
2935
|
+
stacked: true,
|
|
2936
|
+
render: () => /* @__PURE__ */ React.createElement(MoveEntries, {
|
|
2937
|
+
pi,
|
|
2938
|
+
store: moves
|
|
2939
|
+
})
|
|
2940
|
+
}
|
|
2451
2941
|
]
|
|
2452
2942
|
};
|
|
2453
2943
|
}
|
|
@@ -2455,7 +2945,8 @@ function activate(pi) {
|
|
|
2455
2945
|
bind(pi.React);
|
|
2456
2946
|
const removeStyle = injectStyle();
|
|
2457
2947
|
const store = new SyncStore(pi);
|
|
2458
|
-
|
|
2948
|
+
const moves = new MoveStore(pi);
|
|
2949
|
+
pi.registerSettings(settings(pi, store, moves));
|
|
2459
2950
|
const asked = new Set;
|
|
2460
2951
|
let open;
|
|
2461
2952
|
const stopAsks = store.subscribe(() => {
|
|
@@ -2475,24 +2966,6 @@ function activate(pi) {
|
|
|
2475
2966
|
}));
|
|
2476
2967
|
}
|
|
2477
2968
|
});
|
|
2478
|
-
const moves = new MoveStore(pi);
|
|
2479
|
-
pi.registerSettings({
|
|
2480
|
-
title: () => MoveWordsUtil.of(pi.ui.language).title,
|
|
2481
|
-
icon: pi.ui.icons.FolderInput,
|
|
2482
|
-
group: "devices",
|
|
2483
|
-
rows: [
|
|
2484
|
-
{
|
|
2485
|
-
key: "move",
|
|
2486
|
-
label: "",
|
|
2487
|
-
search: () => `${MoveWordsUtil.of(pi.ui.language).title} ${MoveWordsUtil.of(pi.ui.language).lead}`,
|
|
2488
|
-
stacked: true,
|
|
2489
|
-
render: () => /* @__PURE__ */ React.createElement(MovePanel, {
|
|
2490
|
-
pi,
|
|
2491
|
-
store: moves
|
|
2492
|
-
})
|
|
2493
|
-
}
|
|
2494
|
-
]
|
|
2495
|
-
});
|
|
2496
2969
|
pi.registerView("move", {
|
|
2497
2970
|
title: () => MoveWordsUtil.of(pi.ui.language).title,
|
|
2498
2971
|
icon: pi.ui.icons.FolderInput,
|