clavarium 0.2.49-beta.1 → 0.2.50-beta.1
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/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
- package/web/app.js +44 -21
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.50-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.50-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"clavarium-binder": "0.1.8-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
16
|
"clavarium-parley": "0.17.9-next.1",
|
|
17
|
-
"clavarium-tether": "0.1.0-next.
|
|
17
|
+
"clavarium-tether": "0.1.0-next.9",
|
|
18
18
|
"mermaid": "11.17.2",
|
|
19
19
|
"node-pty": "^1.1.0",
|
|
20
20
|
"pdfjs-dist": "6.4.299",
|
|
@@ -755,9 +755,9 @@
|
|
|
755
755
|
}
|
|
756
756
|
},
|
|
757
757
|
"node_modules/clavarium-tether": {
|
|
758
|
-
"version": "0.1.0-next.
|
|
759
|
-
"resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.
|
|
760
|
-
"integrity": "sha512
|
|
758
|
+
"version": "0.1.0-next.9",
|
|
759
|
+
"resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.9.tgz",
|
|
760
|
+
"integrity": "sha512-+Y48yYhW/UXkPtBNTkEUmFw5HEgeTTBszaP6LwJxocC1HV9yTq8mlXCumafhYFSQZxhy/ntF8fU14+1OdsvMXQ==",
|
|
761
761
|
"license": "MIT",
|
|
762
762
|
"bin": {
|
|
763
763
|
"tether": "bin/cli.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.50-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"clavarium-binder": "0.1.8-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
49
|
"clavarium-parley": "0.17.9-next.1",
|
|
50
|
-
"clavarium-tether": "0.1.0-next.
|
|
50
|
+
"clavarium-tether": "0.1.0-next.9",
|
|
51
51
|
"mermaid": "11.17.2",
|
|
52
52
|
"node-pty": "^1.1.0",
|
|
53
53
|
"pdfjs-dist": "6.4.299",
|
package/web/app.js
CHANGED
|
@@ -3166,7 +3166,15 @@
|
|
|
3166
3166
|
/* BINDER'S LISTS, AS THIS PAGE NAMES THEM: the one place for the word (Assets, a conversation's tab). */
|
|
3167
3167
|
const LISTS_WORD = { many: 'Binders', one: 'Binder', a: 'a binder', its: 'Its binders' };
|
|
3168
3168
|
$('view-lists-word').textContent = LISTS_WORD.many; $('listnew-head').textContent = `New ${LISTS_WORD.one.toLowerCase()}`;
|
|
3169
|
-
const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['
|
|
3169
|
+
const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['agenda', 'Calendars', 'calendar'], ['contacts', 'Contacts', 'users'], ['secret', 'Secrets', 'key-round'], ['list', LISTS_WORD.many, '']];
|
|
3170
|
+
/* A live Tether target shows in the category of its kind (a mailbox among the
|
|
3171
|
+
mailboxes), not apart. Its connecting account is the rest of its id. */
|
|
3172
|
+
const TETHER_CAT = { mail: 'mailbox', calendar: 'agenda', contacts: 'contacts' };
|
|
3173
|
+
const tetherCat = (k) => TETHER_CAT[k] ?? 'acces';
|
|
3174
|
+
const tetherAccount = (id) => String(id).replace(/^(mail|calendar|contacts|files|ssh|browser|screen|computer)-/, '');
|
|
3175
|
+
/* Adding to a type category of live links (a calendar, an address book, an
|
|
3176
|
+
access) is connecting an account: they all open the connect-account form. */
|
|
3177
|
+
const addForm = (k) => (['agenda', 'contacts', 'acces'].includes(k) ? 'connexion' : k);
|
|
3170
3178
|
const getJson = (path, fallback) => fetch(`${API}${path}`).then((r) => (r.ok ? r.json() : fallback)).catch(() => fallback);
|
|
3171
3179
|
const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; return e; };
|
|
3172
3180
|
/* A commit: its line, and the rest of its message under it, opened by a click. */
|
|
@@ -3195,7 +3203,7 @@
|
|
|
3195
3203
|
if (mine.length === 0 && !add) continue;
|
|
3196
3204
|
const section = el('section', 'as-kind'); section.dataset.kind = kind;
|
|
3197
3205
|
const head = el('div', 'as-kind-head'); head.append(el('h3', '', title));
|
|
3198
|
-
if (add) head.append(roundPlus(`Add ${{ git: 'a repository', folder: 'a folder', mailbox: 'a mailbox',
|
|
3206
|
+
if (add) head.append(roundPlus(`Add ${{ git: 'a repository', folder: 'a folder', mailbox: 'a mailbox', agenda: 'a calendar', contacts: 'an address book', acces: 'an access', secret: 'a secret', list: LISTS_WORD.a }[kind]}`, () => add(kind)));
|
|
3199
3207
|
section.append(head);
|
|
3200
3208
|
if (mine.length === 0) section.append(el('p', 'hint as-none', 'None yet'));
|
|
3201
3209
|
for (const item of mine) {
|
|
@@ -3713,7 +3721,7 @@
|
|
|
3713
3721
|
if (keepFiles) { void paintFiles(); return; }
|
|
3714
3722
|
detail.append(asTitle(chosen, back));
|
|
3715
3723
|
if (chosen.kind === 'folder' || chosen.kind === 'mailbox') {
|
|
3716
|
-
if (chosen.kind === 'mailbox') detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
|
|
3724
|
+
if (chosen.kind === 'mailbox' && !chosen.target) detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
|
|
3717
3725
|
embedFiles(detail, chosen.name);
|
|
3718
3726
|
} else if (chosen.kind === 'send') await sendDetail(detail, gits);
|
|
3719
3727
|
else if (chosen.kind === 'git') await gitDetail(detail, chosen.name, { others: gits.length > 1 });
|
|
@@ -3859,9 +3867,14 @@
|
|
|
3859
3867
|
for (const s2 of secrets) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, badge: String(s2.conversations.length), badgeTitle: `Used by ${s2.conversations.length} conversation${s2.conversations.length === 1 ? '' : 's'}`, badgeTone: 'count', ...secretItem(s2, 'name only') });
|
|
3860
3868
|
/* Tether targets ("Connexions"): a mailbox, calendar or address book connected
|
|
3861
3869
|
by token, given to a conversation at a level. The token lives on the server. */
|
|
3862
|
-
|
|
3870
|
+
const allTargets = Array.isArray(tether.targets) ? tether.targets : [];
|
|
3871
|
+
for (const tgt of allTargets) {
|
|
3863
3872
|
const users = Object.keys(tgt.grants ?? {}).filter((id) => id.startsWith('conversation:')).length;
|
|
3864
|
-
|
|
3873
|
+
const acct = tetherAccount(tgt.id);
|
|
3874
|
+
const siblings = allTargets.filter((o) => o.id !== tgt.id && tetherAccount(o.id) === acct).map((o) => connexionSub(o.kind));
|
|
3875
|
+
items.push({ key: `connexion:${tgt.id}`, kind: tetherCat(tgt.kind), name: tgt.title, target: tgt, siblings, live: true,
|
|
3876
|
+
badge: String(users), badgeTitle: `Used by ${users} conversation${users === 1 ? '' : 's'}`, badgeTone: 'count',
|
|
3877
|
+
sub: siblings.length ? `linked: ${siblings.join(', ')}` : connexionSub(tgt.kind) });
|
|
3865
3878
|
}
|
|
3866
3879
|
/* Binder's lists: given to a conversation (read, write) in Binder itself. */
|
|
3867
3880
|
const shownLists = lists.ok && Array.isArray(lists.data) ? lists.data.filter((l) => !l.archived) : [];
|
|
@@ -3886,7 +3899,7 @@
|
|
|
3886
3899
|
if (assetsAdding === 'choose') {
|
|
3887
3900
|
detail.append(el('h3', '', 'New asset'));
|
|
3888
3901
|
const kinds = el('div', 'as-kinds');
|
|
3889
|
-
for (const [kind, word] of [['git', 'Git repository'], ['folder', 'Folder'], ['mailbox', 'Mailbox'], ['
|
|
3902
|
+
for (const [kind, word] of [['git', 'Git repository'], ['folder', 'Folder'], ['mailbox', 'Mailbox'], ['agenda', 'Calendar'], ['contacts', 'Address book'], ['secret', 'Secret'], ['list', LISTS_WORD.one]]) {
|
|
3890
3903
|
const b = el('button', '', word); b.type = 'button'; b.dataset.kind = kind;
|
|
3891
3904
|
b.addEventListener('click', () => { assetsAdding = kind; void paintAssets(); });
|
|
3892
3905
|
b.prepend(kindIcon(kind)); kinds.append(b);
|
|
@@ -3894,7 +3907,7 @@
|
|
|
3894
3907
|
detail.append(kinds);
|
|
3895
3908
|
return;
|
|
3896
3909
|
}
|
|
3897
|
-
const form = $(`${assetsAdding}-box`); form.hidden = false;
|
|
3910
|
+
const form = $(`${addForm(assetsAdding)}-box`); form.hidden = false;
|
|
3898
3911
|
detail.append(form);
|
|
3899
3912
|
if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
|
|
3900
3913
|
if (assetsAdding === 'list') void fillTemplates();
|
|
@@ -3903,7 +3916,7 @@
|
|
|
3903
3916
|
}
|
|
3904
3917
|
if (assetsAdding) {
|
|
3905
3918
|
const all2 = el('button', 'as-link as-back', '‹ Assets'); all2.type = 'button'; all2.addEventListener('click', () => { if (!nav.close('asset')) back(); });
|
|
3906
|
-
const form = $(`${assetsAdding}-box`); form.hidden = false;
|
|
3919
|
+
const form = $(`${addForm(assetsAdding)}-box`); form.hidden = false;
|
|
3907
3920
|
detail.append(all2, form);
|
|
3908
3921
|
if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
|
|
3909
3922
|
if (assetsAdding === 'list') void fillTemplates();
|
|
@@ -3915,7 +3928,17 @@
|
|
|
3915
3928
|
const ready = conversations.filter((c) => c.phase === 'ready');
|
|
3916
3929
|
const r = chosen.resource;
|
|
3917
3930
|
/* State, in a line. */
|
|
3918
|
-
if (chosen.kind === 'mailbox') detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
|
|
3931
|
+
if (chosen.kind === 'mailbox' && !chosen.target) detail.append(el('p', chosen.box?.failure ? 'error' : 'hint', boxSub(chosen.box)));
|
|
3932
|
+
/* A live link: what it is, and that it is associated with the same account's others. */
|
|
3933
|
+
if (chosen.target) {
|
|
3934
|
+
const t = chosen.target;
|
|
3935
|
+
detail.append(el('p', 'hint', ['live', connexionSub(t.kind), t.config?.user].filter(Boolean).join(' · ')));
|
|
3936
|
+
if (chosen.siblings?.length) {
|
|
3937
|
+
const a = el('p', 'as-assoc hint');
|
|
3938
|
+
a.append(el('b', '', 'Linked'), document.createTextNode(` to the same account: ${chosen.siblings.join(', ')}. They share the account's token (kept on the server); rights are given separately.`));
|
|
3939
|
+
detail.append(a);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3919
3942
|
if (chosen.kind === 'secret') {
|
|
3920
3943
|
/* Renamed: its value and the conversations it is handed to go with it. */
|
|
3921
3944
|
const form = el('form', 'set-row secret-rename'); form.autocomplete = 'off';
|
|
@@ -3937,11 +3960,12 @@
|
|
|
3937
3960
|
detail.append(box, ...replace.card);
|
|
3938
3961
|
}
|
|
3939
3962
|
/* Used by: each conversation that has it, what it may do; "+" offers the others. */
|
|
3940
|
-
const options = chosen.
|
|
3941
|
-
: chosen.kind === '
|
|
3963
|
+
const options = chosen.target ? [['none', 'Off'], ['watch', 'Watch'], ['propose', 'Propose'], ['frame', 'Frame'], ['free', 'Free']]
|
|
3964
|
+
: chosen.kind === 'secret' ? [['off', 'Off'], ['use', 'Use']] : chosen.kind === 'mailbox' ? [['none', 'Off'], ['read', 'Read']]
|
|
3942
3965
|
: [['none', 'Off'], ['read', 'Read'], ['write', 'Write']];
|
|
3943
|
-
const has = (c) => (chosen.
|
|
3944
|
-
: chosen.kind === '
|
|
3966
|
+
const has = (c) => (chosen.target ? chosen.target.grants?.[`conversation:${c.name}`]?.level ?? 'none'
|
|
3967
|
+
: chosen.kind === 'secret' ? (chosen.secret.conversations.includes(c.name) ? 'use' : 'off') : chosen.kind === 'list' ? chosen.list.grants?.[`conversation:${c.name}`] ?? 'none'
|
|
3968
|
+
: r.attachments?.[c.name] ?? 'none');
|
|
3945
3969
|
const using = ready.filter((c) => !['none', 'off'].includes(has(c)));
|
|
3946
3970
|
const others = ready.filter((c) => ['none', 'off'].includes(has(c)));
|
|
3947
3971
|
const users = el('div', 'as-users');
|
|
@@ -3949,9 +3973,9 @@
|
|
|
3949
3973
|
const row = (c) => {
|
|
3950
3974
|
const line = el('div', 'given-row'); line.dataset.conversation = c.name;
|
|
3951
3975
|
line.append(el('span', '', shownName(c)), modes(options, has(c), async (value) => {
|
|
3952
|
-
if (chosen.
|
|
3976
|
+
if (chosen.target) await grantTarget(chosen.target.id, c.name, value);
|
|
3977
|
+
else if (chosen.kind === 'secret') await handTo(c.name, chosen.name, value === 'use', 'assets-error');
|
|
3953
3978
|
else if (chosen.kind === 'list') await grantList(chosen.list.id, c.name, value);
|
|
3954
|
-
else if (chosen.kind === 'connexion') await grantTarget(chosen.target.id, c.name, value);
|
|
3955
3979
|
else await attachTo(c.name, chosen.name, value, 'assets-error');
|
|
3956
3980
|
await paintAssets();
|
|
3957
3981
|
}, `What ${c.name} may do with ${chosen.name}`));
|
|
@@ -3997,9 +4021,8 @@
|
|
|
3997
4021
|
edit.addEventListener('click', () => { remoteEditing = !remoteEditing; box.hidden = !remoteEditing; if (remoteEditing) focusField($('gitview-url')); });
|
|
3998
4022
|
void gitDetail(holder, chosen.name, { place: true });
|
|
3999
4023
|
}
|
|
4000
|
-
if (chosen.
|
|
4024
|
+
if (chosen.target) {
|
|
4001
4025
|
const t = chosen.target;
|
|
4002
|
-
detail.append(el('p', 'hint', [connexionSub(t.kind), t.config?.user].filter(Boolean).join(' · ')));
|
|
4003
4026
|
detail.append(el('p', 'hint', 'A level is: watch (read only), propose (asks before each action), frame (acts within its rules, asks for the rest), free (acts, kept in the journal).'));
|
|
4004
4027
|
/* Calls waiting for a person (propose/frame). Accept or refuse each. */
|
|
4005
4028
|
const waiting = (Array.isArray(tether.approvals) ? tether.approvals : []).filter((q) => (q.target?.id ?? q.target) === t.id);
|
|
@@ -4021,7 +4044,7 @@
|
|
|
4021
4044
|
const remove = el('button', 'as-link danger-link', 'Delete...'); remove.type = 'button';
|
|
4022
4045
|
const why = el('small', 'hint');
|
|
4023
4046
|
const inUse = chosen.kind !== 'secret' && using.length > 0;
|
|
4024
|
-
const lost = { secret: 'Its value is lost for good.', list: 'Its cards are lost for good.'
|
|
4047
|
+
const lost = chosen.target ? 'The connection is removed; the account token stays on the server.' : ({ secret: 'Its value is lost for good.', list: 'Its cards are lost for good.' }[chosen.kind] ?? 'Its files are kept aside on the server.');
|
|
4025
4048
|
if (inUse) { remove.disabled = true; why.textContent = ` used by ${using.length} conversation${using.length > 1 ? 's' : ''}: set ${using.length > 1 ? 'them' : 'it'} to Off first`; }
|
|
4026
4049
|
remove.addEventListener('click', () => {
|
|
4027
4050
|
const sure = el('button', 'danger', chosen.kind === 'secret' || chosen.kind === 'list' ? `Yes, delete ${chosen.name}` : `Yes, remove ${chosen.name}`); sure.type = 'button';
|
|
@@ -4032,7 +4055,7 @@
|
|
|
4032
4055
|
sure.addEventListener('click', async () => {
|
|
4033
4056
|
try {
|
|
4034
4057
|
if (chosen.kind === 'list') { const done = await binderCall('delete-list', { list: chosen.list.id }); if (!done.ok) throw new Error(done.text); }
|
|
4035
|
-
else if (chosen.
|
|
4058
|
+
else if (chosen.target) await post(`${API}/tether/remove-target`, { target: chosen.target.id });
|
|
4036
4059
|
else await post(chosen.kind === 'secret' ? `${API}/secrets/${chosen.name}/remove` : `${API}/resources/${chosen.name}/remove`);
|
|
4037
4060
|
assetOpen = '';
|
|
4038
4061
|
}
|
|
@@ -4045,7 +4068,7 @@
|
|
|
4045
4068
|
/* Given to a device: from here too (the map shows who has it). */
|
|
4046
4069
|
const share = el('button', 'as-link', 'Share with a device...'); share.type = 'button';
|
|
4047
4070
|
share.addEventListener('click', () => { void openCompose([[chosen.key, 'r']]); });
|
|
4048
|
-
const foot = el('div', 'as-foot'); foot.append(...(['secret', 'list'
|
|
4071
|
+
const foot = el('div', 'as-foot'); foot.append(...(['secret', 'list'].includes(chosen.kind) || chosen.target ? [] : [share, el('br')]), remove, why);
|
|
4049
4072
|
detail.append(foot);
|
|
4050
4073
|
}
|
|
4051
4074
|
/* From the map's "+" of Assets: the Assets page over the map, on "which kind"; Back, the map. */
|
|
@@ -7448,7 +7471,7 @@
|
|
|
7448
7471
|
what). Nothing is ever chosen for the owner but the thing they came
|
|
7449
7472
|
from; writing is never chosen for them. */
|
|
7450
7473
|
const KINDS = [['', 'All'], ['conversation', 'Conversations'], ['folder', 'Folders'], ['git', 'Repositories'], ['mailbox', 'Mailboxes']];
|
|
7451
|
-
const KIND_WORD = { conversation: 'conversation', folder: 'folder', git: 'repository', mailbox: 'mailbox',
|
|
7474
|
+
const KIND_WORD = { conversation: 'conversation', folder: 'folder', git: 'repository', mailbox: 'mailbox', agenda: 'calendar', contacts: 'address book', acces: 'access' };
|
|
7452
7475
|
const ago = (date) => {
|
|
7453
7476
|
if (!date) return 'never opened';
|
|
7454
7477
|
const minutes = Math.max(0, Math.round((Date.now() - Date.parse(date)) / 60000));
|