clavarium 0.2.231-next.1 → 0.2.232-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 +23 -8
- package/web/index.html +7 -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.232-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.232-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,21 +7030,36 @@
|
|
|
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'] };
|
|
@@ -7053,7 +7068,7 @@
|
|
|
7053
7068
|
const user = $('mailbox-user').value.trim(); const host = $('mailbox-host').value.trim();
|
|
7054
7069
|
assetsAdding = 'connexion'; await paintAssets();
|
|
7055
7070
|
const big = /@(gmail|googlemail|outlook|hotmail|live)\./i.test(user) ? (/gmail|googlemail/i.test(user) ? 'google' : 'microsoft') : null;
|
|
7056
|
-
setConnexionProvider(big ?? '
|
|
7071
|
+
setConnexionProvider(big ?? 'google');
|
|
7057
7072
|
if (user.includes('@')) { $('connexion-email').value = user; $('connexion-email').dispatchEvent(new Event('change')); }
|
|
7058
7073
|
if (host && !big && !$('connexion-imap').value.trim()) $('connexion-imap').value = host;
|
|
7059
7074
|
});
|
package/web/index.html
CHANGED
|
@@ -541,18 +541,17 @@
|
|
|
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 class="hint">
|
|
545
|
-
<
|
|
546
|
-
|
|
547
|
-
<
|
|
548
|
-
<input id="mailbox-name" maxlength="32" pattern="[a-z]([a-z0-9-]{0,30}[a-z0-9])?" placeholder="inbox" spellcheck="false" autocapitalize="off" required>
|
|
544
|
+
<div 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. Gmail or Microsoft? <button type="button" id="mailbox-to-connexion" class="as-link">Sign in with them</button></div>
|
|
545
|
+
<form id="mailbox-new" autocomplete="off" data-provider="imap" data-how="live">
|
|
546
|
+
<label for="mailbox-user">Email address</label>
|
|
547
|
+
<input id="mailbox-user" inputmode="email" spellcheck="false" autocapitalize="off" autocomplete="off" placeholder="you@example.com">
|
|
549
548
|
<label for="mailbox-host">Mail server (IMAP, TLS)</label>
|
|
550
549
|
<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-
|
|
550
|
+
<label for="mailbox-smtp" class="mailbox-live">Sending server (SMTP)</label>
|
|
551
|
+
<input id="mailbox-smtp" class="mailbox-live" placeholder="smtp.example.com — empty: no sending" spellcheck="false" autocapitalize="off">
|
|
553
552
|
<label for="mailbox-password">Password</label>
|
|
554
553
|
<div class="row"><input id="mailbox-password" type="password" autocomplete="new-password">
|
|
555
|
-
<button type="submit" class="primary">
|
|
554
|
+
<button type="submit" class="primary">Connect</button></div>
|
|
556
555
|
<p id="mailbox-error" class="error" role="alert" hidden></p>
|
|
557
556
|
</form>
|
|
558
557
|
</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
|
+
|