clavarium 0.2.231-next.1 → 0.2.234-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 +2 -2
- package/package.json +1 -1
- package/server/accounts.mjs +2 -1
- package/web/app.js +30 -13
- package/web/index.html +12 -8
- package/web/style.css +1 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.234-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.234-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/accounts.mjs
CHANGED
|
@@ -130,7 +130,8 @@ export class Accounts {
|
|
|
130
130
|
const specs = [];
|
|
131
131
|
for (const k of wanted) {
|
|
132
132
|
const config = { user: address };
|
|
133
|
-
|
|
133
|
+
/* Its sending server too, unless none is given: then it reads, moves and flags, and refuses to send (02-11). */
|
|
134
|
+
if (k === 'mail') { const i = hostPort(imap, 'mail (IMAP)', 993); Object.assign(config, { host: i.host, port: i.port }); if (String(smtp ?? '').trim()) { const o = hostPort(smtp, 'sending (SMTP)', 587); Object.assign(config, { smtpHost: o.host, smtpPort: o.port }); } }
|
|
134
135
|
if (k === 'calendar') config.caldav = davUrl(caldav, 'calendar (CalDAV)');
|
|
135
136
|
if (k === 'contacts') config.carddav = davUrl(carddav, 'contacts (CardDAV)');
|
|
136
137
|
specs.push({ id: targetId(k, 'classic', address), title: `${KIND[k].title} — ${address}`, kind: KIND[k].kind, connector: KIND[k].connector, config, secrets: { password: name } });
|
package/web/app.js
CHANGED
|
@@ -7030,32 +7030,49 @@
|
|
|
7030
7030
|
catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
|
|
7031
7031
|
});
|
|
7032
7032
|
|
|
7033
|
+
/* NEW MAILBOX (02-11): an IMAP mailbox is connected LIVE by default, as a Microsoft or Google one -- the
|
|
7034
|
+
same levels, through Tether -- with its sending server (SMTP) too, unless "No sending". The former
|
|
7035
|
+
read-only copy as files stays, ticked on purpose. */
|
|
7036
|
+
let mailboxLooked = '';
|
|
7037
|
+
$('mailbox-user').addEventListener('change', async () => {
|
|
7038
|
+
const user = $('mailbox-user').value.trim();
|
|
7039
|
+
if (!user.includes('@') || user === mailboxLooked) return;
|
|
7040
|
+
mailboxLooked = user;
|
|
7041
|
+
try {
|
|
7042
|
+
const found = await post(`${API}/accounts/lookup`, { user });
|
|
7043
|
+
if (found?.imap && !$('mailbox-host').value.trim()) { const [h, p] = String(found.imap).split(':'); $('mailbox-host').value = h; if (p) $('mailbox-port').value = p; }
|
|
7044
|
+
if (found?.smtp && !$('mailbox-smtp').value.trim()) $('mailbox-smtp').value = found.smtp;
|
|
7045
|
+
} catch { /* typed by hand */ }
|
|
7046
|
+
});
|
|
7033
7047
|
$('mailbox-new').addEventListener('submit', async (event) => {
|
|
7034
7048
|
event.preventDefault();
|
|
7035
7049
|
$('mailbox-error').hidden = true;
|
|
7036
7050
|
const button = $('mailbox-new').querySelector('button[type=submit]');
|
|
7037
|
-
button.disabled = true; button.textContent = '
|
|
7051
|
+
button.disabled = true; button.textContent = 'Trying it...';
|
|
7052
|
+
const host = $('mailbox-host').value.trim(); const port = $('mailbox-port').value.trim();
|
|
7038
7053
|
try {
|
|
7039
|
-
await post(`${API}/
|
|
7040
|
-
assetOpen = `
|
|
7054
|
+
const made = await post(`${API}/accounts/classic`, { user: $('mailbox-user').value.trim(), password: $('mailbox-password').value, imap: port ? `${host}:${port}` : host, smtp: $('mailbox-smtp').value.trim(), kinds: ['mail'] });
|
|
7055
|
+
if (made?.targets?.[0]?.id) assetOpen = `connexion:${made.targets[0].id}`;
|
|
7056
|
+
assetsAdding = ''; $('mailbox-new').reset(); mailboxLooked = '';
|
|
7041
7057
|
} catch (error) { $('mailbox-error').textContent = error.message; $('mailbox-error').hidden = false; }
|
|
7042
|
-
button.disabled = false; button.textContent = '
|
|
7058
|
+
button.disabled = false; button.textContent = 'Connect';
|
|
7043
7059
|
await paintAssets();
|
|
7044
7060
|
});
|
|
7045
|
-
/* New mailbox
|
|
7046
|
-
|
|
7047
|
-
straight to adding one. */
|
|
7061
|
+
/* New mailbox: IMAP and SMTP, connected live (02-11). Gmail and Microsoft sign in instead (token kept on
|
|
7062
|
+
the server): "Sign in with them" jumps to that form. */
|
|
7048
7063
|
const MAILBOX_PROVIDER = { google: 'Google', microsoft: 'Microsoft', classic: 'your host' };
|
|
7049
7064
|
/* Which kinds each provider can be connected for (from the server). */
|
|
7050
7065
|
let accountSupported = { google: ['mail', 'calendar', 'contacts'], microsoft: ['mail'], classic: ['mail', 'calendar', 'contacts'] };
|
|
7051
7066
|
/* From New mailbox: the account form, on the host's kind ("Other") with what was typed here, unless it is Gmail or Microsoft. */
|
|
7052
|
-
|
|
7053
|
-
|
|
7067
|
+
/* The kind of mailbox, in plain sight (02-11): Google or Microsoft sign in (the account form, on that
|
|
7068
|
+
provider); any other is the IMAP + SMTP form right here. */
|
|
7069
|
+
for (const b of $('mailbox-provider').querySelectorAll('button')) b.addEventListener('click', async () => {
|
|
7070
|
+
const provider = b.dataset.provider;
|
|
7071
|
+
if (provider === 'classic') return;
|
|
7072
|
+
const user = $('mailbox-user').value.trim();
|
|
7054
7073
|
assetsAdding = 'connexion'; await paintAssets();
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
if (user.includes('@')) { $('connexion-email').value = user; $('connexion-email').dispatchEvent(new Event('change')); }
|
|
7058
|
-
if (host && !big && !$('connexion-imap').value.trim()) $('connexion-imap').value = host;
|
|
7074
|
+
setConnexionProvider(provider);
|
|
7075
|
+
if (user.includes('@')) $('connexion-email').value = user;
|
|
7059
7076
|
});
|
|
7060
7077
|
/* CONNECT AN ACCOUNT (Connexions): a live link through Tether. The person signs
|
|
7061
7078
|
in in their own browser; the token is kept on the server, never in a machine.
|
package/web/index.html
CHANGED
|
@@ -541,18 +541,22 @@
|
|
|
541
541
|
<p id="git-keys-empty" class="hint">No key yet: "New key" in Add a repository makes one.</p>
|
|
542
542
|
</div>
|
|
543
543
|
<div id="mailbox-box" class="as-form" data-kind="mailbox"><h3>New mailbox</h3>
|
|
544
|
-
<div
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
<
|
|
548
|
-
|
|
544
|
+
<div id="mailbox-provider" class="choices" role="group" aria-label="Kind of mailbox">
|
|
545
|
+
<button type="button" data-provider="google">Gmail / Google</button>
|
|
546
|
+
<button type="button" data-provider="microsoft">Microsoft / Outlook</button>
|
|
547
|
+
<button type="button" data-provider="classic" aria-pressed="true">Other: IMAP / SMTP (OVH, Infomaniak…)</button>
|
|
548
|
+
</div>
|
|
549
|
+
<p class="hint">Its IMAP and SMTP settings, like any mail app. What a conversation may do with it is chosen when you give it to one.</p>
|
|
550
|
+
<form id="mailbox-new" autocomplete="off" data-provider="imap" data-how="live">
|
|
551
|
+
<label for="mailbox-user">Email address</label>
|
|
552
|
+
<input id="mailbox-user" inputmode="email" spellcheck="false" autocapitalize="off" autocomplete="off" placeholder="you@example.com">
|
|
549
553
|
<label for="mailbox-host">Mail server (IMAP, TLS)</label>
|
|
550
554
|
<div class="row"><input id="mailbox-host" placeholder="imap.example.com" spellcheck="false" autocapitalize="off"><input id="mailbox-port" inputmode="numeric" placeholder="993" aria-label="Port" size="5"></div>
|
|
551
|
-
<label for="mailbox-
|
|
552
|
-
<input id="mailbox-
|
|
555
|
+
<label for="mailbox-smtp" class="mailbox-live">Sending server (SMTP)</label>
|
|
556
|
+
<input id="mailbox-smtp" class="mailbox-live" placeholder="smtp.example.com — empty: no sending" spellcheck="false" autocapitalize="off">
|
|
553
557
|
<label for="mailbox-password">Password</label>
|
|
554
558
|
<div class="row"><input id="mailbox-password" type="password" autocomplete="new-password">
|
|
555
|
-
<button type="submit" class="primary">
|
|
559
|
+
<button type="submit" class="primary">Connect</button></div>
|
|
556
560
|
<p id="mailbox-error" class="error" role="alert" hidden></p>
|
|
557
561
|
</form>
|
|
558
562
|
</div>
|
package/web/style.css
CHANGED
|
@@ -2109,3 +2109,4 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2109
2109
|
.as-live > button { align-self: flex-start; }
|
|
2110
2110
|
.as-live-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-width: 28rem; }
|
|
2111
2111
|
.as-live-form > button { justify-self: start; margin-top: 4px; }
|
|
2112
|
+
|