Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43be32b162 |
@@ -4,7 +4,7 @@ An Eternity Project mail client with **Eternity Daylight**, **Wasteland**, and E
|
|||||||
|
|
||||||
## Desktop app
|
## Desktop app
|
||||||
|
|
||||||
The Electron app runs in its own window. With Node.js installed, run `npm install` and then `npm start`. Open **Mail account settings** to connect an IMAP/SMTP account. Each account can have its own outgoing signature, new-mail notification toggle, periodic sync interval (2–60 minutes; IDLE remains event-driven), and mail rules. Rules match incoming Inbox messages by sender and/or subject; the first matching rule archives, moves to Inbox/Archive/Trash, applies a label, or flags the message. Sender/domain and extracted message-link checks highlight selected phishing warning signs. Message links are shown separately from the body and require explicit confirmation before opening in a browser; the app never renders remote message HTML. Settings, cached recent messages, offline drafts, and queued mail operations are stored with the encrypted account credentials. Search supports text, sender, subject, date range, attachment, and folder filters; a filtered online search scans up to the newest 5,000 messages in the selected folder. When offline, the app can read cached messages, save drafts, and queue supported message actions and sends for retry on the next successful sync. The app uses required STARTTLS for IMAP port 143 and SMTP port 587. Before preparing a new release, bump the version once with `npm run bump:build`; then build all platform targets for that same version. To package it on Windows, run `npm run dist:win`; the installer and portable `.exe` are written to `release/`. To package on Linux, run `npm install` and `npm run dist:linux` on a Linux machine; this produces AppImage and Debian packages in `release/`.
|
The Electron app runs in its own window. With Node.js installed, run `npm install` and then `npm start`. Open **Mail account settings** to connect an IMAP/SMTP account. Each account can have its own outgoing signature, new-mail notification toggle, periodic sync interval (2–60 minutes; IDLE remains event-driven), and mail rules. Rules match incoming Inbox messages by sender and/or subject; the first matching rule archives, moves to Inbox/Archive/Trash, applies a label, or flags the message. Sender/domain and extracted message-link checks highlight selected phishing warning signs. Message links are shown separately from the body and require explicit confirmation before opening in a browser; the app never renders remote message HTML. Settings, cached recent messages, offline drafts, and queued mail operations are stored with the encrypted account credentials. Search supports text, sender, subject, date range, attachment, and folder filters; a filtered online search scans up to the newest 5,000 messages in the selected folder. When offline, the app can read cached messages, save drafts, and queue supported message actions and sends for retry on the next successful sync. The app uses required STARTTLS for IMAP port 143 and SMTP port 587. Before preparing a new release, bump the version once with `npm run bump:build`; then build all platform targets for that same version. To package it on Windows, run `npm run dist:win`; the installer and portable `.exe` are written to `release/`. To package on Linux, run `npm install` and `npm run dist:linux` on a Linux machine; this produces AppImage and Debian packages in `release/`.
|
||||||
|
|
||||||
The `.github/workflows/desktop-build.yml` workflow builds both Windows and Linux artifacts on their native GitHub-hosted runners when manually started from the Actions tab. Snoozed messages return to their original mailbox with a reminder; desktop reminders are checked while the app is running, and Android uses its periodic background worker.
|
The `.github/workflows/desktop-build.yml` workflow builds both Windows and Linux artifacts on their native GitHub-hosted runners when manually started from the Actions tab. Snoozed messages return to their original mailbox with a reminder; desktop reminders are checked while the app is running, and Android uses its periodic background worker.
|
||||||
|
|
||||||
@@ -31,4 +31,4 @@ On Windows, `py -m http.server 8000` is also available on many Python installati
|
|||||||
|
|
||||||
## Current scope
|
## Current scope
|
||||||
|
|
||||||
Mail supports multiple IMAP/SMTP accounts, switching between them, and saving message attachments. CalDAV and CardDAV servers can be added from the Calendar and Contacts views; credentials are kept in the OS-encrypted credential store, and events and contacts can sync and be edited on the server. Local contacts and events remain available without a DAV connection. Your display name is saved locally and appears in the greeting.
|
Mail supports multiple IMAP/SMTP accounts, switching between them, and saving message attachments. CalDAV and CardDAV servers can be added from the Calendar and Contacts views; credentials are kept in the OS-encrypted credential store, and events and contacts can sync and be edited on the server. Local contacts and events remain available without a DAV connection. Your display name is saved locally and appears in the greeting. Use the **+** beside **Folders** in the sidebar to create IMAP folders on the server; your custom folders appear in the sidebar and can be opened like any other folder.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- [x] Rename the program to **ep-mail** across the app UI, package metadata, desktop builds, and documentation.
|
- [x] Rename the program to **ep-mail** across the app UI, package metadata, desktop builds, and documentation.
|
||||||
- [x] Replace the temporary sun/asterisk app mark with the Git and webmail logo, using the EP Daylight and EP Wasteland color variants.
|
- [x] Replace the temporary sun/asterisk app mark with the Git and webmail logo, using the EP Daylight and EP Wasteland color variants.
|
||||||
- [ ] Add Android support for the mail app.
|
- [x] Add Android support for the mail app.
|
||||||
- [ ] Add macOS support: configure macOS release targets and build the app on a Mac or hosted macOS runner; sign and notarize releases for distribution.
|
- [ ] Add macOS support: configure macOS release targets and build the app on a Mac or hosted macOS runner; sign and notarize releases for distribution.
|
||||||
- [x] Show the app version after **ep-mail** in the window title.
|
- [x] Show the app version after **ep-mail** in the window title.
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
- [x] Warn about suspicious sender addresses and links; require confirmation before opening external links.
|
- [x] Warn about suspicious sender addresses and links; require confirmation before opening external links.
|
||||||
- [x] Add per-account rules to sort, archive, label, or flag new incoming messages by sender and/or subject.
|
- [x] Add per-account rules to sort, archive, label, or flag new incoming messages by sender and/or subject.
|
||||||
- [x] Add per-account signatures, notification preferences, and sync settings.
|
- [x] Add per-account signatures, notification preferences, and sync settings.
|
||||||
- [ ] Add the ability to create IMAP folders from the app.
|
- [x] Add the ability to create IMAP folders from the app.
|
||||||
- [ ] Block remote images by default and let users load them per message.
|
- [ ] Block remote images by default and let users load them per message.
|
||||||
|
|
||||||
## Mail security
|
## Mail security
|
||||||
|
|||||||
@@ -639,7 +639,57 @@ internal object AndroidMailService {
|
|||||||
return JSONObject().put("saved", true).put("path", file.absolutePath).put("filename", filename)
|
return JSONObject().put("saved", true).put("path", file.absolutePath).put("filename", filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val CUSTOM_FOLDER_PREFIX = "Folder:"
|
||||||
|
private val reservedFolderNames = setOf(
|
||||||
|
"inbox", "sent", "drafts", "archive", "trash", "starred", "snoozed", "junk", "spam",
|
||||||
|
"sent items", "sent mail", "sent messages", "archives", "all mail", "deleted items", "deleted messages"
|
||||||
|
)
|
||||||
|
|
||||||
|
fun isCustomFolder(name: String) = name.startsWith(CUSTOM_FOLDER_PREFIX)
|
||||||
|
|
||||||
|
private fun customFolders(store: Store): JSONArray {
|
||||||
|
val systemAttributes = setOf("\\sent", "\\archive", "\\trash", "\\drafts", "\\junk", "\\all", "\\flagged")
|
||||||
|
val result = JSONArray()
|
||||||
|
val folders = try { store.defaultFolder.list("*") } catch (_: Exception) { emptyArray() }
|
||||||
|
folders.filter { folder ->
|
||||||
|
val attributes = (folder as? IMAPFolder)?.attributes?.map { it.lowercase(Locale.ROOT) } ?: emptyList()
|
||||||
|
folder.fullName.uppercase(Locale.ROOT) != "INBOX" &&
|
||||||
|
(folder.type and Folder.HOLDS_MESSAGES) != 0 &&
|
||||||
|
attributes.none { it in systemAttributes } &&
|
||||||
|
folder.fullName.lowercase(Locale.ROOT).split(Regex("[./]")).last() !in reservedFolderNames
|
||||||
|
}.sortedBy { it.fullName }.forEach { folder ->
|
||||||
|
result.put(JSONObject().put("name", folder.name).put("path", folder.fullName)
|
||||||
|
.put("id", CUSTOM_FOLDER_PREFIX + folder.fullName))
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
fun listFolders(account: JSONObject): JSONObject =
|
||||||
|
withStore(account) { _, store -> JSONObject().put("folders", customFolders(store)) }
|
||||||
|
|
||||||
|
fun createFolder(account: JSONObject, rawName: String): JSONObject {
|
||||||
|
val name = rawName.trim()
|
||||||
|
require(name.isNotEmpty() && name.length <= 100) { "Enter a folder name of up to 100 characters." }
|
||||||
|
require(!Regex("[\\\\/.*%#&\\u0000-\\u001f]").containsMatchIn(name)) {
|
||||||
|
"Folder names cannot contain / \\ . * % # & or control characters."
|
||||||
|
}
|
||||||
|
require(name.lowercase(Locale.ROOT) !in reservedFolderNames) { "That folder name is reserved." }
|
||||||
|
return withStore(account) { _, store ->
|
||||||
|
val folder = store.getFolder(name)
|
||||||
|
check(!folder.exists()) { "A folder with that name already exists." }
|
||||||
|
check(folder.create(Folder.HOLDS_MESSAGES)) { "The mail server could not create that folder." }
|
||||||
|
try { folder.isSubscribed = true } catch (_: Exception) {}
|
||||||
|
JSONObject().put("ok", true)
|
||||||
|
.put("folder", JSONObject().put("name", name).put("path", folder.fullName)
|
||||||
|
.put("id", CUSTOM_FOLDER_PREFIX + folder.fullName))
|
||||||
|
.put("folders", customFolders(store))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun resolveFolder(store: Store, requested: String): Folder? {
|
private fun resolveFolder(store: Store, requested: String): Folder? {
|
||||||
|
if (requested.startsWith(CUSTOM_FOLDER_PREFIX)) {
|
||||||
|
return store.getFolder(requested.removePrefix(CUSTOM_FOLDER_PREFIX)).takeIf { it.exists() }
|
||||||
|
}
|
||||||
if (requested == "Inbox" || requested == "Starred" || requested == "Snoozed") {
|
if (requested == "Inbox" || requested == "Starred" || requested == "Snoozed") {
|
||||||
return store.getFolder("INBOX")
|
return store.getFolder("INBOX")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,28 @@ class EpMailPlugin : Plugin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PluginMethod
|
||||||
|
fun listFolders(call: PluginCall) {
|
||||||
|
try {
|
||||||
|
val account = AndroidAccountVault.account()
|
||||||
|
?: throw IllegalStateException("Add a mail account before listing folders.")
|
||||||
|
call.resolve(AndroidMailService.listFolders(account).toJSObject())
|
||||||
|
} catch (error: Exception) {
|
||||||
|
call.resolve(JSObject().put("folders", org.json.JSONArray()).put("offline", true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PluginMethod
|
||||||
|
fun createFolder(call: PluginCall) {
|
||||||
|
try {
|
||||||
|
val account = AndroidAccountVault.account()
|
||||||
|
?: throw IllegalStateException("Add a mail account before creating folders.")
|
||||||
|
call.resolve(AndroidMailService.createFolder(account, call.getString("name") ?: "").toJSObject())
|
||||||
|
} catch (error: Exception) {
|
||||||
|
call.reject(error.message ?: "Could not create the folder.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PluginMethod
|
@PluginMethod
|
||||||
fun syncFolder(call: PluginCall) {
|
fun syncFolder(call: PluginCall) {
|
||||||
try {
|
try {
|
||||||
@@ -145,7 +167,7 @@ class EpMailPlugin : Plugin() {
|
|||||||
val filters = call.getObject("filters") ?: JSObject()
|
val filters = call.getObject("filters") ?: JSObject()
|
||||||
val filterFolder = filters.getString("folder")
|
val filterFolder = filters.getString("folder")
|
||||||
val selected = filterFolder?.takeIf { it in setOf("Inbox", "Sent", "Archive", "Trash", "Starred") } ?: requested
|
val selected = filterFolder?.takeIf { it in setOf("Inbox", "Sent", "Archive", "Trash", "Starred") } ?: requested
|
||||||
val folder = if (selected in setOf("Inbox", "Sent", "Archive", "Trash", "Starred", "Snoozed")) selected else "Inbox"
|
val folder = if (selected in setOf("Inbox", "Sent", "Archive", "Trash", "Starred", "Snoozed") || AndroidMailService.isCustomFolder(selected)) selected else "Inbox"
|
||||||
val offset = (call.getInt("offset") ?: 0).coerceAtLeast(0)
|
val offset = (call.getInt("offset") ?: 0).coerceAtLeast(0)
|
||||||
AndroidMailService.flushOutbox(account)
|
AndroidMailService.flushOutbox(account)
|
||||||
call.resolve(AndroidMailService.sync(account, folder, offset, JSONObject(filters.toString())).toJSObject())
|
call.resolve(AndroidMailService.sync(account, folder, offset, JSONObject(filters.toString())).toJSObject())
|
||||||
|
|||||||
+67
-1
@@ -404,6 +404,28 @@ async function findSentMailbox(client, createIfMissing = false) {
|
|||||||
return findSpecialMailbox(client, '\\Sent', ['sent', 'sent items', 'sent mail', 'sent messages'], createIfMissing ? 'Sent' : null);
|
return findSpecialMailbox(client, '\\Sent', ['sent', 'sent items', 'sent mail', 'sent messages'], createIfMissing ? 'Sent' : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CUSTOM_FOLDER_PREFIX = 'Folder:';
|
||||||
|
const RESERVED_FOLDER_NAMES = new Set(['inbox', 'sent', 'drafts', 'archive', 'trash', 'starred', 'snoozed', 'junk', 'spam']);
|
||||||
|
|
||||||
|
async function listCustomFolders(client) {
|
||||||
|
return (await client.list())
|
||||||
|
.filter(mailbox => !mailbox.flags?.has('\\Noselect') && !mailbox.specialUse &&
|
||||||
|
mailbox.path.toUpperCase() !== 'INBOX' &&
|
||||||
|
!RESERVED_FOLDER_NAMES.has(mailbox.path.toLowerCase().split(/[./]/).pop()) &&
|
||||||
|
!['sent items', 'sent mail', 'sent messages', 'archives', 'all mail', 'deleted items', 'deleted messages']
|
||||||
|
.includes(mailbox.path.toLowerCase().split(/[./]/).pop()))
|
||||||
|
.map(mailbox => ({ name: mailbox.name, path: mailbox.path, id: CUSTOM_FOLDER_PREFIX + mailbox.path }))
|
||||||
|
.sort((a, b) => a.path.localeCompare(b.path));
|
||||||
|
}
|
||||||
|
|
||||||
|
function validFolderName(input) {
|
||||||
|
const name = String(input || '').trim();
|
||||||
|
if (!name || name.length > 100) throw new Error('Enter a folder name of up to 100 characters.');
|
||||||
|
if (/[\\/.*%#&\u0000-\u001f]/.test(name)) throw new Error('Folder names cannot contain / \\ . * % # & or control characters.');
|
||||||
|
if (RESERVED_FOLDER_NAMES.has(name.toLowerCase())) throw new Error('That folder name is reserved.');
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
async function folderPath(client, folder, createIfMissing = false) {
|
async function folderPath(client, folder, createIfMissing = false) {
|
||||||
if (folder === 'Inbox' || folder === 'Starred' || folder === 'Snoozed') return 'INBOX';
|
if (folder === 'Inbox' || folder === 'Starred' || folder === 'Snoozed') return 'INBOX';
|
||||||
const definitions = {
|
const definitions = {
|
||||||
@@ -412,6 +434,12 @@ async function folderPath(client, folder, createIfMissing = false) {
|
|||||||
Trash: ['\\Trash', ['trash', 'deleted items', 'deleted messages'], 'Trash']
|
Trash: ['\\Trash', ['trash', 'deleted items', 'deleted messages'], 'Trash']
|
||||||
};
|
};
|
||||||
const definition = definitions[folder];
|
const definition = definitions[folder];
|
||||||
|
if (!definition && typeof folder === 'string' && folder.startsWith(CUSTOM_FOLDER_PREFIX)) {
|
||||||
|
const path = folder.slice(CUSTOM_FOLDER_PREFIX.length);
|
||||||
|
const match = (await client.list()).find(mailbox => mailbox.path === path);
|
||||||
|
if (!match || match.flags?.has('\\Noselect')) throw new Error('This folder is not available on the mail server.');
|
||||||
|
return match.path;
|
||||||
|
}
|
||||||
if (!definition) throw new Error('This folder is not available on the mail server.');
|
if (!definition) throw new Error('This folder is not available on the mail server.');
|
||||||
return findSpecialMailbox(client, ...definition.slice(0, 2), createIfMissing ? definition[2] : null);
|
return findSpecialMailbox(client, ...definition.slice(0, 2), createIfMissing ? definition[2] : null);
|
||||||
}
|
}
|
||||||
@@ -869,7 +897,8 @@ ipcMain.handle('mail:sync-folder', async (_event, requestedFolder, offset = 0, f
|
|||||||
if (!account) throw new Error('Add a mail account before syncing.');
|
if (!account) throw new Error('Add a mail account before syncing.');
|
||||||
const allowedFolders = new Set(['Inbox', 'Sent', 'Archive', 'Trash', 'Starred', 'Snoozed']);
|
const allowedFolders = new Set(['Inbox', 'Sent', 'Archive', 'Trash', 'Starred', 'Snoozed']);
|
||||||
const selectedFolder = allowedFolders.has(filters.folder) ? filters.folder : requestedFolder;
|
const selectedFolder = allowedFolders.has(filters.folder) ? filters.folder : requestedFolder;
|
||||||
const folder = allowedFolders.has(selectedFolder) ? selectedFolder : 'Inbox';
|
const folder = allowedFolders.has(selectedFolder) || String(selectedFolder).startsWith(CUSTOM_FOLDER_PREFIX)
|
||||||
|
? selectedFolder : 'Inbox';
|
||||||
const { folder: _filterFolder, ...criteria } = filters;
|
const { folder: _filterFolder, ...criteria } = filters;
|
||||||
try {
|
try {
|
||||||
await flushMailOutbox(account);
|
await flushMailOutbox(account);
|
||||||
@@ -882,6 +911,43 @@ ipcMain.handle('mail:sync-folder', async (_event, requestedFolder, offset = 0, f
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('mail:list-folders', async () => {
|
||||||
|
const account = await readAccount();
|
||||||
|
if (!account) throw new Error('Add a mail account before listing folders.');
|
||||||
|
const client = imapClient(account);
|
||||||
|
try {
|
||||||
|
await client.connect();
|
||||||
|
return { folders: await listCustomFolders(client) };
|
||||||
|
} catch (error) {
|
||||||
|
if (isConnectivityFailure(error)) return { folders: [], offline: true };
|
||||||
|
throw error;
|
||||||
|
} finally {
|
||||||
|
if (client.usable) await client.logout().catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('mail:create-folder', async (_event, input) => {
|
||||||
|
const account = await readAccount();
|
||||||
|
if (!account) throw new Error('Add a mail account before creating folders.');
|
||||||
|
const name = validFolderName(input?.name);
|
||||||
|
const client = imapClient(account);
|
||||||
|
try {
|
||||||
|
await client.connect();
|
||||||
|
const existing = await client.list();
|
||||||
|
if (existing.some(mailbox => mailbox.path.toLowerCase() === name.toLowerCase())) {
|
||||||
|
throw new Error('A folder with that name already exists.');
|
||||||
|
}
|
||||||
|
const created = await client.mailboxCreate(name);
|
||||||
|
await client.mailboxSubscribe(created.path).catch(() => {});
|
||||||
|
return { ok: true, folder: { name, path: created.path, id: CUSTOM_FOLDER_PREFIX + created.path }, folders: await listCustomFolders(client) };
|
||||||
|
} catch (error) {
|
||||||
|
if (error.message === 'A folder with that name already exists.') throw error;
|
||||||
|
throw new Error(`Could not create the folder: ${error.message}`);
|
||||||
|
} finally {
|
||||||
|
if (client.usable) await client.logout().catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.handle('mail:list-drafts', async () => {
|
ipcMain.handle('mail:list-drafts', async () => {
|
||||||
const account = await readAccount();
|
const account = await readAccount();
|
||||||
if (!account) throw new Error('Add a mail account before opening drafts.');
|
if (!account) throw new Error('Add a mail account before opening drafts.');
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ contextBridge.exposeInMainWorld('daybreakMail', {
|
|||||||
connect: details => ipcRenderer.invoke('mail:connect', details),
|
connect: details => ipcRenderer.invoke('mail:connect', details),
|
||||||
updateAccount: (id, details) => ipcRenderer.invoke('mail:update-account', id, details),
|
updateAccount: (id, details) => ipcRenderer.invoke('mail:update-account', id, details),
|
||||||
syncFolder: (folder, offset, filters) => ipcRenderer.invoke('mail:sync-folder', folder, offset, filters),
|
syncFolder: (folder, offset, filters) => ipcRenderer.invoke('mail:sync-folder', folder, offset, filters),
|
||||||
|
listFolders: () => ipcRenderer.invoke('mail:list-folders'),
|
||||||
|
createFolder: name => ipcRenderer.invoke('mail:create-folder', { name }),
|
||||||
listDrafts: () => ipcRenderer.invoke('mail:list-drafts'),
|
listDrafts: () => ipcRenderer.invoke('mail:list-drafts'),
|
||||||
saveDraft: draft => ipcRenderer.invoke('mail:save-draft', draft),
|
saveDraft: draft => ipcRenderer.invoke('mail:save-draft', draft),
|
||||||
deleteDraft: id => ipcRenderer.invoke('mail:delete-draft', id),
|
deleteDraft: id => ipcRenderer.invoke('mail:delete-draft', id),
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
<button class="folder" data-folder="Archive"><span class="nav-glyph">▱</span><span>Archive</span></button>
|
<button class="folder" data-folder="Archive"><span class="nav-glyph">▱</span><span>Archive</span></button>
|
||||||
<button class="folder" data-folder="Trash"><span class="nav-glyph">⌫</span><span>Trash</span></button>
|
<button class="folder" data-folder="Trash"><span class="nav-glyph">⌫</span><span>Trash</span></button>
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="section-label"><span>FOLDERS</span><button class="folder-add" id="add-folder" aria-label="Create folder">+</button></div>
|
||||||
|
<div id="custom-folders" class="folder-nav"></div>
|
||||||
<div class="sidebar-divider"></div>
|
<div class="sidebar-divider"></div>
|
||||||
<div class="section-label"><span>LABELS</span><button class="tiny-plus" id="add-label" aria-label="Add label">+</button></div>
|
<div class="section-label"><span>LABELS</span><button class="tiny-plus" id="add-label" aria-label="Add label">+</button></div>
|
||||||
<button class="label-link" data-label="Design"><i class="label-dot dot-amber"></i>Design</button>
|
<button class="label-link" data-label="Design"><i class="label-dot dot-amber"></i>Design</button>
|
||||||
|
|||||||
+54
@@ -102,6 +102,58 @@ openMessage = function (id) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let customFolders = [];
|
||||||
|
|
||||||
|
function renderCustomFolders() {
|
||||||
|
const box = $('#custom-folders');
|
||||||
|
if (!box) return;
|
||||||
|
box.replaceChildren(...customFolders.map(folder => {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.className = 'folder custom-folder';
|
||||||
|
button.dataset.folder = folder.id;
|
||||||
|
button.classList.toggle('active', activeFolder === folder.id);
|
||||||
|
const glyph = document.createElement('span');
|
||||||
|
glyph.className = 'nav-glyph';
|
||||||
|
glyph.textContent = '▭';
|
||||||
|
const label = document.createElement('span');
|
||||||
|
label.textContent = folder.name;
|
||||||
|
button.title = folder.path;
|
||||||
|
button.append(glyph, label);
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
if ($('#filter-folder').value) { $('#filter-folder').value = ''; folderBeforeSearch = null; }
|
||||||
|
activeFolder = folder.id;
|
||||||
|
$$('.folder').forEach(item => item.classList.toggle('active', item === button));
|
||||||
|
$('#sidebar-title').textContent = folder.name;
|
||||||
|
$('#crumb-current').textContent = folder.name;
|
||||||
|
mailPageOffset = 0;
|
||||||
|
void syncMailbox(false, { offset: 0 });
|
||||||
|
});
|
||||||
|
return button;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadCustomFolders() {
|
||||||
|
if (!connectedMailAccount || !window.daybreakMail?.listFolders) return;
|
||||||
|
try {
|
||||||
|
customFolders = (await window.daybreakMail.listFolders()).folders || [];
|
||||||
|
renderCustomFolders();
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createMailFolder() {
|
||||||
|
if (!connectedMailAccount || !window.daybreakMail?.createFolder) { openMailAccount(); return; }
|
||||||
|
const name = prompt('New mail folder name:')?.trim();
|
||||||
|
if (!name) return;
|
||||||
|
try {
|
||||||
|
const result = await window.daybreakMail.createFolder(name);
|
||||||
|
customFolders = result.folders || customFolders;
|
||||||
|
renderCustomFolders();
|
||||||
|
toast(`Folder “${result.folder?.name || name}” created`);
|
||||||
|
} catch (error) {
|
||||||
|
toast(error.message || 'Could not create the folder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateAccountCard(account) {
|
function updateAccountCard(account) {
|
||||||
const card = $('#account-settings');
|
const card = $('#account-settings');
|
||||||
if (!card) return;
|
if (!card) return;
|
||||||
@@ -114,6 +166,7 @@ function updateAccountCard(account) {
|
|||||||
card.querySelector('.account-info span').textContent = email;
|
card.querySelector('.account-info span').textContent = email;
|
||||||
card.title = `${displayName} <${email}>`;
|
card.title = `${displayName} <${email}>`;
|
||||||
if (typeof renderLabels === 'function') renderLabels();
|
if (typeof renderLabels === 'function') renderLabels();
|
||||||
|
void loadCustomFolders();
|
||||||
card.querySelector('.online-dot').style.background = '#70ad7b';
|
card.querySelector('.online-dot').style.background = '#70ad7b';
|
||||||
const profileButton = $('.top-avatar');
|
const profileButton = $('.top-avatar');
|
||||||
if (profileButton) {
|
if (profileButton) {
|
||||||
@@ -499,6 +552,7 @@ if (window.daybreakMail) {
|
|||||||
});
|
});
|
||||||
$('#settings-button').onclick = () => openPreferences();
|
$('#settings-button').onclick = () => openPreferences();
|
||||||
$('#refresh').onclick = () => syncMailbox(true);
|
$('#refresh').onclick = () => syncMailbox(true);
|
||||||
|
$('#add-folder').addEventListener('click', createMailFolder);
|
||||||
$$('.folder').forEach(button => button.addEventListener('click', () => {
|
$$('.folder').forEach(button => button.addEventListener('click', () => {
|
||||||
if ($('#filter-folder').value) {
|
if ($('#filter-folder').value) {
|
||||||
$('#filter-folder').value = '';
|
$('#filter-folder').value = '';
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.1.21",
|
"version": "0.2.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.1.21",
|
"version": "0.2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor/android": "^8.5.2",
|
"@capacitor/android": "^8.5.2",
|
||||||
"@capacitor/core": "^8.5.2",
|
"@capacitor/core": "^8.5.2",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ep-mail",
|
"name": "ep-mail",
|
||||||
"version": "0.1.21",
|
"version": "0.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Eternity Project mail client",
|
"description": "Eternity Project mail client",
|
||||||
"author": "Eternity Project",
|
"author": "Eternity Project",
|
||||||
|
|||||||
@@ -520,6 +520,8 @@
|
|||||||
connect: (details) => EpMail.connect(details),
|
connect: (details) => EpMail.connect(details),
|
||||||
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
||||||
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
||||||
|
listFolders: () => EpMail.listFolders(),
|
||||||
|
createFolder: (name) => EpMail.createFolder({ name }),
|
||||||
listDrafts: () => EpMail.listDrafts(),
|
listDrafts: () => EpMail.listDrafts(),
|
||||||
saveDraft: (draft) => EpMail.saveDraft(draft),
|
saveDraft: (draft) => EpMail.saveDraft(draft),
|
||||||
deleteDraft: (id) => EpMail.deleteDraft({ id }),
|
deleteDraft: (id) => EpMail.deleteDraft({ id }),
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ if (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'android') {
|
|||||||
connect: details => EpMail.connect(details),
|
connect: details => EpMail.connect(details),
|
||||||
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
||||||
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
||||||
|
listFolders: () => EpMail.listFolders(),
|
||||||
|
createFolder: name => EpMail.createFolder({ name }),
|
||||||
listDrafts: () => EpMail.listDrafts(),
|
listDrafts: () => EpMail.listDrafts(),
|
||||||
saveDraft: draft => EpMail.saveDraft(draft),
|
saveDraft: draft => EpMail.saveDraft(draft),
|
||||||
deleteDraft: id => EpMail.deleteDraft({ id }),
|
deleteDraft: id => EpMail.deleteDraft({ id }),
|
||||||
|
|||||||
@@ -124,3 +124,5 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
|||||||
.mail-safety-warning{margin:10px 16px;padding:12px 14px;border:1px solid #d69b43;border-left:4px solid #b87321;border-radius:8px;background:#fff6df;color:#5b3c17;font-size:12px}.mail-safety-warning strong{display:block}.mail-safety-warning ul{margin:7px 0;padding-left:18px}.mail-safety-warning small{display:block;line-height:1.4}.mail-links{padding:12px 16px;border-top:1px solid var(--line,#eaede8)}.mail-links h3{margin:0 0 8px;font-size:12px}.mail-safety-intro{font-size:11px;color:#8d4a16}.mail-link-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;margin-top:6px;border:1px solid var(--line,#eaede8);border-radius:8px;font-size:11px}.mail-link-row>div{min-width:0;display:grid;gap:3px}.mail-link-row span,.mail-link-row small{overflow-wrap:anywhere;color:#727970}.mail-link-risky{border-color:#d69b43;background:#fff8ea}.mail-link-open{flex:none;border:1px solid #9ba99b;border-radius:6px;background:transparent;padding:6px 8px;font-size:10px}.mail-link-open:disabled{opacity:.55;cursor:wait}
|
.mail-safety-warning{margin:10px 16px;padding:12px 14px;border:1px solid #d69b43;border-left:4px solid #b87321;border-radius:8px;background:#fff6df;color:#5b3c17;font-size:12px}.mail-safety-warning strong{display:block}.mail-safety-warning ul{margin:7px 0;padding-left:18px}.mail-safety-warning small{display:block;line-height:1.4}.mail-links{padding:12px 16px;border-top:1px solid var(--line,#eaede8)}.mail-links h3{margin:0 0 8px;font-size:12px}.mail-safety-intro{font-size:11px;color:#8d4a16}.mail-link-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;margin-top:6px;border:1px solid var(--line,#eaede8);border-radius:8px;font-size:11px}.mail-link-row>div{min-width:0;display:grid;gap:3px}.mail-link-row span,.mail-link-row small{overflow-wrap:anywhere;color:#727970}.mail-link-risky{border-color:#d69b43;background:#fff8ea}.mail-link-open{flex:none;border:1px solid #9ba99b;border-radius:6px;background:transparent;padding:6px 8px;font-size:10px}.mail-link-open:disabled{opacity:.55;cursor:wait}
|
||||||
body.ep-wasteland .mail-safety-warning{background:#392719;border-color:#a8793e;color:#f0d4a3}body.ep-wasteland .mail-link-row{border-color:#4a3f33}body.ep-wasteland .mail-link-risky{background:#392719;border-color:#a8793e}body.ep-wasteland .mail-link-row span,body.ep-wasteland .mail-link-row small{color:#cbbba0}
|
body.ep-wasteland .mail-safety-warning{background:#392719;border-color:#a8793e;color:#f0d4a3}body.ep-wasteland .mail-link-row{border-color:#4a3f33}body.ep-wasteland .mail-link-risky{background:#392719;border-color:#a8793e}body.ep-wasteland .mail-link-row span,body.ep-wasteland .mail-link-row small{color:#cbbba0}
|
||||||
body.ep-daylight .mail-safety-warning{background:#fff6df;color:#5b3c17}body.ep-daylight .mail-link-risky{background:#fff8ea;border-color:#d69b43}
|
body.ep-daylight .mail-safety-warning{background:#fff6df;color:#5b3c17}body.ep-daylight .mail-link-risky{background:#fff8ea;border-color:#d69b43}
|
||||||
|
|
||||||
|
.folder-add{border:0;background:transparent;color:#929990;font-size:18px;cursor:pointer}.folder-add:hover{color:#487354}.section-label+.folder-nav:empty{display:none}.custom-folder span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
<button class="folder" data-folder="Archive"><span class="nav-glyph">▱</span><span>Archive</span></button>
|
<button class="folder" data-folder="Archive"><span class="nav-glyph">▱</span><span>Archive</span></button>
|
||||||
<button class="folder" data-folder="Trash"><span class="nav-glyph">⌫</span><span>Trash</span></button>
|
<button class="folder" data-folder="Trash"><span class="nav-glyph">⌫</span><span>Trash</span></button>
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="section-label"><span>FOLDERS</span><button class="folder-add" id="add-folder" aria-label="Create folder">+</button></div>
|
||||||
|
<div id="custom-folders" class="folder-nav"></div>
|
||||||
<div class="sidebar-divider"></div>
|
<div class="sidebar-divider"></div>
|
||||||
<div class="section-label"><span>LABELS</span><button class="tiny-plus" id="add-label" aria-label="Add label">+</button></div>
|
<div class="section-label"><span>LABELS</span><button class="tiny-plus" id="add-label" aria-label="Add label">+</button></div>
|
||||||
<button class="label-link" data-label="Design"><i class="label-dot dot-amber"></i>Design</button>
|
<button class="label-link" data-label="Design"><i class="label-dot dot-amber"></i>Design</button>
|
||||||
|
|||||||
@@ -102,6 +102,58 @@ openMessage = function (id) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let customFolders = [];
|
||||||
|
|
||||||
|
function renderCustomFolders() {
|
||||||
|
const box = $('#custom-folders');
|
||||||
|
if (!box) return;
|
||||||
|
box.replaceChildren(...customFolders.map(folder => {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
button.className = 'folder custom-folder';
|
||||||
|
button.dataset.folder = folder.id;
|
||||||
|
button.classList.toggle('active', activeFolder === folder.id);
|
||||||
|
const glyph = document.createElement('span');
|
||||||
|
glyph.className = 'nav-glyph';
|
||||||
|
glyph.textContent = '▭';
|
||||||
|
const label = document.createElement('span');
|
||||||
|
label.textContent = folder.name;
|
||||||
|
button.title = folder.path;
|
||||||
|
button.append(glyph, label);
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
if ($('#filter-folder').value) { $('#filter-folder').value = ''; folderBeforeSearch = null; }
|
||||||
|
activeFolder = folder.id;
|
||||||
|
$$('.folder').forEach(item => item.classList.toggle('active', item === button));
|
||||||
|
$('#sidebar-title').textContent = folder.name;
|
||||||
|
$('#crumb-current').textContent = folder.name;
|
||||||
|
mailPageOffset = 0;
|
||||||
|
void syncMailbox(false, { offset: 0 });
|
||||||
|
});
|
||||||
|
return button;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadCustomFolders() {
|
||||||
|
if (!connectedMailAccount || !window.daybreakMail?.listFolders) return;
|
||||||
|
try {
|
||||||
|
customFolders = (await window.daybreakMail.listFolders()).folders || [];
|
||||||
|
renderCustomFolders();
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createMailFolder() {
|
||||||
|
if (!connectedMailAccount || !window.daybreakMail?.createFolder) { openMailAccount(); return; }
|
||||||
|
const name = prompt('New mail folder name:')?.trim();
|
||||||
|
if (!name) return;
|
||||||
|
try {
|
||||||
|
const result = await window.daybreakMail.createFolder(name);
|
||||||
|
customFolders = result.folders || customFolders;
|
||||||
|
renderCustomFolders();
|
||||||
|
toast(`Folder “${result.folder?.name || name}” created`);
|
||||||
|
} catch (error) {
|
||||||
|
toast(error.message || 'Could not create the folder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateAccountCard(account) {
|
function updateAccountCard(account) {
|
||||||
const card = $('#account-settings');
|
const card = $('#account-settings');
|
||||||
if (!card) return;
|
if (!card) return;
|
||||||
@@ -114,6 +166,7 @@ function updateAccountCard(account) {
|
|||||||
card.querySelector('.account-info span').textContent = email;
|
card.querySelector('.account-info span').textContent = email;
|
||||||
card.title = `${displayName} <${email}>`;
|
card.title = `${displayName} <${email}>`;
|
||||||
if (typeof renderLabels === 'function') renderLabels();
|
if (typeof renderLabels === 'function') renderLabels();
|
||||||
|
void loadCustomFolders();
|
||||||
card.querySelector('.online-dot').style.background = '#70ad7b';
|
card.querySelector('.online-dot').style.background = '#70ad7b';
|
||||||
const profileButton = $('.top-avatar');
|
const profileButton = $('.top-avatar');
|
||||||
if (profileButton) {
|
if (profileButton) {
|
||||||
@@ -499,6 +552,7 @@ if (window.daybreakMail) {
|
|||||||
});
|
});
|
||||||
$('#settings-button').onclick = () => openPreferences();
|
$('#settings-button').onclick = () => openPreferences();
|
||||||
$('#refresh').onclick = () => syncMailbox(true);
|
$('#refresh').onclick = () => syncMailbox(true);
|
||||||
|
$('#add-folder').addEventListener('click', createMailFolder);
|
||||||
$$('.folder').forEach(button => button.addEventListener('click', () => {
|
$$('.folder').forEach(button => button.addEventListener('click', () => {
|
||||||
if ($('#filter-folder').value) {
|
if ($('#filter-folder').value) {
|
||||||
$('#filter-folder').value = '';
|
$('#filter-folder').value = '';
|
||||||
|
|||||||
@@ -520,6 +520,8 @@
|
|||||||
connect: (details) => EpMail.connect(details),
|
connect: (details) => EpMail.connect(details),
|
||||||
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
updateAccount: (id, details) => EpMail.updateAccount({ id, ...details }),
|
||||||
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
syncFolder: (folder, offset, filters) => EpMail.syncFolder({ folder, offset, filters }),
|
||||||
|
listFolders: () => EpMail.listFolders(),
|
||||||
|
createFolder: (name) => EpMail.createFolder({ name }),
|
||||||
listDrafts: () => EpMail.listDrafts(),
|
listDrafts: () => EpMail.listDrafts(),
|
||||||
saveDraft: (draft) => EpMail.saveDraft(draft),
|
saveDraft: (draft) => EpMail.saveDraft(draft),
|
||||||
deleteDraft: (id) => EpMail.deleteDraft({ id }),
|
deleteDraft: (id) => EpMail.deleteDraft({ id }),
|
||||||
|
|||||||
@@ -124,3 +124,5 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
|||||||
.mail-safety-warning{margin:10px 16px;padding:12px 14px;border:1px solid #d69b43;border-left:4px solid #b87321;border-radius:8px;background:#fff6df;color:#5b3c17;font-size:12px}.mail-safety-warning strong{display:block}.mail-safety-warning ul{margin:7px 0;padding-left:18px}.mail-safety-warning small{display:block;line-height:1.4}.mail-links{padding:12px 16px;border-top:1px solid var(--line,#eaede8)}.mail-links h3{margin:0 0 8px;font-size:12px}.mail-safety-intro{font-size:11px;color:#8d4a16}.mail-link-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;margin-top:6px;border:1px solid var(--line,#eaede8);border-radius:8px;font-size:11px}.mail-link-row>div{min-width:0;display:grid;gap:3px}.mail-link-row span,.mail-link-row small{overflow-wrap:anywhere;color:#727970}.mail-link-risky{border-color:#d69b43;background:#fff8ea}.mail-link-open{flex:none;border:1px solid #9ba99b;border-radius:6px;background:transparent;padding:6px 8px;font-size:10px}.mail-link-open:disabled{opacity:.55;cursor:wait}
|
.mail-safety-warning{margin:10px 16px;padding:12px 14px;border:1px solid #d69b43;border-left:4px solid #b87321;border-radius:8px;background:#fff6df;color:#5b3c17;font-size:12px}.mail-safety-warning strong{display:block}.mail-safety-warning ul{margin:7px 0;padding-left:18px}.mail-safety-warning small{display:block;line-height:1.4}.mail-links{padding:12px 16px;border-top:1px solid var(--line,#eaede8)}.mail-links h3{margin:0 0 8px;font-size:12px}.mail-safety-intro{font-size:11px;color:#8d4a16}.mail-link-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;margin-top:6px;border:1px solid var(--line,#eaede8);border-radius:8px;font-size:11px}.mail-link-row>div{min-width:0;display:grid;gap:3px}.mail-link-row span,.mail-link-row small{overflow-wrap:anywhere;color:#727970}.mail-link-risky{border-color:#d69b43;background:#fff8ea}.mail-link-open{flex:none;border:1px solid #9ba99b;border-radius:6px;background:transparent;padding:6px 8px;font-size:10px}.mail-link-open:disabled{opacity:.55;cursor:wait}
|
||||||
body.ep-wasteland .mail-safety-warning{background:#392719;border-color:#a8793e;color:#f0d4a3}body.ep-wasteland .mail-link-row{border-color:#4a3f33}body.ep-wasteland .mail-link-risky{background:#392719;border-color:#a8793e}body.ep-wasteland .mail-link-row span,body.ep-wasteland .mail-link-row small{color:#cbbba0}
|
body.ep-wasteland .mail-safety-warning{background:#392719;border-color:#a8793e;color:#f0d4a3}body.ep-wasteland .mail-link-row{border-color:#4a3f33}body.ep-wasteland .mail-link-risky{background:#392719;border-color:#a8793e}body.ep-wasteland .mail-link-row span,body.ep-wasteland .mail-link-row small{color:#cbbba0}
|
||||||
body.ep-daylight .mail-safety-warning{background:#fff6df;color:#5b3c17}body.ep-daylight .mail-link-risky{background:#fff8ea;border-color:#d69b43}
|
body.ep-daylight .mail-safety-warning{background:#fff6df;color:#5b3c17}body.ep-daylight .mail-link-risky{background:#fff8ea;border-color:#d69b43}
|
||||||
|
|
||||||
|
.folder-add{border:0;background:transparent;color:#929990;font-size:18px;cursor:pointer}.folder-add:hover{color:#487354}.section-label+.folder-nav:empty{display:none}.custom-folder span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||||
|
|||||||
Reference in New Issue
Block a user