@bobfrankston/mailx 1.0.4 → 1.0.6

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/README.md CHANGED
@@ -140,16 +140,67 @@ If `config.json` doesn't exist, settings default to `~/.mailx/settings.jsonc`.
140
140
  | Escape | Discard / Clear search |
141
141
  | F5 | Sync |
142
142
 
143
+ ## Installation
144
+
145
+ ```bash
146
+ npm install -g @bobfrankston/mailx
147
+ mailx # Starts server + opens browser
148
+ ```
149
+
150
+ Or for development:
151
+ ```bash
152
+ git clone https://github.com/BobFrankston/mailx.git
153
+ cd mailx
154
+ npm install
155
+ npm start # Starts server with --watch (auto-restart on changes)
156
+ ```
157
+
158
+ The native WebView2 app (optional):
159
+ ```bash
160
+ launch.ps1 # Builds and runs the Rust launcher
161
+ launch.ps1 -restart # Kill existing server first
162
+ ```
163
+
143
164
  ## Data Storage
144
165
 
145
- | File | Location | Purpose |
146
- |------|----------|---------|
147
- | config.json | ~/.mailx/ | Points to settings file |
148
- | settings.jsonc | OneDrive or ~/.mailx/ | Accounts, prefs (shared across machines) |
149
- | mailx.db | ~/.mailx/ | SQLite headers, contacts, sync state |
150
- | mailxstore/ | ~/.mailx/ | Cached message bodies (.eml) |
151
- | window.json | ~/.mailx/ | Window position (per machine) |
152
- | mailx.log | project dir | Server log with timestamps |
166
+ All data lives in `~/.mailx/` (e.g., `C:\Users\You\.mailx\`):
167
+
168
+ | File | Shared? | Purpose |
169
+ |------|---------|---------|
170
+ | config.json | No | Points to shared settings dir + local overrides |
171
+ | accounts.jsonc | Yes | IMAP/SMTP account configs |
172
+ | preferences.jsonc | Yes | UI, sync, font settings |
173
+ | allowlist.jsonc | Yes | Remote content sender/domain allow-list |
174
+ | settings.jsonc | Yes | Legacy combined settings (still supported) |
175
+ | mailx.db | No | SQLite — headers, contacts, sync state |
176
+ | mailxstore/ | No | Cached message bodies (.eml per message) |
177
+ | window.json | No | Window position (per machine) |
178
+ | mailx-YYYY-MM-DD.log | No | Server log (auto-deleted after 7 days) |
179
+
180
+ **Shared** files can live on OneDrive/Dropbox — `config.json` points to the shared directory. **Local** files stay on the machine.
181
+
182
+ ### Safe to Delete
183
+
184
+ - **mailxstore/** — cached bodies, re-downloaded automatically during sync or on demand. Delete to reclaim space or reset the cache.
185
+ - **mailx.db** — re-created on next startup, triggers full re-sync of all messages within the history window.
186
+ - **mailx-*.log** — auto-cleaned after 7 days. Safe to delete anytime.
187
+ - **window.json** — resets window position to default 1280×800.
188
+
189
+ ### config.json
190
+
191
+ ```json
192
+ {
193
+ "sharedDir": "C:/Users/You/OneDrive/home/.mailx",
194
+ "storePath": "C:/Users/You/.mailx/mailxstore",
195
+ "historyDays": 90
196
+ }
197
+ ```
198
+
199
+ - **sharedDir** — directory containing shared settings files (accounts, preferences, allowlist)
200
+ - **storePath** — where cached .eml files are stored
201
+ - **historyDays** — per-machine override for sync history (shared default is 30)
202
+
203
+ If `config.json` doesn't exist, all settings default to `~/.mailx/`.
153
204
 
154
205
  ## Architecture
155
206
 
@@ -159,3 +210,4 @@ If `config.json` doesn't exist, settings default to `~/.mailx/settings.jsonc`.
159
210
  - **Outbox** — queued in IMAP Outbox folder with multi-machine interlock via flags
160
211
  - **Remote content blocking** — HTML sanitized server-side, CSP in iframe, per-sender/domain allow-list
161
212
  - **Search** — SQLite FTS5 full-text index with qualifiers
213
+ - **Unified mode** — `mailx` command runs server in-process (no separate server). Use `--server` for standalone server mode.
package/bin/mailx.js CHANGED
@@ -9,12 +9,9 @@
9
9
  * mailx --external Bind to all interfaces (default: localhost only)
10
10
  */
11
11
 
12
- import { fileURLToPath } from "node:url";
13
- import path from "node:path";
14
12
  import net from "node:net";
15
13
 
16
14
  const PORT = 9333;
17
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
15
  const args = process.argv.slice(2);
19
16
 
20
17
  function isPortInUse(port) {
@@ -48,17 +45,14 @@ async function main() {
48
45
  return;
49
46
  }
50
47
 
51
- // Start server in-process (unified mode)
52
48
  console.log(`Starting mailx on port ${PORT}...`);
53
49
 
54
- // Pass --external to server if requested
55
50
  if (args.includes("--external")) process.argv.push("--external");
56
51
 
57
- // Import and start the server directly — no subprocess
58
- await import(path.join(__dirname, "..", "packages", "mailx-server", "index.js"));
52
+ // Import server directly — relative path, in-process
53
+ await import("../packages/mailx-server/index.js");
59
54
 
60
55
  if (!noBrowser) {
61
- // Wait a moment for server to be ready
62
56
  for (let i = 0; i < 30; i++) {
63
57
  await new Promise(r => setTimeout(r, 200));
64
58
  if (await isPortInUse(PORT)) break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",