@bobfrankston/mailx 1.0.96 → 1.0.97
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/package.json
CHANGED
|
@@ -214,11 +214,19 @@ imapManager.on("accountError", (accountId, error, hint, isOAuth) => {
|
|
|
214
214
|
// ── Startup ──
|
|
215
215
|
async function start() {
|
|
216
216
|
console.log("mailx server starting...");
|
|
217
|
+
// Start HTTP server FIRST so UI is always reachable (even during IMAP startup)
|
|
218
|
+
const externalAccess = process.argv.includes("--external");
|
|
219
|
+
const hostname = externalAccess ? "0.0.0.0" : "127.0.0.1";
|
|
220
|
+
server = createServer(app);
|
|
221
|
+
wss = new WebSocketServer({ server });
|
|
222
|
+
wireWebSocket();
|
|
223
|
+
await new Promise((resolve) => server.listen(PORT, hostname, resolve));
|
|
224
|
+
console.log(`mailx server running on http://${hostname}:${PORT}`);
|
|
217
225
|
// Seed contacts (fast — skips existing)
|
|
218
226
|
const seeded = db.seedContactsFromMessages();
|
|
219
227
|
if (seeded > 0)
|
|
220
228
|
console.log(` Seeded ${seeded} contacts`);
|
|
221
|
-
// Search index — rebuild in background
|
|
229
|
+
// Search index — rebuild in background (non-blocking)
|
|
222
230
|
setTimeout(() => {
|
|
223
231
|
let ftsCount = 0;
|
|
224
232
|
try {
|
|
@@ -260,14 +268,6 @@ async function start() {
|
|
|
260
268
|
imapManager.startPeriodicSync(settings.sync.intervalMinutes);
|
|
261
269
|
// Outbox worker — processes queued outgoing messages
|
|
262
270
|
imapManager.startOutboxWorker();
|
|
263
|
-
// Start server — localhost only by default, --external for network access
|
|
264
|
-
const externalAccess = process.argv.includes("--external");
|
|
265
|
-
const hostname = externalAccess ? "0.0.0.0" : "127.0.0.1";
|
|
266
|
-
server = createServer(app);
|
|
267
|
-
wss = new WebSocketServer({ server });
|
|
268
|
-
wireWebSocket();
|
|
269
|
-
await new Promise((resolve) => server.listen(PORT, hostname, resolve));
|
|
270
|
-
console.log(`mailx server running on http://${hostname}:${PORT}`);
|
|
271
271
|
}
|
|
272
272
|
// ── Graceful Shutdown ──
|
|
273
273
|
async function shutdown() {
|