diff --git a/mail.js b/mail.js
index c8abc60..f3b5f51 100644
--- a/mail.js
+++ b/mail.js
@@ -329,4 +329,10 @@ async function handle(req, res) {
} catch (e) { json(res, e.status || 400, { error: e.message }); }
}
-module.exports = { enabled, outlookOn, handle, callback, secretStatus, recipients, textToHtml };
+/** The newest messages in each connected account's Inbox (for the push alerts). One account that fails does not stop the others. */
+async function newest() {
+ const out = [];
+ for (const a of accounts()) { try { const r = await withTimeout(providerOf(a).list(a, { folder: 'inbox', skip: 0, q: '' }), 15000); for (const m of r.items.slice(0, 10)) out.push({ id: a.id + ':' + m.id, subject: m.subject, from: (m.from && (m.from.name || m.from.address)) || '', read: !!m.read }); } catch { /* skipped this round */ } }
+ return out;
+}
+module.exports = { newest, enabled, outlookOn, handle, callback, secretStatus, recipients, textToHtml };
diff --git a/public/index.html b/public/index.html
index b2e8c1d..8bbbd6f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -80,6 +80,7 @@
+