Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63ee146719 |
@@ -31,4 +31,4 @@ On Windows, `py -m http.server 8000` is also available on many Python installati
|
||||
|
||||
## 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. 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.
|
||||
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. Keyboard shortcuts for compose, search, refresh, archive, delete, star, reply, forward, and message navigation can be changed in **Settings**.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
- [x] Cache recent messages and save drafts offline; queue supported sends and message actions for retry when connectivity returns.
|
||||
- [ ] Group related messages into conversations, with controls to expand or collapse threads.
|
||||
- [ ] Add attachment previews and a dedicated view to find and manage attachments across mailboxes.
|
||||
- [ ] Add configurable keyboard shortcuts for common actions such as compose, archive, reply, and search.
|
||||
- [x] Add configurable keyboard shortcuts for common actions such as compose, archive, reply, and search.
|
||||
- [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 signatures, notification preferences, and sync settings.
|
||||
|
||||
@@ -70,5 +70,6 @@
|
||||
<script src="snooze-ui.js"></script>
|
||||
<script src="account-ui.js"></script>
|
||||
<script src="dav-ui.js"></script>
|
||||
<script src="shortcuts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ep-mail",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ep-mail",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^8.5.2",
|
||||
"@capacitor/core": "^8.5.2",
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ep-mail",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"private": true,
|
||||
"description": "Eternity Project mail client",
|
||||
"author": "Eternity Project",
|
||||
@@ -41,6 +41,7 @@
|
||||
"productivity.js",
|
||||
"account-ui.js",
|
||||
"dav-ui.js",
|
||||
"shortcuts.js",
|
||||
"icon.svg",
|
||||
"logo-ep-daylight.svg",
|
||||
"logo-ep-wasteland.svg",
|
||||
|
||||
@@ -13,6 +13,7 @@ const assets = [
|
||||
'productivity.js',
|
||||
'account-ui.js',
|
||||
'dav-ui.js',
|
||||
'shortcuts.js',
|
||||
'icon.svg',
|
||||
'logo-ep-daylight.svg',
|
||||
'logo-ep-wasteland.svg',
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const CACHE='ep-mail-v3';
|
||||
const FILES=['./','./index.html','./styles.css','./branding.css','./app.js','./platform-bridge.js','./mail-ui.js','./productivity.js','./snooze-ui.js','./account-ui.js','./dav-ui.js','./manifest.webmanifest','./icon.svg','./logo-ep-daylight.svg','./logo-ep-wasteland.svg'];
|
||||
const CACHE='ep-mail-v4';
|
||||
const FILES=['./','./index.html','./styles.css','./branding.css','./app.js','./platform-bridge.js','./mail-ui.js','./productivity.js','./snooze-ui.js','./account-ui.js','./dav-ui.js','./shortcuts.js','./manifest.webmanifest','./icon.svg','./logo-ep-daylight.svg','./logo-ep-wasteland.svg'];
|
||||
self.addEventListener('install',event=>event.waitUntil(caches.open(CACHE).then(cache=>cache.addAll(FILES))));
|
||||
self.addEventListener('activate',event=>event.waitUntil(caches.keys().then(keys=>Promise.all(keys.filter(k=>k!==CACHE).map(k=>caches.delete(k))))));
|
||||
self.addEventListener('fetch',event=>{if(event.request.method!=='GET')return;event.respondWith(caches.match(event.request).then(cached=>cached||fetch(event.request).then(response=>{if(new URL(event.request.url).origin===location.origin){const copy=response.clone();caches.open(CACHE).then(cache=>cache.put(event.request,copy))}return response}).catch(()=>caches.match('./index.html'))))});
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
// Configurable keyboard shortcuts for common mail actions.
|
||||
const shortcutStorageKey = 'daybreak-shortcuts';
|
||||
const shortcutActions = [
|
||||
{ id: 'compose', label: 'Compose', fallback: 'c', run: () => $('#compose')?.click() },
|
||||
{ id: 'search', label: 'Search', fallback: '/', run: () => $('#search')?.focus() },
|
||||
{ id: 'refresh', label: 'Refresh', fallback: 'r', run: () => $('#refresh')?.click() },
|
||||
{ id: 'archive', label: 'Archive message', fallback: 'e', run: () => $('#reader-archive')?.click() },
|
||||
{ id: 'delete', label: 'Delete message', fallback: '#', run: () => $('#reader-delete')?.click() },
|
||||
{ id: 'star', label: 'Star message', fallback: 's', run: () => $('#reader-star')?.click() },
|
||||
{ id: 'reply', label: 'Reply', fallback: 'a', run: () => $('#reply')?.click() },
|
||||
{ id: 'forward', label: 'Forward', fallback: 'f', run: () => $('#forward')?.click() },
|
||||
{ id: 'next', label: 'Next message', fallback: 'j', run: () => moveMessageSelection(1) },
|
||||
{ id: 'previous', label: 'Previous message', fallback: 'k', run: () => moveMessageSelection(-1) }
|
||||
];
|
||||
|
||||
function normalizeShortcut(value) {
|
||||
const text = String(value || '').trim();
|
||||
if (!text) return '';
|
||||
const parts = text.split('+').map(part => part.trim()).filter(Boolean);
|
||||
const key = parts.pop() || '+';
|
||||
const mods = ['Ctrl', 'Alt', 'Shift'].filter(mod => parts.some(part => part.toLowerCase() === mod.toLowerCase()));
|
||||
return [...mods, key.length === 1 ? key.toLowerCase() : key].join('+');
|
||||
}
|
||||
|
||||
function loadShortcuts() {
|
||||
let saved = {};
|
||||
try { saved = JSON.parse(localStorage.getItem(shortcutStorageKey)) || {}; } catch {}
|
||||
return Object.fromEntries(shortcutActions.map(action => [
|
||||
action.id, typeof saved[action.id] === 'string' ? normalizeShortcut(saved[action.id]) : action.fallback
|
||||
]));
|
||||
}
|
||||
|
||||
function eventShortcut(event) {
|
||||
if (['Control', 'Alt', 'Shift', 'Meta'].includes(event.key)) return '';
|
||||
const mods = [event.ctrlKey || event.metaKey ? 'Ctrl' : '', event.altKey ? 'Alt' : ''];
|
||||
const printable = event.key.length === 1;
|
||||
if (event.shiftKey && !printable) mods.push('Shift');
|
||||
return normalizeShortcut([...mods.filter(Boolean), event.key === ' ' ? 'Space' : event.key].join('+'));
|
||||
}
|
||||
|
||||
function moveMessageSelection(step) {
|
||||
if (!messages.length) return;
|
||||
const index = messages.findIndex(message => message.id === activeMessage);
|
||||
const next = messages[Math.min(messages.length - 1, Math.max(0, index + step))];
|
||||
if (next) { openMessage(next.id); $(`.message[data-id="${next.id}"]`)?.scrollIntoView({ block: 'nearest' }); }
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', event => {
|
||||
if (event.defaultPrevented || event.isComposing || event.key === 'Escape') return;
|
||||
const target = event.target;
|
||||
if (target?.closest?.('input, textarea, select, [contenteditable="true"]') || $('#modal-root')?.children.length) return;
|
||||
const pressed = eventShortcut(event);
|
||||
if (!pressed) return;
|
||||
const shortcuts = loadShortcuts();
|
||||
const action = shortcutActions.find(item => shortcuts[item.id] && shortcuts[item.id] === pressed);
|
||||
if (!action) return;
|
||||
event.preventDefault();
|
||||
action.run();
|
||||
});
|
||||
|
||||
if (typeof openPreferences === 'function') {
|
||||
const baseOpenPreferences = openPreferences;
|
||||
openPreferences = function () {
|
||||
baseOpenPreferences();
|
||||
const fields = $('#modal-root .compose-fields');
|
||||
const save = $('#save-appearance');
|
||||
if (!fields || !save) return;
|
||||
const shortcuts = loadShortcuts();
|
||||
const section = document.createElement('div');
|
||||
section.className = 'shortcut-settings';
|
||||
section.innerHTML = `<h3>Keyboard shortcuts</h3><p class="account-note">Type a key or combination such as <code>c</code>, <code>Ctrl+Enter</code> or <code>Alt+n</code>. Leave blank to disable. Shortcuts are inactive while typing or in dialogs.</p>${shortcutActions.map(action =>
|
||||
`<label class="compose-line"><span>${action.label}</span><input class="shortcut-input" data-action="${action.id}" maxlength="24" value="${esc(shortcuts[action.id])}" placeholder="None"></label>`).join('')}<button type="button" class="discard" id="reset-shortcuts">Reset to defaults</button>`;
|
||||
fields.append(section);
|
||||
section.addEventListener('keydown', event => {
|
||||
const input = event.target.closest('.shortcut-input');
|
||||
if (!input || ['Tab', 'Escape'].includes(event.key)) return;
|
||||
event.preventDefault();
|
||||
if (['Backspace', 'Delete'].includes(event.key)) { input.value = ''; return; }
|
||||
const combo = eventShortcut(event);
|
||||
if (combo) input.value = combo;
|
||||
});
|
||||
$('#reset-shortcuts').onclick = () => {
|
||||
section.querySelectorAll('.shortcut-input').forEach(input => {
|
||||
input.value = shortcutActions.find(action => action.id === input.dataset.action).fallback;
|
||||
});
|
||||
};
|
||||
const baseSave = save.onclick;
|
||||
save.onclick = event => {
|
||||
const values = {};
|
||||
const used = new Map();
|
||||
for (const input of section.querySelectorAll('.shortcut-input')) {
|
||||
const value = normalizeShortcut(input.value);
|
||||
const label = shortcutActions.find(action => action.id === input.dataset.action).label;
|
||||
if (value && used.has(value)) { toast(`“${value}” is used by both ${used.get(value)} and ${label}`); return; }
|
||||
if (value) used.set(value, label);
|
||||
values[input.dataset.action] = value;
|
||||
}
|
||||
localStorage.setItem(shortcutStorageKey, JSON.stringify(values));
|
||||
baseSave?.call(save, event);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -126,3 +126,4 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
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}
|
||||
.shortcut-settings h3{margin:16px 0 4px;font-size:13px}.shortcut-settings code{font-family:monospace}.shortcut-input{text-transform:none}.shortcut-settings #reset-shortcuts{margin-top:8px}
|
||||
|
||||
@@ -70,5 +70,6 @@
|
||||
<script src="snooze-ui.js"></script>
|
||||
<script src="account-ui.js"></script>
|
||||
<script src="dav-ui.js"></script>
|
||||
<script src="shortcuts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const CACHE='ep-mail-v3';
|
||||
const FILES=['./','./index.html','./styles.css','./branding.css','./app.js','./platform-bridge.js','./mail-ui.js','./productivity.js','./snooze-ui.js','./account-ui.js','./dav-ui.js','./manifest.webmanifest','./icon.svg','./logo-ep-daylight.svg','./logo-ep-wasteland.svg'];
|
||||
const CACHE='ep-mail-v4';
|
||||
const FILES=['./','./index.html','./styles.css','./branding.css','./app.js','./platform-bridge.js','./mail-ui.js','./productivity.js','./snooze-ui.js','./account-ui.js','./dav-ui.js','./shortcuts.js','./manifest.webmanifest','./icon.svg','./logo-ep-daylight.svg','./logo-ep-wasteland.svg'];
|
||||
self.addEventListener('install',event=>event.waitUntil(caches.open(CACHE).then(cache=>cache.addAll(FILES))));
|
||||
self.addEventListener('activate',event=>event.waitUntil(caches.keys().then(keys=>Promise.all(keys.filter(k=>k!==CACHE).map(k=>caches.delete(k))))));
|
||||
self.addEventListener('fetch',event=>{if(event.request.method!=='GET')return;event.respondWith(caches.match(event.request).then(cached=>cached||fetch(event.request).then(response=>{if(new URL(event.request.url).origin===location.origin){const copy=response.clone();caches.open(CACHE).then(cache=>cache.put(event.request,copy))}return response}).catch(()=>caches.match('./index.html'))))});
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
// Configurable keyboard shortcuts for common mail actions.
|
||||
const shortcutStorageKey = 'daybreak-shortcuts';
|
||||
const shortcutActions = [
|
||||
{ id: 'compose', label: 'Compose', fallback: 'c', run: () => $('#compose')?.click() },
|
||||
{ id: 'search', label: 'Search', fallback: '/', run: () => $('#search')?.focus() },
|
||||
{ id: 'refresh', label: 'Refresh', fallback: 'r', run: () => $('#refresh')?.click() },
|
||||
{ id: 'archive', label: 'Archive message', fallback: 'e', run: () => $('#reader-archive')?.click() },
|
||||
{ id: 'delete', label: 'Delete message', fallback: '#', run: () => $('#reader-delete')?.click() },
|
||||
{ id: 'star', label: 'Star message', fallback: 's', run: () => $('#reader-star')?.click() },
|
||||
{ id: 'reply', label: 'Reply', fallback: 'a', run: () => $('#reply')?.click() },
|
||||
{ id: 'forward', label: 'Forward', fallback: 'f', run: () => $('#forward')?.click() },
|
||||
{ id: 'next', label: 'Next message', fallback: 'j', run: () => moveMessageSelection(1) },
|
||||
{ id: 'previous', label: 'Previous message', fallback: 'k', run: () => moveMessageSelection(-1) }
|
||||
];
|
||||
|
||||
function normalizeShortcut(value) {
|
||||
const text = String(value || '').trim();
|
||||
if (!text) return '';
|
||||
const parts = text.split('+').map(part => part.trim()).filter(Boolean);
|
||||
const key = parts.pop() || '+';
|
||||
const mods = ['Ctrl', 'Alt', 'Shift'].filter(mod => parts.some(part => part.toLowerCase() === mod.toLowerCase()));
|
||||
return [...mods, key.length === 1 ? key.toLowerCase() : key].join('+');
|
||||
}
|
||||
|
||||
function loadShortcuts() {
|
||||
let saved = {};
|
||||
try { saved = JSON.parse(localStorage.getItem(shortcutStorageKey)) || {}; } catch {}
|
||||
return Object.fromEntries(shortcutActions.map(action => [
|
||||
action.id, typeof saved[action.id] === 'string' ? normalizeShortcut(saved[action.id]) : action.fallback
|
||||
]));
|
||||
}
|
||||
|
||||
function eventShortcut(event) {
|
||||
if (['Control', 'Alt', 'Shift', 'Meta'].includes(event.key)) return '';
|
||||
const mods = [event.ctrlKey || event.metaKey ? 'Ctrl' : '', event.altKey ? 'Alt' : ''];
|
||||
const printable = event.key.length === 1;
|
||||
if (event.shiftKey && !printable) mods.push('Shift');
|
||||
return normalizeShortcut([...mods.filter(Boolean), event.key === ' ' ? 'Space' : event.key].join('+'));
|
||||
}
|
||||
|
||||
function moveMessageSelection(step) {
|
||||
if (!messages.length) return;
|
||||
const index = messages.findIndex(message => message.id === activeMessage);
|
||||
const next = messages[Math.min(messages.length - 1, Math.max(0, index + step))];
|
||||
if (next) { openMessage(next.id); $(`.message[data-id="${next.id}"]`)?.scrollIntoView({ block: 'nearest' }); }
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', event => {
|
||||
if (event.defaultPrevented || event.isComposing || event.key === 'Escape') return;
|
||||
const target = event.target;
|
||||
if (target?.closest?.('input, textarea, select, [contenteditable="true"]') || $('#modal-root')?.children.length) return;
|
||||
const pressed = eventShortcut(event);
|
||||
if (!pressed) return;
|
||||
const shortcuts = loadShortcuts();
|
||||
const action = shortcutActions.find(item => shortcuts[item.id] && shortcuts[item.id] === pressed);
|
||||
if (!action) return;
|
||||
event.preventDefault();
|
||||
action.run();
|
||||
});
|
||||
|
||||
if (typeof openPreferences === 'function') {
|
||||
const baseOpenPreferences = openPreferences;
|
||||
openPreferences = function () {
|
||||
baseOpenPreferences();
|
||||
const fields = $('#modal-root .compose-fields');
|
||||
const save = $('#save-appearance');
|
||||
if (!fields || !save) return;
|
||||
const shortcuts = loadShortcuts();
|
||||
const section = document.createElement('div');
|
||||
section.className = 'shortcut-settings';
|
||||
section.innerHTML = `<h3>Keyboard shortcuts</h3><p class="account-note">Type a key or combination such as <code>c</code>, <code>Ctrl+Enter</code> or <code>Alt+n</code>. Leave blank to disable. Shortcuts are inactive while typing or in dialogs.</p>${shortcutActions.map(action =>
|
||||
`<label class="compose-line"><span>${action.label}</span><input class="shortcut-input" data-action="${action.id}" maxlength="24" value="${esc(shortcuts[action.id])}" placeholder="None"></label>`).join('')}<button type="button" class="discard" id="reset-shortcuts">Reset to defaults</button>`;
|
||||
fields.append(section);
|
||||
section.addEventListener('keydown', event => {
|
||||
const input = event.target.closest('.shortcut-input');
|
||||
if (!input || ['Tab', 'Escape'].includes(event.key)) return;
|
||||
event.preventDefault();
|
||||
if (['Backspace', 'Delete'].includes(event.key)) { input.value = ''; return; }
|
||||
const combo = eventShortcut(event);
|
||||
if (combo) input.value = combo;
|
||||
});
|
||||
$('#reset-shortcuts').onclick = () => {
|
||||
section.querySelectorAll('.shortcut-input').forEach(input => {
|
||||
input.value = shortcutActions.find(action => action.id === input.dataset.action).fallback;
|
||||
});
|
||||
};
|
||||
const baseSave = save.onclick;
|
||||
save.onclick = event => {
|
||||
const values = {};
|
||||
const used = new Map();
|
||||
for (const input of section.querySelectorAll('.shortcut-input')) {
|
||||
const value = normalizeShortcut(input.value);
|
||||
const label = shortcutActions.find(action => action.id === input.dataset.action).label;
|
||||
if (value && used.has(value)) { toast(`“${value}” is used by both ${used.get(value)} and ${label}`); return; }
|
||||
if (value) used.set(value, label);
|
||||
values[input.dataset.action] = value;
|
||||
}
|
||||
localStorage.setItem(shortcutStorageKey, JSON.stringify(values));
|
||||
baseSave?.call(save, event);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -126,3 +126,4 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
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}
|
||||
.shortcut-settings h3{margin:16px 0 4px;font-size:13px}.shortcut-settings code{font-family:monospace}.shortcut-input{text-transform:none}.shortcut-settings #reset-shortcuts{margin-top:8px}
|
||||
|
||||
Reference in New Issue
Block a user