@celljs/ta-share 4.12.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/extension/index.mjs +51 -0
- package/package.json +13 -5
- package/web/index.js +12 -14
package/README.en.md
CHANGED
|
@@ -15,7 +15,7 @@ A pi package that comes with Ta (on by default; Settings → Extensions turns it
|
|
|
15
15
|
| --- | --- |
|
|
16
16
|
| Anyone with the link | Anyone who has the link |
|
|
17
17
|
| With a password | Who has the link and the password; the password is not in the link, and the key of the content is derived from both |
|
|
18
|
-
|
|
|
18
|
+
| Friends | The friends chosen, in their own Ta only: the link holds no key, the key of the content is agreed between the two identities (ECDH), and neither the relay nor anyone else learns who opens it; while this computer runs Ta |
|
|
19
19
|
| Only me | Only the Ta of the one who shared it (this computer and its paired devices) |
|
|
20
20
|
|
|
21
21
|
It works for 1, 7 or 30 days, or until stopped; "opens while this computer is off" keeps a sealed copy on the relay, 30 days at most.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Ta 自带的 pi 包(默认开启,可在 设置 → 扩展 关闭):把对
|
|
|
15
15
|
| --- | --- |
|
|
16
16
|
| 拿到链接的人 | 任何拿到链接的人 |
|
|
17
17
|
| 凭口令 | 拿到链接并且知道口令的人;口令不在链接里,内容密钥由链接密钥和口令共同派生 |
|
|
18
|
-
| 指定的好友 |
|
|
18
|
+
| 指定的好友 | 选定的几位好友,只能在他们自己的 Ta 里打开:链接里没有密钥,内容密钥由双方身份密钥协商(ECDH)得出,中继和别人都不知道是谁在看;只在这台电脑运行 Ta 时可打开 |
|
|
19
19
|
| 仅自己 | 只在分享者自己的 Ta(这台电脑和配对过的设备)里打开 |
|
|
20
20
|
|
|
21
21
|
有效期 1 / 7 / 30 天或不过期;"电脑关机也能打开"会把加密副本放到中继上,最长 30 天。
|
package/extension/index.mjs
CHANGED
|
@@ -5,19 +5,70 @@ var TaHostUtil;
|
|
|
5
5
|
TaHostUtil2.WAIT_MS = 1000;
|
|
6
6
|
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
7
7
|
return new Promise((resolve) => {
|
|
8
|
+
let heard = false;
|
|
9
|
+
let answered = false;
|
|
8
10
|
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
9
11
|
const request = {
|
|
10
12
|
name,
|
|
13
|
+
heard: () => {
|
|
14
|
+
heard = true;
|
|
15
|
+
},
|
|
11
16
|
resolve: (answer) => {
|
|
17
|
+
answered = true;
|
|
12
18
|
clearTimeout(timer);
|
|
13
19
|
resolve(answer);
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
22
|
events.emit(TA_HOST_EVENT, request);
|
|
23
|
+
if (!heard && !answered) {
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
resolve(undefined);
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
28
|
}
|
|
19
29
|
TaHostUtil2.reach = reach;
|
|
20
30
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
31
|
+
var TA_ASK_ENTRY = "ta-ask";
|
|
32
|
+
var TaAskUtil;
|
|
33
|
+
(function(TaAskUtil2) {
|
|
34
|
+
const LENGTH = 120;
|
|
35
|
+
function entry(question) {
|
|
36
|
+
const line = question.replace(/\s+/g, " ").trim();
|
|
37
|
+
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
38
|
+
}
|
|
39
|
+
TaAskUtil2.entry = entry;
|
|
40
|
+
function asking(entries) {
|
|
41
|
+
var _a;
|
|
42
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
43
|
+
const entry2 = entries[i];
|
|
44
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
48
|
+
return read(entry2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
TaAskUtil2.asking = asking;
|
|
54
|
+
function next(asked, entry2) {
|
|
55
|
+
var _a;
|
|
56
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
60
|
+
}
|
|
61
|
+
TaAskUtil2.next = next;
|
|
62
|
+
function read(found) {
|
|
63
|
+
var _a;
|
|
64
|
+
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
65
|
+
if (typeof question !== "string" || !question.trim()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
69
|
+
return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
|
|
70
|
+
}
|
|
71
|
+
})(TaAskUtil || (TaAskUtil = {}));
|
|
21
72
|
|
|
22
73
|
// web-src/server-texts.ts
|
|
23
74
|
var ShareServerTexts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-share",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "A pi package for Ta: share a conversation, a page or a file by a link, public, with a password or for yourself, end to end through the relay; open and import what others share",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@celljs/ta-protocol": "4.
|
|
31
|
-
"@celljs/ta-relay": "4.
|
|
32
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.13.0",
|
|
31
|
+
"@celljs/ta-relay": "4.13.0",
|
|
32
|
+
"@celljs/ta-web": "4.13.0",
|
|
33
33
|
"@types/react": "^19.3.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
"host": "./host/index.mjs",
|
|
52
52
|
"extensions": [
|
|
53
53
|
"./extension/index.mjs"
|
|
54
|
-
]
|
|
54
|
+
],
|
|
55
|
+
"permissions": {
|
|
56
|
+
"host": {
|
|
57
|
+
"*": "settings.manage"
|
|
58
|
+
},
|
|
59
|
+
"tools": {
|
|
60
|
+
"share_link": "chat.share"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
55
63
|
}
|
|
56
64
|
}
|
package/web/index.js
CHANGED
|
@@ -8,12 +8,12 @@ var EN = {
|
|
|
8
8
|
accessLink: "Anyone with the link",
|
|
9
9
|
accessPassword: "With a password",
|
|
10
10
|
accessSelf: "Only me",
|
|
11
|
-
accessPeople: "
|
|
12
|
-
accessPeopleShort: "
|
|
11
|
+
accessPeople: "Friends",
|
|
12
|
+
accessPeopleShort: "Friends",
|
|
13
13
|
accessPeopleHint: "Opens only in their own Ta, which proves who it is: the link alone opens nothing. While this computer runs Ta.",
|
|
14
|
-
peopleNone: "No
|
|
14
|
+
peopleNone: "No friends yet: add one under Discover → Friends.",
|
|
15
15
|
peopleChoose: "Choose at least one.",
|
|
16
|
-
peopleOnly: "Only the
|
|
16
|
+
peopleOnly: "Only the friends it was shared with open it, in their own Ta.",
|
|
17
17
|
peopleLine: "for {names}",
|
|
18
18
|
accessLinkShort: "Public",
|
|
19
19
|
accessPasswordShort: "Password",
|
|
@@ -110,9 +110,9 @@ var ZH = {
|
|
|
110
110
|
accessPeople: "指定的好友",
|
|
111
111
|
accessPeopleShort: "指定的好友",
|
|
112
112
|
accessPeopleHint: "只能在对方自己的 Ta 里打开,由 Ta 证明身份:光有链接打不开。这台电脑运行 Ta 时可以打开。",
|
|
113
|
-
peopleNone: "
|
|
113
|
+
peopleNone: "还没有好友:在“发现 → 好友”里添加。",
|
|
114
114
|
peopleChoose: "至少选一位。",
|
|
115
|
-
peopleOnly: "
|
|
115
|
+
peopleOnly: "这条链接只给指定的好友,请在他们自己的 Ta 里打开。",
|
|
116
116
|
peopleLine: "给{names}",
|
|
117
117
|
accessLinkShort: "公开",
|
|
118
118
|
accessPasswordShort: "口令",
|
|
@@ -300,14 +300,14 @@ function Choice({
|
|
|
300
300
|
label
|
|
301
301
|
}) {
|
|
302
302
|
return /* @__PURE__ */ React.createElement("fieldset", {
|
|
303
|
-
className: "tsh-choice",
|
|
303
|
+
className: "ta-segmented tsh-choice",
|
|
304
304
|
"aria-label": label
|
|
305
305
|
}, options.map((option) => /* @__PURE__ */ React.createElement("button", {
|
|
306
306
|
key: String(option.value),
|
|
307
307
|
type: "button",
|
|
308
308
|
"aria-pressed": option.value === value,
|
|
309
309
|
disabled: option.disabled,
|
|
310
|
-
className: option.value === value ? "
|
|
310
|
+
className: option.value === value ? "ta-on" : "",
|
|
311
311
|
onClick: () => onChange(option.value)
|
|
312
312
|
}, option.label)));
|
|
313
313
|
}
|
|
@@ -1074,10 +1074,8 @@ var STYLE = `
|
|
|
1074
1074
|
.tsh-notes { margin: 8px 0 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
1075
1075
|
.tsh-field { display: flex; flex-direction: column; gap: 6px; }
|
|
1076
1076
|
.tsh-label { font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-secondary); }
|
|
1077
|
-
|
|
1078
|
-
.tsh-choice button {
|
|
1079
|
-
.tsh-choice button:hover:not(:disabled) { color: var(--ta-text); }
|
|
1080
|
-
.tsh-choice button.tsh-on { background: var(--ta-card); color: var(--ta-text); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
|
|
1077
|
+
/* The page's segmented control (.ta-segmented); only what it lacks: long labels and a disabled segment */
|
|
1078
|
+
.tsh-choice button { min-width: 0; padding: 0 6px; font-family: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1081
1079
|
.tsh-choice button:disabled { opacity: .4; cursor: default; }
|
|
1082
1080
|
.tsh-password { display: flex; gap: 8px; }
|
|
1083
1081
|
.tsh-friends { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
@@ -1102,7 +1100,7 @@ var STYLE = `
|
|
|
1102
1100
|
.tsh-stop:hover { color: var(--ta-red); background: var(--ta-hover); }
|
|
1103
1101
|
|
|
1104
1102
|
/* My shares: the page fills its place and scrolls, its rows never wider than it. */
|
|
1105
|
-
.tsh-page { flex: 1; min-width: 0; min-height: 0; width: 100%; height: 100%; overflow-y: auto; box-sizing: border-box; padding: 12px 16px 32px; }
|
|
1103
|
+
.tsh-page { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; width: 100%; height: 100%; overflow-y: auto; box-sizing: border-box; padding: 12px 16px 32px; }
|
|
1106
1104
|
.tsh-rows { max-width: 720px; margin: 0 auto; padding: 0; list-style: none; display: flex; flex-direction: column; }
|
|
1107
1105
|
.tsh-item { --ta-swipe-bg: var(--ta-main); min-width: 0; border-radius: 10px; overflow: hidden; }
|
|
1108
1106
|
.tsh-row { display: flex; align-items: center; gap: 4px; min-width: 0; padding-right: 6px; border-radius: 10px; transition: background 120ms, opacity 200ms; }
|
|
@@ -1155,7 +1153,7 @@ var STYLE = `
|
|
|
1155
1153
|
.tsh-image { display: block; max-width: 100%; margin: 0 auto; border-radius: 10px; }
|
|
1156
1154
|
.tsh-plain { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--ta-code); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); white-space: pre-wrap; word-break: break-word; }
|
|
1157
1155
|
.tsh-download { margin: 20vh auto 0; display: flex; width: fit-content; text-decoration: none; }
|
|
1158
|
-
@media (prefers-reduced-motion: reduce) { .tsh-row
|
|
1156
|
+
@media (prefers-reduced-motion: reduce) { .tsh-row { transition: none; } }
|
|
1159
1157
|
`;
|
|
1160
1158
|
function injectStyle() {
|
|
1161
1159
|
const element = document.createElement("style");
|