@bobfrankston/mailx 1.0.219 → 1.0.221
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/client/.msger-window.json +1 -1
- package/client/app.js +18 -0
- package/client/components/folder-tree.js +3 -0
- package/client/compose/compose.css +90 -0
- package/client/compose/editor.js +203 -11
- package/client/styles/components.css +7 -7
- package/package.json +5 -5
- package/packages/mailx-service/index.js +23 -0
- package/packages/mailx-store/db.js +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"height":1344,"width":2151,"x":
|
|
1
|
+
{"height":1344,"width":2151,"x":1060,"y":329}
|
package/client/app.js
CHANGED
|
@@ -192,6 +192,24 @@ document.getElementById("folder-tree")?.addEventListener("click", (e) => {
|
|
|
192
192
|
document.querySelector(".folder-panel")?.classList.remove("open");
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
|
+
// Close folder overlay when user clicks outside it (narrow mode OR
|
|
196
|
+
// medium-width mode where the folder panel slides in as an overlay).
|
|
197
|
+
// Uses capture phase so it beats any child handler that might stopPropagation.
|
|
198
|
+
document.addEventListener("pointerdown", (e) => {
|
|
199
|
+
const panel = document.querySelector(".folder-panel");
|
|
200
|
+
if (!panel || !panel.classList.contains("open"))
|
|
201
|
+
return;
|
|
202
|
+
const target = e.target;
|
|
203
|
+
// Ignore clicks inside the panel itself and on the hamburger toggle
|
|
204
|
+
if (target.closest(".folder-panel") || target.closest("#btn-menu"))
|
|
205
|
+
return;
|
|
206
|
+
// Only auto-dismiss when we're in overlay mode (small or medium screens).
|
|
207
|
+
// On wide screens the panel is a permanent column and the "open" class
|
|
208
|
+
// is irrelevant.
|
|
209
|
+
if (window.innerWidth <= 1100 || window.innerHeight <= 600) {
|
|
210
|
+
panel.classList.remove("open");
|
|
211
|
+
}
|
|
212
|
+
}, true);
|
|
195
213
|
// ── Toolbar actions ──
|
|
196
214
|
document.getElementById("btn-sync")?.addEventListener("click", async () => {
|
|
197
215
|
const btn = document.getElementById("btn-sync");
|
|
@@ -157,6 +157,7 @@ function renderNode(node, container, depth) {
|
|
|
157
157
|
const badge = document.createElement("span");
|
|
158
158
|
badge.className = "ft-badge";
|
|
159
159
|
badge.textContent = String(node.unreadCount);
|
|
160
|
+
badge.title = `${node.unreadCount} unread`;
|
|
160
161
|
folderEl.appendChild(badge);
|
|
161
162
|
}
|
|
162
163
|
// Total count (shown when View > Folder counts is checked)
|
|
@@ -164,6 +165,7 @@ function renderNode(node, container, depth) {
|
|
|
164
165
|
const total = document.createElement("span");
|
|
165
166
|
total.className = "ft-total-count";
|
|
166
167
|
total.textContent = String(node.totalCount);
|
|
168
|
+
total.title = `${node.totalCount} total messages`;
|
|
167
169
|
folderEl.appendChild(total);
|
|
168
170
|
}
|
|
169
171
|
folderEl.addEventListener("click", () => {
|
|
@@ -587,6 +589,7 @@ async function loadFolderTree(container) {
|
|
|
587
589
|
if (accounts.length > 1) {
|
|
588
590
|
const unifiedEl = document.createElement("div");
|
|
589
591
|
unifiedEl.className = "ft-folder ft-unified";
|
|
592
|
+
unifiedEl.title = "Merged inbox view of all accounts — click to see messages from every account's INBOX sorted by date";
|
|
590
593
|
unifiedEl.innerHTML = `<span class="ft-toggle"> </span><span class="ft-folder-name">All Inboxes</span>`;
|
|
591
594
|
unifiedEl.addEventListener("click", () => {
|
|
592
595
|
if (selectedElement)
|
|
@@ -293,3 +293,93 @@ body {
|
|
|
293
293
|
max-width: 60ch;
|
|
294
294
|
}
|
|
295
295
|
.ql-editor, .tt-content .tiptap { position: relative; }
|
|
296
|
+
|
|
297
|
+
/* Link editor modal (Ctrl+K / toolbar link button) */
|
|
298
|
+
.mailx-modal-backdrop {
|
|
299
|
+
position: fixed;
|
|
300
|
+
inset: 0;
|
|
301
|
+
background: rgba(0, 0, 0, 0.35);
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
justify-content: center;
|
|
305
|
+
z-index: 2000;
|
|
306
|
+
}
|
|
307
|
+
.mailx-modal {
|
|
308
|
+
background: var(--color-bg);
|
|
309
|
+
color: var(--color-text);
|
|
310
|
+
padding: var(--gap-lg);
|
|
311
|
+
border-radius: var(--radius-md);
|
|
312
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
313
|
+
min-width: 420px;
|
|
314
|
+
max-width: 90vw;
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
gap: var(--gap-md);
|
|
318
|
+
font-family: var(--font-ui);
|
|
319
|
+
}
|
|
320
|
+
.mailx-modal-title {
|
|
321
|
+
font-size: var(--font-size-lg);
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
}
|
|
324
|
+
.mailx-modal-label {
|
|
325
|
+
display: flex;
|
|
326
|
+
flex-direction: column;
|
|
327
|
+
gap: 4px;
|
|
328
|
+
font-size: var(--font-size-sm);
|
|
329
|
+
color: var(--color-text-muted);
|
|
330
|
+
}
|
|
331
|
+
.mailx-modal-input {
|
|
332
|
+
padding: 6px 8px;
|
|
333
|
+
border: 1px solid var(--color-border);
|
|
334
|
+
border-radius: var(--radius-sm);
|
|
335
|
+
background: var(--color-bg-surface);
|
|
336
|
+
color: var(--color-text);
|
|
337
|
+
font-family: var(--font-ui);
|
|
338
|
+
font-size: var(--font-size-base);
|
|
339
|
+
}
|
|
340
|
+
.mailx-modal-input:focus {
|
|
341
|
+
outline: 2px solid var(--color-accent);
|
|
342
|
+
outline-offset: -1px;
|
|
343
|
+
}
|
|
344
|
+
.mailx-modal-buttons {
|
|
345
|
+
display: flex;
|
|
346
|
+
gap: var(--gap-sm);
|
|
347
|
+
align-items: center;
|
|
348
|
+
margin-top: var(--gap-xs);
|
|
349
|
+
}
|
|
350
|
+
.mailx-modal-spacer { flex: 1; }
|
|
351
|
+
.mailx-modal-btn {
|
|
352
|
+
padding: 6px 14px;
|
|
353
|
+
border: 1px solid var(--color-border);
|
|
354
|
+
border-radius: var(--radius-sm);
|
|
355
|
+
background: var(--color-bg-surface);
|
|
356
|
+
color: var(--color-text);
|
|
357
|
+
cursor: pointer;
|
|
358
|
+
font-size: var(--font-size-sm);
|
|
359
|
+
}
|
|
360
|
+
.mailx-modal-btn:hover { background: var(--color-bg-hover); }
|
|
361
|
+
.mailx-modal-btn-primary {
|
|
362
|
+
background: var(--color-accent);
|
|
363
|
+
color: #fff;
|
|
364
|
+
border-color: transparent;
|
|
365
|
+
font-weight: 500;
|
|
366
|
+
}
|
|
367
|
+
.mailx-modal-btn-primary:hover { filter: brightness(1.1); }
|
|
368
|
+
|
|
369
|
+
/* Link hover preview: small floating URL below the anchor */
|
|
370
|
+
.mailx-link-hover {
|
|
371
|
+
position: fixed;
|
|
372
|
+
padding: 4px 8px;
|
|
373
|
+
background: rgba(20, 20, 28, 0.92);
|
|
374
|
+
color: #e6e6f0;
|
|
375
|
+
font-size: 0.8rem;
|
|
376
|
+
font-family: var(--font-ui);
|
|
377
|
+
border-radius: var(--radius-sm);
|
|
378
|
+
max-width: 60ch;
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
text-overflow: ellipsis;
|
|
381
|
+
white-space: nowrap;
|
|
382
|
+
z-index: 2100;
|
|
383
|
+
pointer-events: none;
|
|
384
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
385
|
+
}
|
package/client/compose/editor.js
CHANGED
|
@@ -2,24 +2,147 @@
|
|
|
2
2
|
* Editor abstraction — wraps Quill or tiptap behind a common interface.
|
|
3
3
|
* The compose window loads this module and calls createEditor() based on the user's setting.
|
|
4
4
|
*/
|
|
5
|
+
/** URL-ish test: accepts http(s)://, mailto:, tel:, and bare domains with a dot. */
|
|
6
|
+
function looksLikeUrl(s) {
|
|
7
|
+
const t = s.trim();
|
|
8
|
+
if (!t)
|
|
9
|
+
return false;
|
|
10
|
+
if (/^(https?|mailto|tel):/i.test(t))
|
|
11
|
+
return true;
|
|
12
|
+
// bare domain (e.g. "example.com/path") — require a dot and no internal whitespace
|
|
13
|
+
return /^[\w-]+(\.[\w-]+)+(\/\S*)?$/.test(t);
|
|
14
|
+
}
|
|
15
|
+
function normalizeUrl(s) {
|
|
16
|
+
const t = s.trim();
|
|
17
|
+
if (!t)
|
|
18
|
+
return t;
|
|
19
|
+
if (/^(https?|mailto|tel):/i.test(t))
|
|
20
|
+
return t;
|
|
21
|
+
if (/^[\w.+-]+@[\w-]+(\.[\w-]+)+$/.test(t))
|
|
22
|
+
return `mailto:${t}`;
|
|
23
|
+
return `https://${t}`;
|
|
24
|
+
}
|
|
25
|
+
/** Floating modal that edits both link text and URL. Returns null on Cancel,
|
|
26
|
+
* { text, url } on OK, or { text: "", url: "" } on "Remove link". */
|
|
27
|
+
function openLinkDialog(initialText, initialUrl) {
|
|
28
|
+
return new Promise(resolve => {
|
|
29
|
+
const backdrop = document.createElement("div");
|
|
30
|
+
backdrop.className = "mailx-modal-backdrop";
|
|
31
|
+
const panel = document.createElement("div");
|
|
32
|
+
panel.className = "mailx-modal";
|
|
33
|
+
panel.innerHTML = `
|
|
34
|
+
<div class="mailx-modal-title">Edit link</div>
|
|
35
|
+
<label class="mailx-modal-label">Text
|
|
36
|
+
<input type="text" class="mailx-modal-input" id="mailx-link-text">
|
|
37
|
+
</label>
|
|
38
|
+
<label class="mailx-modal-label">URL
|
|
39
|
+
<input type="text" class="mailx-modal-input" id="mailx-link-url" spellcheck="false" autocomplete="off">
|
|
40
|
+
</label>
|
|
41
|
+
<div class="mailx-modal-buttons">
|
|
42
|
+
<button type="button" class="mailx-modal-btn" data-action="remove">Remove link</button>
|
|
43
|
+
<span class="mailx-modal-spacer"></span>
|
|
44
|
+
<button type="button" class="mailx-modal-btn" data-action="cancel">Cancel</button>
|
|
45
|
+
<button type="button" class="mailx-modal-btn mailx-modal-btn-primary" data-action="ok">OK</button>
|
|
46
|
+
</div>`;
|
|
47
|
+
backdrop.appendChild(panel);
|
|
48
|
+
document.body.appendChild(backdrop);
|
|
49
|
+
const textInput = panel.querySelector("#mailx-link-text");
|
|
50
|
+
const urlInput = panel.querySelector("#mailx-link-url");
|
|
51
|
+
textInput.value = initialText;
|
|
52
|
+
urlInput.value = initialUrl;
|
|
53
|
+
const close = (result) => {
|
|
54
|
+
backdrop.remove();
|
|
55
|
+
document.removeEventListener("keydown", onKey, true);
|
|
56
|
+
resolve(result);
|
|
57
|
+
};
|
|
58
|
+
const commit = () => close({ text: textInput.value, url: normalizeUrl(urlInput.value) });
|
|
59
|
+
const onKey = (e) => {
|
|
60
|
+
if (e.key === "Escape") {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
close(null);
|
|
64
|
+
}
|
|
65
|
+
else if (e.key === "Enter") {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
commit();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
document.addEventListener("keydown", onKey, true);
|
|
72
|
+
panel.querySelectorAll(".mailx-modal-btn").forEach(btn => {
|
|
73
|
+
btn.addEventListener("click", () => {
|
|
74
|
+
const action = btn.dataset.action;
|
|
75
|
+
if (action === "cancel")
|
|
76
|
+
close(null);
|
|
77
|
+
else if (action === "remove")
|
|
78
|
+
close({ text: textInput.value, url: "", remove: true });
|
|
79
|
+
else
|
|
80
|
+
commit();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
backdrop.addEventListener("mousedown", (e) => { if (e.target === backdrop)
|
|
84
|
+
close(null); });
|
|
85
|
+
// Focus URL if we have text, else text first
|
|
86
|
+
(initialText ? urlInput : textInput).focus();
|
|
87
|
+
(initialText ? urlInput : textInput).select();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
5
90
|
function createQuillEditor(container) {
|
|
91
|
+
/** Open the link dialog for the current selection or cursor. If range has
|
|
92
|
+
* a selection, prefill text from the selected text; if cursor is inside
|
|
93
|
+
* a link, prefill both from the link's range. */
|
|
94
|
+
const openLinkForRange = async (quill, range) => {
|
|
95
|
+
if (!range)
|
|
96
|
+
return;
|
|
97
|
+
// Expand a bare cursor inside a link to the full link range
|
|
98
|
+
let linkRange = range;
|
|
99
|
+
const format = quill.getFormat(range);
|
|
100
|
+
if (range.length === 0 && format.link) {
|
|
101
|
+
// Walk left and right to find the link extent
|
|
102
|
+
const [leaf, offset] = quill.getLeaf(range.index);
|
|
103
|
+
if (leaf) {
|
|
104
|
+
// Build a range that spans the whole link
|
|
105
|
+
const text = quill.getText();
|
|
106
|
+
let start = range.index, end = range.index;
|
|
107
|
+
while (start > 0 && quill.getFormat(start - 1, 1).link === format.link)
|
|
108
|
+
start--;
|
|
109
|
+
while (end < text.length - 1 && quill.getFormat(end, 1).link === format.link)
|
|
110
|
+
end++;
|
|
111
|
+
linkRange = { index: start, length: end - start };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const currentText = linkRange.length ? quill.getText(linkRange.index, linkRange.length).replace(/\n$/, "") : "";
|
|
115
|
+
const currentUrl = format.link || "";
|
|
116
|
+
const result = await openLinkDialog(currentText, currentUrl);
|
|
117
|
+
if (!result)
|
|
118
|
+
return;
|
|
119
|
+
if (result.remove) {
|
|
120
|
+
if (linkRange.length)
|
|
121
|
+
quill.formatText(linkRange.index, linkRange.length, "link", false);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (!result.url)
|
|
125
|
+
return;
|
|
126
|
+
const newText = result.text || result.url;
|
|
127
|
+
if (linkRange.length) {
|
|
128
|
+
// Replace the existing text+link with new text+link
|
|
129
|
+
quill.deleteText(linkRange.index, linkRange.length);
|
|
130
|
+
quill.insertText(linkRange.index, newText, { link: result.url });
|
|
131
|
+
quill.setSelection(linkRange.index + newText.length, 0);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
quill.insertText(linkRange.index, newText, { link: result.url });
|
|
135
|
+
quill.setSelection(linkRange.index + newText.length, 0);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
6
138
|
// Extra keybindings for formatting that Quill doesn't wire up by default.
|
|
7
|
-
// Ctrl+K (insert link) is the one most users expect; we also add shortcuts
|
|
139
|
+
// Ctrl+K (insert/edit link) is the one most users expect; we also add shortcuts
|
|
8
140
|
// for strikethrough, lists, indent, color, and clear-formatting.
|
|
9
141
|
const extraBindings = {
|
|
10
142
|
insertLink: {
|
|
11
143
|
key: "K", shortKey: true,
|
|
12
144
|
handler: function (range) {
|
|
13
|
-
|
|
14
|
-
return true;
|
|
15
|
-
const current = this.quill.getFormat(range).link || "";
|
|
16
|
-
const url = prompt("URL (leave blank to remove link):", current);
|
|
17
|
-
if (url === null)
|
|
18
|
-
return;
|
|
19
|
-
if (url === "")
|
|
20
|
-
this.quill.format("link", false);
|
|
21
|
-
else
|
|
22
|
-
this.quill.format("link", url);
|
|
145
|
+
openLinkForRange(this.quill, range);
|
|
23
146
|
},
|
|
24
147
|
},
|
|
25
148
|
removeLink: {
|
|
@@ -95,6 +218,75 @@ function createQuillEditor(container) {
|
|
|
95
218
|
});
|
|
96
219
|
// Make toolbar buttons non-tabbable so Tab goes straight to editor body
|
|
97
220
|
document.querySelectorAll(".ql-toolbar button, .ql-toolbar select, .ql-toolbar .ql-picker-label").forEach(el => el.setAttribute("tabindex", "-1"));
|
|
221
|
+
// Native spell-check: WebView2 / Chromium underlines misspellings and the
|
|
222
|
+
// right-click menu offers "Add to dictionary". Quill clears spellcheck on
|
|
223
|
+
// its root by default, so we turn it back on explicitly.
|
|
224
|
+
q.root.setAttribute("spellcheck", "true");
|
|
225
|
+
q.root.setAttribute("autocorrect", "on");
|
|
226
|
+
q.root.setAttribute("autocapitalize", "on");
|
|
227
|
+
// Toolbar link button: open our modal instead of Quill's built-in URL prompt.
|
|
228
|
+
const toolbar = q.getModule("toolbar");
|
|
229
|
+
toolbar?.addHandler("link", function () {
|
|
230
|
+
openLinkForRange(q, q.getSelection() || { index: q.getLength() - 1, length: 0 });
|
|
231
|
+
});
|
|
232
|
+
// Paste handling:
|
|
233
|
+
// - If clipboard has text/html, let Quill convert it (preserves anchors).
|
|
234
|
+
// - If only text/plain and it's a URL, insert as a link (honoring any text
|
|
235
|
+
// currently selected — the URL becomes the href of that text).
|
|
236
|
+
// - Shift+Ctrl+V (handled via contextmenu "Paste as text") or any other
|
|
237
|
+
// plain text is inserted verbatim.
|
|
238
|
+
q.root.addEventListener("paste", (e) => {
|
|
239
|
+
const cb = e.clipboardData;
|
|
240
|
+
if (!cb)
|
|
241
|
+
return;
|
|
242
|
+
const html = cb.getData("text/html");
|
|
243
|
+
const plain = cb.getData("text/plain");
|
|
244
|
+
if (html)
|
|
245
|
+
return; // Quill handles HTML clipboard natively
|
|
246
|
+
if (plain && looksLikeUrl(plain)) {
|
|
247
|
+
e.preventDefault();
|
|
248
|
+
const range = q.getSelection(true);
|
|
249
|
+
if (!range)
|
|
250
|
+
return;
|
|
251
|
+
const url = normalizeUrl(plain);
|
|
252
|
+
if (range.length > 0) {
|
|
253
|
+
// Preserve existing selection text, just format it as a link
|
|
254
|
+
q.formatText(range.index, range.length, "link", url);
|
|
255
|
+
q.setSelection(range.index + range.length, 0);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
q.insertText(range.index, plain.trim(), { link: url });
|
|
259
|
+
q.setSelection(range.index + plain.trim().length, 0);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
// Hover preview: show the target URL in a floating tooltip when the
|
|
264
|
+
// pointer is over a link. Built on top of native mouseover/mouseout
|
|
265
|
+
// rather than Quill's ql-tooltip (which is keyboard-triggered).
|
|
266
|
+
let hoverTip = null;
|
|
267
|
+
q.root.addEventListener("mouseover", (e) => {
|
|
268
|
+
const a = e.target.closest("a[href]");
|
|
269
|
+
if (!a)
|
|
270
|
+
return;
|
|
271
|
+
if (hoverTip)
|
|
272
|
+
hoverTip.remove();
|
|
273
|
+
hoverTip = document.createElement("div");
|
|
274
|
+
hoverTip.className = "mailx-link-hover";
|
|
275
|
+
hoverTip.textContent = a.getAttribute("href") || "";
|
|
276
|
+
document.body.appendChild(hoverTip);
|
|
277
|
+
const rect = a.getBoundingClientRect();
|
|
278
|
+
hoverTip.style.left = `${Math.max(8, rect.left)}px`;
|
|
279
|
+
hoverTip.style.top = `${rect.bottom + 4}px`;
|
|
280
|
+
});
|
|
281
|
+
q.root.addEventListener("mouseout", (e) => {
|
|
282
|
+
const to = e.relatedTarget;
|
|
283
|
+
if (to && to.closest("a[href]"))
|
|
284
|
+
return;
|
|
285
|
+
if (hoverTip) {
|
|
286
|
+
hoverTip.remove();
|
|
287
|
+
hoverTip = null;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
98
290
|
return {
|
|
99
291
|
setHtml(html) {
|
|
100
292
|
q.clipboard.dangerouslyPasteHTML(html);
|
|
@@ -166,11 +166,9 @@ button.tb-menu-item { background: none; border: none; color: inherit; width: 100
|
|
|
166
166
|
align-items: center;
|
|
167
167
|
gap: var(--gap-xs);
|
|
168
168
|
padding: var(--gap-xs) var(--gap-sm);
|
|
169
|
-
font-weight:
|
|
169
|
+
font-weight: 600;
|
|
170
170
|
font-size: var(--font-size-base);
|
|
171
171
|
color: var(--color-brand-dark);
|
|
172
|
-
text-transform: uppercase;
|
|
173
|
-
letter-spacing: 0.05em;
|
|
174
172
|
cursor: pointer;
|
|
175
173
|
user-select: none;
|
|
176
174
|
}
|
|
@@ -197,12 +195,12 @@ button.tb-menu-item { background: none; border: none; color: inherit; width: 100
|
|
|
197
195
|
padding: var(--gap-xs) var(--gap-sm) var(--gap-xs) var(--gap-lg);
|
|
198
196
|
cursor: pointer;
|
|
199
197
|
font-size: var(--font-size-base);
|
|
200
|
-
font-weight:
|
|
198
|
+
font-weight: 500;
|
|
201
199
|
color: var(--color-brand-dark);
|
|
202
200
|
border-radius: 0;
|
|
203
201
|
|
|
204
202
|
&:hover { background: var(--color-bg-hover); }
|
|
205
|
-
&.selected { background: var(--color-bg-selected); color: var(--color-accent); }
|
|
203
|
+
&.selected { background: var(--color-bg-selected); color: var(--color-accent); font-weight: 600; }
|
|
206
204
|
}
|
|
207
205
|
|
|
208
206
|
.ft-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -353,11 +351,13 @@ button.tb-menu-item { background: none; border: none; color: inherit; width: 100
|
|
|
353
351
|
border-bottom: 1px solid color-mix(in oklch, var(--color-border) 50%, transparent);
|
|
354
352
|
cursor: pointer;
|
|
355
353
|
font-size: var(--font-size-base);
|
|
354
|
+
font-weight: 400;
|
|
356
355
|
color: var(--color-text);
|
|
357
356
|
align-items: baseline;
|
|
357
|
+
line-height: 1.35;
|
|
358
358
|
|
|
359
359
|
&:hover { background: var(--color-bg-hover); }
|
|
360
|
-
&.selected { background: var(--color-brand); color: var(--color-brand-dark); font-weight:
|
|
360
|
+
&.selected { background: var(--color-brand); color: var(--color-brand-dark); font-weight: 500; }
|
|
361
361
|
&.unread {
|
|
362
362
|
font-weight: 600;
|
|
363
363
|
color: var(--color-unread);
|
|
@@ -411,7 +411,7 @@ button.tb-menu-item { background: none; border: none; color: inherit; width: 100
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
.no-snippets .ml-preview { display: none; }
|
|
414
|
-
.ml-date { white-space: nowrap; text-align: right; color: var(--color-text-muted); font-
|
|
414
|
+
.ml-date { white-space: nowrap; text-align: right; color: var(--color-text-muted); font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; }
|
|
415
415
|
/* Not-downloaded indicator: small dot before the date */
|
|
416
416
|
.ml-row.not-downloaded .ml-date::before {
|
|
417
417
|
content: "○ ";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.221",
|
|
4
4
|
"description": "Local-first email client with IMAP sync and standalone native app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/mailx.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"postinstall": "node bin/postinstall.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
23
|
+
"@bobfrankston/iflow-direct": "^0.1.9",
|
|
24
24
|
"@bobfrankston/iflow-node": "^0.1.2",
|
|
25
25
|
"@bobfrankston/miscinfo": "^1.0.8",
|
|
26
26
|
"@bobfrankston/oauthsupport": "^1.0.22",
|
|
27
|
-
"@bobfrankston/msger": "^0.1.
|
|
27
|
+
"@bobfrankston/msger": "^0.1.283",
|
|
28
28
|
"@capacitor/android": "^8.3.0",
|
|
29
29
|
"@capacitor/cli": "^8.3.0",
|
|
30
30
|
"@capacitor/core": "^8.3.0",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
},
|
|
75
75
|
".transformedSnapshot": {
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
77
|
+
"@bobfrankston/iflow-direct": "^0.1.9",
|
|
78
78
|
"@bobfrankston/iflow-node": "^0.1.2",
|
|
79
79
|
"@bobfrankston/miscinfo": "^1.0.8",
|
|
80
80
|
"@bobfrankston/oauthsupport": "^1.0.22",
|
|
81
|
-
"@bobfrankston/msger": "^0.1.
|
|
81
|
+
"@bobfrankston/msger": "^0.1.283",
|
|
82
82
|
"@capacitor/android": "^8.3.0",
|
|
83
83
|
"@capacitor/cli": "^8.3.0",
|
|
84
84
|
"@capacitor/core": "^8.3.0",
|
|
@@ -341,11 +341,34 @@ export class MailxService {
|
|
|
341
341
|
const account = settings.accounts.find(a => a.id === msg.from);
|
|
342
342
|
if (!account)
|
|
343
343
|
throw new Error(`Unknown account: ${msg.from}`);
|
|
344
|
+
// Vet every recipient address — refuse to send if any field contains a
|
|
345
|
+
// non-email (e.g. "Bob Frankston <Bob Frankston>" from a bad contact
|
|
346
|
+
// autocomplete). This catches garbage BEFORE it hits SMTP, where the
|
|
347
|
+
// server would either accept-and-bounce or reject the whole envelope.
|
|
348
|
+
const emailRe = /^[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+$/;
|
|
349
|
+
const validateList = (label, list) => {
|
|
350
|
+
if (!list)
|
|
351
|
+
return;
|
|
352
|
+
for (const a of list) {
|
|
353
|
+
const addr = (a?.address || "").trim();
|
|
354
|
+
if (!addr)
|
|
355
|
+
throw new Error(`${label} has an empty address`);
|
|
356
|
+
if (!emailRe.test(addr))
|
|
357
|
+
throw new Error(`${label} has an invalid address: "${addr}"${a?.name ? ` (displayed as "${a.name}")` : ""}`);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
validateList("To", msg.to);
|
|
361
|
+
validateList("Cc", msg.cc);
|
|
362
|
+
validateList("Bcc", msg.bcc);
|
|
363
|
+
if (!msg.to?.length)
|
|
364
|
+
throw new Error("No To recipients");
|
|
344
365
|
// Extract bare email from fromAddress (may be "Name <addr>" or just "addr")
|
|
345
366
|
let fromAddr = msg.fromAddress || account.email;
|
|
346
367
|
const angleMatch = fromAddr.match(/<([^>]+)>/);
|
|
347
368
|
if (angleMatch)
|
|
348
369
|
fromAddr = angleMatch[1];
|
|
370
|
+
if (!emailRe.test(fromAddr))
|
|
371
|
+
throw new Error(`From address is not a valid email: "${fromAddr}"`);
|
|
349
372
|
const fromHeader = `${account.name} <${fromAddr}>`;
|
|
350
373
|
const to = msg.to.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
|
|
351
374
|
const cc = msg.cc?.map((a) => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
|
|
@@ -369,6 +369,11 @@ export class MailxDB {
|
|
|
369
369
|
// ── Contacts ──
|
|
370
370
|
/** Record an address used in sent mail */
|
|
371
371
|
recordSentAddress(name, email) {
|
|
372
|
+
// Don't pollute the contacts table with non-addresses. Anything without
|
|
373
|
+
// an @ or without a TLD-ish tail would show up in autocomplete and end
|
|
374
|
+
// up back in To/Cc headers as "Name <not an email>".
|
|
375
|
+
if (!email || !/^[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+$/.test(email))
|
|
376
|
+
return;
|
|
372
377
|
const now = Date.now();
|
|
373
378
|
const existing = this.db.prepare("SELECT id FROM contacts WHERE email = ?").get(email);
|
|
374
379
|
if (existing) {
|
|
@@ -387,6 +392,9 @@ export class MailxDB {
|
|
|
387
392
|
GROUP BY from_address`).all();
|
|
388
393
|
let added = 0;
|
|
389
394
|
for (const r of rows) {
|
|
395
|
+
// Skip invalid addresses so contact autocomplete never proposes non-emails
|
|
396
|
+
if (!r.from_address || !/^[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+$/.test(r.from_address))
|
|
397
|
+
continue;
|
|
390
398
|
const existing = this.db.prepare("SELECT id FROM contacts WHERE email = ?").get(r.from_address);
|
|
391
399
|
if (!existing) {
|
|
392
400
|
this.db.prepare("INSERT INTO contacts (source, name, email, last_used, use_count, updated_at) VALUES ('received', ?, ?, ?, ?, ?)").run(r.from_name || "", r.from_address, r.last, r.cnt, now);
|