clavarium 0.2.129-next.1 → 0.2.130-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/npm-shrinkwrap.json +10 -10
- package/package.json +3 -3
- package/server/accounts.mjs +78 -2
- package/server/api.mjs +2 -0
- package/server/main.mjs +1 -1
- package/server/tethers.mjs +9 -0
- package/web/app.js +43 -5
- package/web/index.html +16 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.130-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.130-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
13
13
|
"@xterm/xterm": "^6.0.0",
|
|
14
|
-
"clavarium-binder": "0.1.
|
|
14
|
+
"clavarium-binder": "0.1.37-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
16
|
"clavarium-parley": "0.17.20-next.1",
|
|
17
|
-
"clavarium-tether": "0.1.0-next.
|
|
17
|
+
"clavarium-tether": "0.1.0-next.32",
|
|
18
18
|
"mermaid": "11.17.2",
|
|
19
19
|
"node-pty": "^1.1.0",
|
|
20
20
|
"pdfjs-dist": "6.4.299",
|
|
@@ -716,9 +716,9 @@
|
|
|
716
716
|
}
|
|
717
717
|
},
|
|
718
718
|
"node_modules/clavarium-binder": {
|
|
719
|
-
"version": "0.1.
|
|
720
|
-
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.
|
|
721
|
-
"integrity": "sha512-
|
|
719
|
+
"version": "0.1.37-next.1",
|
|
720
|
+
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.37-next.1.tgz",
|
|
721
|
+
"integrity": "sha512-cihiR52xE8A9V7QeM7ZRsVQ3YdA54fjjxcPvaGBRtD6gOA4r/XlL29YAu3aJKt2975UR6dHJHOAVws32fw6zAg==",
|
|
722
722
|
"license": "MIT",
|
|
723
723
|
"bin": {
|
|
724
724
|
"binder": "bin/binder.mjs",
|
|
@@ -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.32",
|
|
759
|
+
"resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.32.tgz",
|
|
760
|
+
"integrity": "sha512-Lkw2EqT79rqDi1q8+nhV1Ll30maopyNvwwHZkXYKp7IPoAUOde9R+Gtf7tCO8X/ArqEoADM7gouWnW+w+h1cXA==",
|
|
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.130-next.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.",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@xterm/addon-fit": "^0.11.0",
|
|
46
46
|
"@xterm/xterm": "^6.0.0",
|
|
47
|
-
"clavarium-binder": "0.1.
|
|
47
|
+
"clavarium-binder": "0.1.37-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
49
|
"clavarium-parley": "0.17.20-next.1",
|
|
50
|
-
"clavarium-tether": "0.1.0-next.
|
|
50
|
+
"clavarium-tether": "0.1.0-next.32",
|
|
51
51
|
"mermaid": "11.17.2",
|
|
52
52
|
"node-pty": "^1.1.0",
|
|
53
53
|
"pdfjs-dist": "6.4.299",
|
package/server/accounts.mjs
CHANGED
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
* own open-source desktop client, verified for all three: Google over IMAP +
|
|
17
17
|
* CalDAV/CardDAV, Microsoft over Microsoft Graph (mail, calendar and contacts).
|
|
18
18
|
*
|
|
19
|
+
* A CLASSIC ACCOUNT (OVH, Infomaniak, Nextcloud... any IMAP/SMTP + CalDAV/CardDAV host)
|
|
20
|
+
* has no token: it signs in with its password. The password is kept the same way, a
|
|
21
|
+
* host-only secret the keeper reveals to the connector alone; each kind is tried live
|
|
22
|
+
* before anything is kept, so a wrong server or password is said at once.
|
|
23
|
+
*
|
|
19
24
|
* A CREATED TARGET IS GIVEN TO NO ONE. The person grants it per conversation, at
|
|
20
25
|
* its own level, from the page (Assets > Access) -- like git: one mailbox, many
|
|
21
26
|
* conversations, each its own rights.
|
|
@@ -45,6 +50,14 @@ const KIND = {
|
|
|
45
50
|
/* What each provider's built-in (Thunderbird) client grants a refresh token for. */
|
|
46
51
|
const SUPPORTED = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail', 'calendar', 'contacts'] };
|
|
47
52
|
|
|
53
|
+
/* Servers of common classic hosts, by the address's domain (what ISPDB lacks: the
|
|
54
|
+
calendar and contacts addresses). */
|
|
55
|
+
const CLASSIC = {
|
|
56
|
+
'ovh.net': { imap: 'ssl0.ovh.net', smtp: 'ssl0.ovh.net' },
|
|
57
|
+
'infomaniak.com': { imap: 'mail.infomaniak.com', smtp: 'mail.infomaniak.com', caldav: 'https://sync.infomaniak.com', carddav: 'https://sync.infomaniak.com' },
|
|
58
|
+
'ik.me': { imap: 'mail.infomaniak.com', smtp: 'mail.infomaniak.com', caldav: 'https://sync.infomaniak.com', carddav: 'https://sync.infomaniak.com' },
|
|
59
|
+
'fastmail.com': { imap: 'imap.fastmail.com', smtp: 'smtp.fastmail.com', caldav: 'https://caldav.fastmail.com', carddav: 'https://carddav.fastmail.com' },
|
|
60
|
+
};
|
|
48
61
|
const emailOk = (s) => /^[^\s@]{1,64}@[^\s@]{1,190}\.[^\s@]{2,}$/.test(s);
|
|
49
62
|
/* A deterministic, valid secret name for an account's token: a short slug of the
|
|
50
63
|
address plus a hash of it, so reconnecting the same account reuses the name
|
|
@@ -62,10 +75,73 @@ export class Accounts {
|
|
|
62
75
|
|
|
63
76
|
/* `secrets`: the vault (set host-only, by name). `targets`: { put(spec) } onto
|
|
64
77
|
the Tether store. `fetch`: injected for tests. */
|
|
65
|
-
|
|
78
|
+
#probe;
|
|
79
|
+
constructor({ secrets, targets, fetch = globalThis.fetch, probe = null }) {
|
|
66
80
|
if (!secrets?.set) throw new Error('accounts needs the secret store');
|
|
67
81
|
if (!targets?.put) throw new Error('accounts needs the Tether target store');
|
|
68
|
-
this.#secrets = secrets; this.#targets = targets; this.#fetch = fetch;
|
|
82
|
+
this.#secrets = secrets; this.#targets = targets; this.#fetch = fetch; this.#probe = probe;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* The servers of a classic address, as far as they can be known: a few common
|
|
86
|
+
hosts, else the public Thunderbird database of mail providers (ISPDB). What
|
|
87
|
+
is not known stays empty for the person to fill. */
|
|
88
|
+
async lookup({ user } = {}) {
|
|
89
|
+
const address = String(user ?? '').trim();
|
|
90
|
+
if (!emailOk(address)) throw new Refusal(400, 'The account needs its email address.');
|
|
91
|
+
const domain = address.split('@')[1].toLowerCase();
|
|
92
|
+
const known = Object.entries(CLASSIC).find(([d]) => domain === d || domain.endsWith(`.${d}`))?.[1];
|
|
93
|
+
const out = { imap: '', smtp: '', caldav: '', carddav: '', ...(known ?? {}) };
|
|
94
|
+
if (!out.imap || !out.smtp) {
|
|
95
|
+
try {
|
|
96
|
+
const r = await this.#fetch(`https://autoconfig.thunderbird.net/v1.1/${encodeURIComponent(domain)}`);
|
|
97
|
+
if (r.ok) {
|
|
98
|
+
const xml = await r.text();
|
|
99
|
+
const servers = (kind) => [...xml.matchAll(new RegExp(`<(incomingServer|outgoingServer) type="${kind}">([\\s\\S]*?)</\\1>`, 'g'))].map((m) => ({ host: /<hostname>([^<]+)</.exec(m[2])?.[1] ?? '', port: /<port>(\\d+)</.exec(m[2])?.[1] ?? '', socket: /<socketType>([^<]+)</.exec(m[2])?.[1] ?? '' }));
|
|
100
|
+
const imap = servers('imap').find((x) => x.socket === 'SSL') ?? null;
|
|
101
|
+
const smtp = servers('smtp').find((x) => x.socket === 'STARTTLS') ?? null;
|
|
102
|
+
if (!out.imap && imap?.host) out.imap = `${imap.host}${imap.port && imap.port !== '993' ? `:${imap.port}` : ''}`;
|
|
103
|
+
if (!out.smtp && smtp?.host) out.smtp = `${smtp.host}${smtp.port && smtp.port !== '587' ? `:${smtp.port}` : ''}`;
|
|
104
|
+
}
|
|
105
|
+
} catch { /* not known there: the person fills it */ }
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Connect a classic account: its password kept host-only, a target per kind,
|
|
111
|
+
each tried live first (nothing is kept if one fails). */
|
|
112
|
+
async classic({ user, password, imap, smtp, caldav, carddav, kinds } = {}) {
|
|
113
|
+
const address = String(user ?? '').trim();
|
|
114
|
+
if (!emailOk(address)) throw new Refusal(400, 'The account needs its email address.');
|
|
115
|
+
const secret = String(password ?? '');
|
|
116
|
+
if (!secret) throw new Refusal(400, 'The account needs its password.');
|
|
117
|
+
const wanted = (Array.isArray(kinds) && kinds.length ? kinds : ['mail']).map(String).filter((k) => KIND[k]);
|
|
118
|
+
if (!wanted.length) throw new Refusal(400, 'Choose at least mail, calendar or contacts.');
|
|
119
|
+
const hostPort = (v, what, port) => {
|
|
120
|
+
const m = /^([a-z0-9.-]+\.[a-z]{2,})(?::(\d{1,5}))?$/i.exec(String(v ?? '').trim());
|
|
121
|
+
if (!m) throw new Refusal(400, `The ${what} server is a name like mail.example.com.`);
|
|
122
|
+
return { host: m[1].toLowerCase(), port: Number(m[2] ?? port) };
|
|
123
|
+
};
|
|
124
|
+
const davUrl = (v, what) => {
|
|
125
|
+
let u; try { u = new URL(/^https?:\/\//i.test(String(v ?? '').trim()) ? String(v).trim() : `https://${String(v ?? '').trim()}`); } catch { u = null; }
|
|
126
|
+
if (!u || u.protocol !== 'https:' || !u.hostname.includes('.')) throw new Refusal(400, `The ${what} address is an https address, like https://dav.example.com.`);
|
|
127
|
+
return u.href;
|
|
128
|
+
};
|
|
129
|
+
const name = secretName('classic', address);
|
|
130
|
+
const specs = [];
|
|
131
|
+
for (const k of wanted) {
|
|
132
|
+
const config = { user: address };
|
|
133
|
+
if (k === 'mail') { const i = hostPort(imap, 'mail (IMAP)', 993); const o = hostPort(smtp, 'sending (SMTP)', 587); Object.assign(config, { host: i.host, port: i.port, smtpHost: o.host, smtpPort: o.port }); }
|
|
134
|
+
if (k === 'calendar') config.caldav = davUrl(caldav, 'calendar (CalDAV)');
|
|
135
|
+
if (k === 'contacts') config.carddav = davUrl(carddav, 'contacts (CardDAV)');
|
|
136
|
+
specs.push({ id: targetId(k, 'classic', address), title: `${KIND[k].title} — ${address}`, kind: KIND[k].kind, connector: KIND[k].connector, config, secrets: { password: name } });
|
|
137
|
+
}
|
|
138
|
+
if (this.#probe) for (const t of specs) {
|
|
139
|
+
try { await this.#probe(t, secret); }
|
|
140
|
+
catch (e) { throw new Refusal(400, `${KIND[t.connector === 'mail' ? 'mail' : t.connector].title}: ${String(e?.message ?? e).replace(/^.*?: /, '')}`); }
|
|
141
|
+
}
|
|
142
|
+
this.#secrets.set({ name, value: secret, hostOnly: true });
|
|
143
|
+
const made = specs.map((t) => { const saved = this.#targets.put(t); return { id: saved?.id ?? t.id, title: saved?.title ?? t.title, kind: t.kind }; });
|
|
144
|
+
return { provider: 'classic', user: address, targets: made, authorized: wanted, denied: [] };
|
|
69
145
|
}
|
|
70
146
|
|
|
71
147
|
/* Which kinds may be connected, per provider, for the page to offer. */
|
package/server/api.mjs
CHANGED
|
@@ -434,6 +434,8 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
434
434
|
kept host-only, a Tether target made): see accounts.mjs. */
|
|
435
435
|
if (pathname === '/api/accounts/consent' && accounts) return send(200, accounts.consent(body)), true;
|
|
436
436
|
if (pathname === '/api/accounts/connect' && accounts) { const made = await accounts.connect(body); return send(201, made), true; }
|
|
437
|
+
if (pathname === '/api/accounts/lookup' && accounts) return send(200, await accounts.lookup(body)), true;
|
|
438
|
+
if (pathname === '/api/accounts/classic' && accounts) { const made = await accounts.classic(body); return send(201, made), true; }
|
|
437
439
|
if (pathname === '/api/accounts/verify' && accounts) { const r = await accounts.verify(body); return send(200, r), true; }
|
|
438
440
|
/* Assets > Access: the owner sets a conversation's level and rules on a
|
|
439
441
|
target, decides a call that waited, or removes a target. Each is an op the
|
package/server/main.mjs
CHANGED
|
@@ -411,7 +411,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
411
411
|
/* Connecting a mailbox, calendar or address book by token: the consent happens
|
|
412
412
|
in the owner's browser, the refresh token is kept host-only (never in a
|
|
413
413
|
machine) and a Tether target is made for it: see accounts.mjs. */
|
|
414
|
-
const accounts = new Accounts({ secrets, targets: { put: (spec) => tethers.store().putTarget(spec), all: () => tethers.store().targets() } });
|
|
414
|
+
const accounts = new Accounts({ secrets, targets: { put: (spec) => tethers.store().putTarget(spec), all: () => tethers.store().targets() }, probe: (target, password) => tethers.probe(target, password) });
|
|
415
415
|
/* A calendar target made before it needed the account address (Google CalDAV
|
|
416
416
|
puts it in the URL) carries none. The same account's mailbox or address book
|
|
417
417
|
has it -- they share the one refresh token -- so fill it in from a sibling,
|
package/server/tethers.mjs
CHANGED
|
@@ -110,6 +110,15 @@ export class Tethers {
|
|
|
110
110
|
/* The store behind it, for the Assets page to create/give/remove targets. */
|
|
111
111
|
store() { return this.#keeper.store; }
|
|
112
112
|
|
|
113
|
+
/* A first read of a target not saved yet, its password given here: does the account
|
|
114
|
+
answer? Used when a classic account is connected, before anything is kept. */
|
|
115
|
+
async probe(target, password) {
|
|
116
|
+
const verb = { mail: 'mail.list', calendar: 'calendar.list', contacts: 'contacts.list' }[target.connector];
|
|
117
|
+
const conn = this.#keeper.connectors?.[target.connector];
|
|
118
|
+
if (!verb || !conn) throw new Error(`no ${target.connector} connector`);
|
|
119
|
+
await conn.run(verb, target, {}, { agent: 'person:owner', secret: async () => password });
|
|
120
|
+
}
|
|
121
|
+
|
|
113
122
|
/* What each conversation was given: { name: count } -- the targets it may use. */
|
|
114
123
|
given() {
|
|
115
124
|
const out = {};
|
package/web/app.js
CHANGED
|
@@ -4338,7 +4338,7 @@
|
|
|
4338
4338
|
}
|
|
4339
4339
|
if (chosen.siblings?.length) {
|
|
4340
4340
|
const a = el('p', 'as-assoc hint');
|
|
4341
|
-
a.append(el('b', '', 'Linked'), document.createTextNode(` to the same account: ${chosen.siblings.join(', ')}. They share the account's
|
|
4341
|
+
a.append(el('b', '', 'Linked'), document.createTextNode(` to the same account: ${chosen.siblings.join(', ')}. They share the account's sign-in (kept on the server); rights are given separately.`));
|
|
4342
4342
|
detail.append(a);
|
|
4343
4343
|
}
|
|
4344
4344
|
}
|
|
@@ -6407,9 +6407,9 @@
|
|
|
6407
6407
|
/* New mailbox is now the classic IMAP file-copy alone. Gmail and Microsoft are
|
|
6408
6408
|
a live Connexion (dynamic connector, token kept on the server): this jumps
|
|
6409
6409
|
straight to adding one. */
|
|
6410
|
-
const MAILBOX_PROVIDER = { google: 'Google', microsoft: 'Microsoft' };
|
|
6410
|
+
const MAILBOX_PROVIDER = { google: 'Google', microsoft: 'Microsoft', classic: 'your host' };
|
|
6411
6411
|
/* Which kinds each provider can be connected for (from the server). */
|
|
6412
|
-
let accountSupported = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'] };
|
|
6412
|
+
let accountSupported = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'], classic: ['mail', 'calendar', 'contacts'] };
|
|
6413
6413
|
$('mailbox-to-connexion').addEventListener('click', () => { assetsAdding = 'connexion'; void paintAssets(); });
|
|
6414
6414
|
/* CONNECT AN ACCOUNT (Connexions): a live link through Tether. The person signs
|
|
6415
6415
|
in in their own browser; the token is kept on the server, never in a machine.
|
|
@@ -6419,7 +6419,12 @@
|
|
|
6419
6419
|
const form = $('connexion-new');
|
|
6420
6420
|
form.dataset.provider = provider;
|
|
6421
6421
|
for (const b of $('connexion-provider').querySelectorAll('button')) b.setAttribute('aria-pressed', String(b.dataset.provider === provider));
|
|
6422
|
-
const
|
|
6422
|
+
const classic = provider === 'classic';
|
|
6423
|
+
$('connexion-classic').hidden = !classic;
|
|
6424
|
+
$('connexion-open-row').hidden = classic;
|
|
6425
|
+
$('connexion-notice').hidden = classic;
|
|
6426
|
+
if (classic) showClassicFields();
|
|
6427
|
+
const kinds = classic ? ['mail', 'calendar', 'contacts'] : accountSupported[provider] ?? ['mail'];
|
|
6423
6428
|
for (const [id, k] of [['connexion-calendar', 'calendar'], ['connexion-contacts', 'contacts']]) { const c = $(id); const ok = kinds.includes(k); if (!ok) c.checked = false; c.disabled = !ok; $(`${id}-label`).classList.toggle('off', !ok); }
|
|
6424
6429
|
$('connexion-paste').hidden = true;
|
|
6425
6430
|
$('connexion-error').hidden = true;
|
|
@@ -6432,6 +6437,39 @@
|
|
|
6432
6437
|
$('connexion-open').textContent = `Open the ${who} sign-in page`;
|
|
6433
6438
|
};
|
|
6434
6439
|
for (const b of $('connexion-provider').querySelectorAll('button')) b.addEventListener('click', () => setConnexionProvider(b.dataset.provider));
|
|
6440
|
+
/* A CLASSIC ACCOUNT (OVH, Infomaniak, Nextcloud...): a password and its servers,
|
|
6441
|
+
filled from the address when known. Only the servers of the kinds ticked show. */
|
|
6442
|
+
function showClassicFields() {
|
|
6443
|
+
const on = (k) => $(`connexion-${k}`).checked;
|
|
6444
|
+
for (const [f, k] of [['imap', 'mail'], ['smtp', 'mail'], ['caldav', 'calendar'], ['carddav', 'contacts']]) { $(`connexion-${f}`).hidden = !on(k); $(`connexion-${f}-label`).hidden = !on(k); }
|
|
6445
|
+
}
|
|
6446
|
+
for (const id of ['connexion-mail', 'connexion-calendar', 'connexion-contacts']) $(id).addEventListener('change', () => { if ($('connexion-new').dataset.provider === 'classic') showClassicFields(); });
|
|
6447
|
+
let lookedUp = '';
|
|
6448
|
+
$('connexion-email').addEventListener('change', async () => {
|
|
6449
|
+
const user = $('connexion-email').value.trim();
|
|
6450
|
+
if ($('connexion-new').dataset.provider !== 'classic' || !user.includes('@') || user === lookedUp) return;
|
|
6451
|
+
lookedUp = user;
|
|
6452
|
+
try {
|
|
6453
|
+
const found = await post(`${API}/accounts/lookup`, { user });
|
|
6454
|
+
for (const f of ['imap', 'smtp', 'caldav', 'carddav']) if (found?.[f] && !$(`connexion-${f}`).value.trim()) $(`connexion-${f}`).value = found[f];
|
|
6455
|
+
} catch { /* filled by hand */ }
|
|
6456
|
+
});
|
|
6457
|
+
$('connexion-classic-connect').addEventListener('click', async () => {
|
|
6458
|
+
$('connexion-error').hidden = true;
|
|
6459
|
+
const kinds = connexionKinds();
|
|
6460
|
+
if (!kinds.length) { $('connexion-error').textContent = 'Choose at least mail, calendar or contacts.'; $('connexion-error').hidden = false; return; }
|
|
6461
|
+
const btn = $('connexion-classic-connect'); const was = btn.textContent; btn.disabled = true; btn.textContent = 'Trying the account…';
|
|
6462
|
+
try {
|
|
6463
|
+
const made = await post(`${API}/accounts/classic`, { user: $('connexion-email').value.trim(), password: $('connexion-password').value, kinds,
|
|
6464
|
+
imap: $('connexion-imap').value.trim(), smtp: $('connexion-smtp').value.trim(), caldav: $('connexion-caldav').value.trim(), carddav: $('connexion-carddav').value.trim() });
|
|
6465
|
+
if (made?.targets?.[0]) assetOpen = `connexion:${made.targets[0].id}`;
|
|
6466
|
+
assetsAdding = ''; lookedUp = '';
|
|
6467
|
+
$('connexion-new').reset(); setConnexionProvider('google');
|
|
6468
|
+
} catch (error) { $('connexion-error').textContent = error.message; $('connexion-error').hidden = false; }
|
|
6469
|
+
$('connexion-password').value = '';
|
|
6470
|
+
btn.disabled = false; btn.textContent = was;
|
|
6471
|
+
await paintAssets();
|
|
6472
|
+
});
|
|
6435
6473
|
const connexionKinds = () => [['connexion-mail', 'mail'], ['connexion-calendar', 'calendar'], ['connexion-contacts', 'contacts']].filter(([id]) => $(id).checked && !$(id).disabled).map(([, k]) => k);
|
|
6436
6474
|
$('connexion-open').addEventListener('click', async () => {
|
|
6437
6475
|
$('connexion-error').hidden = true;
|
|
@@ -6471,7 +6509,7 @@
|
|
|
6471
6509
|
await paintAssets();
|
|
6472
6510
|
});
|
|
6473
6511
|
setConnexionProvider('google');
|
|
6474
|
-
getJson('/accounts', null).then((d) => { if (d?.supported) { accountSupported = d.supported; setConnexionProvider($('connexion-new').dataset.provider || 'google'); } });
|
|
6512
|
+
getJson('/accounts', null).then((d) => { if (d?.supported) { accountSupported = { ...d.supported, classic: ['mail', 'calendar', 'contacts'] }; setConnexionProvider($('connexion-new').dataset.provider || 'google'); } });
|
|
6475
6513
|
$('list-new').addEventListener('submit', async (event) => {
|
|
6476
6514
|
event.preventDefault();
|
|
6477
6515
|
$('assets-error').hidden = true;
|
package/web/index.html
CHANGED
|
@@ -537,6 +537,7 @@
|
|
|
537
537
|
<div id="connexion-provider" class="choices" role="group" aria-label="Kind of account">
|
|
538
538
|
<button type="button" data-provider="google" aria-pressed="true">Google</button>
|
|
539
539
|
<button type="button" data-provider="microsoft">Microsoft</button>
|
|
540
|
+
<button type="button" data-provider="classic">Other (OVH, Infomaniak…)</button>
|
|
540
541
|
</div>
|
|
541
542
|
<label for="connexion-email">Email address</label>
|
|
542
543
|
<input id="connexion-email" type="email" spellcheck="false" autocapitalize="off" autocomplete="off" placeholder="your email address">
|
|
@@ -545,8 +546,22 @@
|
|
|
545
546
|
<label class="check" id="connexion-calendar-label"><input type="checkbox" id="connexion-calendar"> Calendar</label>
|
|
546
547
|
<label class="check" id="connexion-contacts-label"><input type="checkbox" id="connexion-contacts"> Contacts</label>
|
|
547
548
|
</div>
|
|
549
|
+
<div id="connexion-classic" hidden>
|
|
550
|
+
<label for="connexion-password">Password</label>
|
|
551
|
+
<input id="connexion-password" type="password" autocomplete="new-password" placeholder="the account's password">
|
|
552
|
+
<label for="connexion-imap" id="connexion-imap-label">Mail server (IMAP)</label>
|
|
553
|
+
<input id="connexion-imap" spellcheck="false" autocapitalize="off" placeholder="mail.example.com">
|
|
554
|
+
<label for="connexion-smtp" id="connexion-smtp-label">Sending server (SMTP)</label>
|
|
555
|
+
<input id="connexion-smtp" spellcheck="false" autocapitalize="off" placeholder="smtp.example.com">
|
|
556
|
+
<label for="connexion-caldav" id="connexion-caldav-label">Calendar address (CalDAV)</label>
|
|
557
|
+
<input id="connexion-caldav" spellcheck="false" autocapitalize="off" placeholder="https://dav.example.com">
|
|
558
|
+
<label for="connexion-carddav" id="connexion-carddav-label">Contacts address (CardDAV)</label>
|
|
559
|
+
<input id="connexion-carddav" spellcheck="false" autocapitalize="off" placeholder="https://dav.example.com">
|
|
560
|
+
<p class="hint">Filled from the email address when known; your host's help pages give them otherwise. The password stays on the server and never enters a machine.</p>
|
|
561
|
+
<div class="row"><button type="button" id="connexion-classic-connect" class="primary">Connect</button></div>
|
|
562
|
+
</div>
|
|
548
563
|
<p class="hint" id="connexion-notice"></p>
|
|
549
|
-
<div class="row"><button type="button" id="connexion-open" class="primary">Open the sign-in page</button></div>
|
|
564
|
+
<div class="row" id="connexion-open-row"><button type="button" id="connexion-open" class="primary">Open the sign-in page</button></div>
|
|
550
565
|
<div id="connexion-paste" hidden>
|
|
551
566
|
<label for="connexion-code">After you allow, the page will not load — copy its full address and paste it here</label>
|
|
552
567
|
<div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="Paste the whole address from the bar"><button type="button" id="connexion-connect" class="primary">Connect</button></div>
|