clavarium 0.2.382-next.1 → 0.2.384-next.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/deploy/online.mjs +8 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/gitkeeper.mjs +2 -1
- package/server/settingswords.mjs +12 -0
- package/server/updates.mjs +1 -1
- package/web/app.js +10 -8
package/deploy/online.mjs
CHANGED
|
@@ -59,6 +59,7 @@ export const PATHS = {
|
|
|
59
59
|
access: '/var/lib/clavarium-relay-access',
|
|
60
60
|
tunnel: '/var/lib/clavarium-tunnel',
|
|
61
61
|
tunnelUnit: TUNNEL_UNIT,
|
|
62
|
+
relayDone: '/var/lib/clavarium/update/relay-version',
|
|
62
63
|
relayConf: '/etc/clavarium/relay.conf',
|
|
63
64
|
updateConf: '/etc/clavarium/update.conf',
|
|
64
65
|
unit: '/etc/systemd/system/clavarium.service',
|
|
@@ -253,6 +254,11 @@ export async function keepRelayCurrent(sys, P = PATHS, { done, unit = TUNNEL_UNI
|
|
|
253
254
|
let last = '';
|
|
254
255
|
try { last = readFileSync(done, 'utf8').trim(); } catch { /* never brought */ }
|
|
255
256
|
if (last === version) return { state: 'current', version };
|
|
257
|
+
/* A new GENERATION of the relay program (0.1 -> 0.2: one relay for several homes, 07-11) is never brought
|
|
258
|
+
by the updater: the owner brings it once, `sudo clavarium relay update-relay`, when they want it.
|
|
259
|
+
Fixes within a generation still come by themselves. */
|
|
260
|
+
const gen = (v) => String(v).split('.').slice(0, 2).join('.');
|
|
261
|
+
if (gen(version) !== gen(last || '0.1.0')) return { state: 'held', version, why: `the relay program ${version} is a new generation: bring it with sudo clavarium relay update-relay` };
|
|
256
262
|
const r = await keeper(sys, P, conf, ['update-relay', version]);
|
|
257
263
|
if (r.code !== 0) {
|
|
258
264
|
/* sys.run says { code, out, err } (realSys). */
|
|
@@ -789,6 +795,8 @@ export async function relayCommand(args, sys, P = PATHS) {
|
|
|
789
795
|
if (!/^\d{1,4}\.\d{1,4}\.\d{1,6}(-[0-9A-Za-z.-]{1,40})?$/.test(version ?? '')) throw new Bad('relay update-relay [X.Y.Z]');
|
|
790
796
|
const r = await keeper(sys, P, conf, ['update-relay', version], { stream: true });
|
|
791
797
|
if (r.code !== 0) throw new Failed(`the relay did not update (exit ${r.code})`);
|
|
798
|
+
/* Said to the updater (keepRelayCurrent): this generation is the owner's choice now, its fixes come by themselves. */
|
|
799
|
+
try { const done = P.relayDone ?? '/var/lib/clavarium/update/relay-version'; writeFileSync(`${done}.new`, `${version}\n`); renameSync(`${done}.new`, done); } catch { /* the updater asks again: no harm */ }
|
|
792
800
|
return;
|
|
793
801
|
}
|
|
794
802
|
default: throw new Bad('usage: sudo clavarium relay status | repair | update-os [--reboot] | update-relay [X.Y.Z] | forget-setup-key | homes | invite NAME | add-home NAME --key KEY | remove-home NAME');
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.384-next.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.384-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/gitkeeper.mjs
CHANGED
|
@@ -190,7 +190,8 @@ export function withoutOldSetting(record) {
|
|
|
190
190
|
/* WHAT TO DO about a refused automatic sending, said after it in the chat;
|
|
191
191
|
by the reason #once is given (its first word when not listed whole). */
|
|
192
192
|
const TODO = Object.freeze({
|
|
193
|
-
|
|
193
|
+
/* 07-11: where it is set, said (the owner asked « on configure ça où ? »). */
|
|
194
|
+
cap: 'Raise the cap in this conversation: Assets, the repository, Automatic sending, « Sendings an hour ». Or send it from the review.',
|
|
194
195
|
create: 'Make the branch on the remote, send it from the review, or let this conversation create branches.',
|
|
195
196
|
'checks-failed': 'The agent was told; see the checks in the review.',
|
|
196
197
|
'checks-none': 'Set a check command or a pre-push hook, or stop asking for checks for this conversation.',
|
package/server/settingswords.mjs
CHANGED
|
@@ -26,6 +26,18 @@ export const SETTINGS_WORDS_FR = {
|
|
|
26
26
|
'set-update-out': '{v} est sortie', 'set-up-to-date': 'À jour · {v}', 'set-wifi-on': 'Wi-Fi · {name}', 'set-wifi-off': 'Wi-Fi non utilisé', 'set-cable': 'Câble',
|
|
27
27
|
/* A room message an AI could not get (its chat off): rooms.mjs say, missed. */
|
|
28
28
|
'set-room-missed': '{names} ne l\'a pas reçu : discussion coupée',
|
|
29
|
+
/* A repository's automatic sending (gitkeeper.mjs), in a conversation's Assets. */
|
|
30
|
+
'set-auto-title': 'Envoi automatique',
|
|
31
|
+
'set-auto-branches': 'Branches envoyées seules (vide : jamais)',
|
|
32
|
+
'set-auto-quiet': 'Délai de calme, en secondes',
|
|
33
|
+
'set-auto-hour': 'Envois par heure, au plus (0 : sans limite)',
|
|
34
|
+
'set-auto-create': 'Peut créer une branche absente du distant',
|
|
35
|
+
'set-auto-checks': 'Seulement après les vérifications',
|
|
36
|
+
'set-auto-off': 'désactivé',
|
|
37
|
+
'set-auto-on': 'activé : {list}',
|
|
38
|
+
'set-auto-saved': 'Enregistré.',
|
|
39
|
+
'set-auto-save': 'Enregistrer',
|
|
40
|
+
'set-auto-confirm': 'Confirmer et enregistrer',
|
|
29
41
|
/* A box's learning session (boxcollect.mjs): the radio, its false wakes kept. */
|
|
30
42
|
'set-collect': 'Séance d\'apprentissage (radio)', 'set-collect-from': 'de', 'set-collect-to': 'à',
|
|
31
43
|
'set-collect-go': 'Programmer', 'set-collect-stop': 'Arrêter', 'set-collect-scheduled': 'Programmée de {from} à {to}',
|
package/server/updates.mjs
CHANGED
|
@@ -67,7 +67,7 @@ function timerLastRun() {
|
|
|
67
67
|
}
|
|
68
68
|
const firstLine = (text) => String(text ?? '').trim().split('\n').filter(Boolean).pop()?.replace(/^REFUSED: /, '').slice(0, 300) ?? '';
|
|
69
69
|
|
|
70
|
-
const RELAY_STATES = ['none', 'no-key', 'current', 'brought', 'refused', 'failed'];
|
|
70
|
+
const RELAY_STATES = ['none', 'no-key', 'current', 'brought', 'refused', 'failed', 'held'];
|
|
71
71
|
|
|
72
72
|
export class Updates {
|
|
73
73
|
#host; #state; #conf; #version; #store; #alerts; #timer; #lastLook; #lastLookCache = { at: 0, value: null }; #clock; #noticeCache = { at: -Infinity, value: '' };
|
package/web/app.js
CHANGED
|
@@ -2328,7 +2328,7 @@
|
|
|
2328
2328
|
const box = document.createElement('details'); box.className = 'auto-send'; box.dataset.repository = name;
|
|
2329
2329
|
box.open = autoOpen.has(`${conversation}/${name}`);
|
|
2330
2330
|
box.addEventListener('toggle', () => { if (box.open) autoOpen.add(`${conversation}/${name}`); else autoOpen.delete(`${conversation}/${name}`); });
|
|
2331
|
-
const summary = document.createElement('summary'); summary.textContent = 'Automatic sending';
|
|
2331
|
+
const summary = document.createElement('summary'); summary.textContent = uiSaid('set-auto-title', 'Automatic sending');
|
|
2332
2332
|
const state = document.createElement('small'); state.className = 'hint auto-state'; summary.append(' ', state);
|
|
2333
2333
|
const form = document.createElement('form'); form.autocomplete = 'off';
|
|
2334
2334
|
const field = (text, input) => { const label = document.createElement('label'); label.textContent = text; label.append(input); return label; };
|
|
@@ -2345,23 +2345,23 @@
|
|
|
2345
2345
|
const unknown = document.createElement('p'); unknown.className = 'hint auto-unknown'; unknown.hidden = true;
|
|
2346
2346
|
unknown.textContent = 'The remote\'s default branch is not known yet (it is learnt at a refresh): until it is, nothing is sent by itself unless you confirm each branch or pattern of the list.';
|
|
2347
2347
|
const shared = document.createElement('p'); shared.className = 'hint auto-shared'; shared.hidden = true;
|
|
2348
|
-
const sure = document.createElement('button'); sure.type = 'button'; sure.className = 'danger auto-sure'; sure.textContent = 'Confirm and save'; sure.hidden = true;
|
|
2349
|
-
const save = document.createElement('button'); save.type = 'submit'; save.className = 'primary'; save.textContent = 'Save';
|
|
2348
|
+
const sure = document.createElement('button'); sure.type = 'button'; sure.className = 'danger auto-sure'; sure.textContent = uiSaid('set-auto-confirm', 'Confirm and save'); sure.hidden = true;
|
|
2349
|
+
const save = document.createElement('button'); save.type = 'submit'; save.className = 'primary'; save.textContent = uiSaid('set-auto-save', 'Save');
|
|
2350
2350
|
const said = document.createElement('span'); said.className = 'hint auto-said'; said.setAttribute('role', 'status');
|
|
2351
2351
|
const actions = document.createElement('div'); actions.className = 'row'; actions.append(save, sure, said);
|
|
2352
2352
|
/* Closed until the settings there are have arrived: a list typed
|
|
2353
2353
|
before would be overwritten by them. */
|
|
2354
2354
|
const fields = document.createElement('fieldset'); fields.disabled = true;
|
|
2355
2355
|
form.append(fields);
|
|
2356
|
-
fields.append(field('Branches it may send to by itself (one per line or comma, "try/*" allowed). Empty: never.', branches), hint,
|
|
2357
|
-
field('Quiet delay, in seconds', quiet), field('Sendings an hour, at most (0: no cap)', perHour),
|
|
2358
|
-
check('It may create a branch the remote does not have', create), check('Only after the checks passed in its machine', checks), unknown, shared, asking, actions);
|
|
2356
|
+
fields.append(field(uiSaid('set-auto-branches', 'Branches it may send to by itself (one per line or comma, "try/*" allowed). Empty: never.'), branches), hint,
|
|
2357
|
+
field(uiSaid('set-auto-quiet', 'Quiet delay, in seconds'), quiet), field(uiSaid('set-auto-hour', 'Sendings an hour, at most (0: no cap)'), perHour),
|
|
2358
|
+
check(uiSaid('set-auto-create', 'It may create a branch the remote does not have'), create), check(uiSaid('set-auto-checks', 'Only after the checks passed in its machine'), checks), unknown, shared, asking, actions);
|
|
2359
2359
|
box.append(summary, form);
|
|
2360
2360
|
const fill = (about) => {
|
|
2361
2361
|
const s = about.settings;
|
|
2362
2362
|
branches.value = s.branches.join('\n'); quiet.value = String(s.quietSeconds); perHour.value = String(s.perHour);
|
|
2363
2363
|
create.checked = s.create; checks.checked = s.checks;
|
|
2364
|
-
state.textContent = s.branches.length ?
|
|
2364
|
+
state.textContent = s.branches.length ? uiSaid('set-auto-on', 'on: {list}', { list: s.branches.join(', ') }) : uiSaid('set-auto-off', 'off');
|
|
2365
2365
|
unknown.hidden = Boolean(about.defaultBranch);
|
|
2366
2366
|
const others = about.sharedWith ?? [];
|
|
2367
2367
|
shared.hidden = others.length === 0;
|
|
@@ -2376,7 +2376,7 @@
|
|
|
2376
2376
|
const body = { branches: branches.value, quietSeconds: quiet.value === '' ? '' : Number(quiet.value), perHour: perHour.value === '' ? '' : Number(perHour.value), create: create.checked, checks: checks.checked, ...flags };
|
|
2377
2377
|
const r = await fetch(where, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
|
|
2378
2378
|
const j = await r.json().catch(() => ({}));
|
|
2379
|
-
if (r.ok) { for (const k of Object.keys(flags)) delete flags[k]; fill(j); said.textContent = 'Saved.'; return; }
|
|
2379
|
+
if (r.ok) { for (const k of Object.keys(flags)) delete flags[k]; fill(j); said.textContent = uiSaid('set-auto-saved', 'Saved.'); return; }
|
|
2380
2380
|
/* Nothing was saved: the owner reads what it would allow, then confirms or changes the list. */
|
|
2381
2381
|
if (j.kind === 'confirm-wide' || j.kind === 'confirm-shared') { asking.textContent = j.error; asking.hidden = false; sure.hidden = false; sure.dataset.kind = j.kind; return; }
|
|
2382
2382
|
said.textContent = j.error || 'The request failed.';
|
|
@@ -7306,6 +7306,8 @@
|
|
|
7306
7306
|
refused: () => ['Relay not kept up to date: it refuses this server\'s key', 'Once: sudo clavarium key on this server, then relay.sh again on the relay, with --key and --keeper-key.', true],
|
|
7307
7307
|
'no-key': () => ['Relay not kept up to date: no maintenance key', 'sudo clavarium online --relay HOST sets one up.', true],
|
|
7308
7308
|
failed: (r) => [`Relay update failed: ${r.why ?? 'unknown'} · tried again later`, '', true],
|
|
7309
|
+
/* 07-11: a new generation of the relay (several homes) waits for the owner, never brought by itself. */
|
|
7310
|
+
held: (r) => [`Relay ${r.version} ready, not installed`, 'When you want it: sudo clavarium relay update-relay', false],
|
|
7309
7311
|
};
|
|
7310
7312
|
const relayBox = $('updates-relay');
|
|
7311
7313
|
relayBox.hidden = !relay || !RELAY_SAID[relay.state];
|