Compare commits
2
Commits
8a798fec6b
...
V0.5.22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0e2ce26bc | ||
|
|
4ec578b072 |
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
+12
-7
@@ -1,3 +1,5 @@
|
||||
const { BUILTIN_SERVER_IDS } = require('../pgp-keyservers.cjs');
|
||||
|
||||
function pgpFailure(error) {
|
||||
return {
|
||||
failed: true,
|
||||
@@ -207,12 +209,12 @@ function registerPgpIpcHandlers({
|
||||
});
|
||||
registerIpcHandler('pgp:key-servers', async () => {
|
||||
const settings = await pgpKeys.getSettings();
|
||||
return listServers(settings.customKeyServers, settings.enabledKeyServers);
|
||||
return listServers(settings.customKeyServers, settings.enabledKeyServers, settings.removedBuiltinKeyServers);
|
||||
});
|
||||
registerIpcHandler('pgp:set-key-server-enabled', async (_event, input) => {
|
||||
if (typeof input?.enabled !== 'boolean') throw new Error('Choose whether to enable or disable this key server.');
|
||||
const settings = await pgpKeys.getSettings();
|
||||
const servers = listServers(settings.customKeyServers, settings.enabledKeyServers);
|
||||
const servers = listServers(settings.customKeyServers, settings.enabledKeyServers, settings.removedBuiltinKeyServers);
|
||||
const serverId = String(input?.serverId || '');
|
||||
if (!servers.some(server => server.id === serverId)) throw new Error('That key server was not found.');
|
||||
const enabled = new Set(settings.enabledKeyServers);
|
||||
@@ -221,7 +223,8 @@ function registerPgpIpcHandlers({
|
||||
await pgpKeys.setSettings({
|
||||
cacheMinutes: settings.cacheMinutes,
|
||||
customKeyServers: settings.customKeyServers,
|
||||
enabledKeyServers: [...enabled]
|
||||
enabledKeyServers: [...enabled],
|
||||
removedBuiltinKeyServers: settings.removedBuiltinKeyServers
|
||||
});
|
||||
return { serverId, enabled: input.enabled };
|
||||
});
|
||||
@@ -256,23 +259,25 @@ function registerPgpIpcHandlers({
|
||||
const id = String(serverId || '');
|
||||
const settings = await pgpKeys.getSettings();
|
||||
const customServers = settings.customKeyServers.filter(server => server.id !== id);
|
||||
if (customServers.length === settings.customKeyServers.length) throw new Error('That custom key server was not found.');
|
||||
const removesBuiltin = BUILTIN_SERVER_IDS.includes(id) && !settings.removedBuiltinKeyServers.includes(id);
|
||||
if (customServers.length === settings.customKeyServers.length && !removesBuiltin) throw new Error('That key server was not found.');
|
||||
await pgpKeys.setSettings({
|
||||
cacheMinutes: settings.cacheMinutes,
|
||||
customKeyServers,
|
||||
customKeyServers: customServers,
|
||||
removedBuiltinKeyServers: removesBuiltin ? [...settings.removedBuiltinKeyServers, id] : settings.removedBuiltinKeyServers,
|
||||
enabledKeyServers: settings.enabledKeyServers.filter(enabledId => enabledId !== id)
|
||||
});
|
||||
return { removed: true };
|
||||
});
|
||||
registerIpcHandler('pgp:find-key', async (_event, input) => {
|
||||
const settings = await pgpKeys.getSettings();
|
||||
const servers = listServers(settings.customKeyServers, settings.enabledKeyServers);
|
||||
const servers = listServers(settings.customKeyServers, settings.enabledKeyServers, settings.removedBuiltinKeyServers);
|
||||
return pgpKeyServers.lookupEnabled(servers, input?.email);
|
||||
});
|
||||
registerIpcHandler('pgp:publish-key', async (event, input) => {
|
||||
const fingerprint = pgpFingerprint(input?.fingerprint);
|
||||
const settings = await pgpKeys.getSettings();
|
||||
const server = listServers(settings.customKeyServers, settings.enabledKeyServers).find(item => item.id === String(input?.serverId || ''));
|
||||
const server = listServers(settings.customKeyServers, settings.enabledKeyServers, settings.removedBuiltinKeyServers).find(item => item.id === String(input?.serverId || ''));
|
||||
if (!server) throw new Error('Choose a configured key server.');
|
||||
if (!server.enabled) throw new Error('Enable the selected key server before publishing to it.');
|
||||
const entry = (await pgpKeys.list()).find(key => key.fingerprint === fingerprint);
|
||||
|
||||
@@ -7,8 +7,10 @@ const MAX_CUSTOM_SERVERS = 10;
|
||||
|
||||
const BUILTIN_SERVERS = [
|
||||
{ id: 'openpgp-vks', name: 'keys.openpgp.org', url: 'https://keys.openpgp.org', protocol: 'vks', builtin: true },
|
||||
{ id: 'mailvelope-hkp', name: 'keys.mailvelope.com', url: 'https://keys.mailvelope.com', protocol: 'hkp', builtin: true }
|
||||
{ id: 'mailvelope-hkp', name: 'keys.mailvelope.com', url: 'https://keys.mailvelope.com', protocol: 'hkp', builtin: true },
|
||||
{ id: 'eternity-vks', name: 'keys.eternityproject.fi', url: 'https://keys.eternityproject.fi', protocol: 'vks', builtin: true }
|
||||
];
|
||||
const BUILTIN_SERVER_IDS = BUILTIN_SERVERS.map(server => server.id);
|
||||
|
||||
function normalizeBaseUrl(value) {
|
||||
const raw = String(value || '').trim();
|
||||
@@ -40,10 +42,11 @@ function normalizeCustomServer(input) {
|
||||
};
|
||||
}
|
||||
|
||||
function listServers(customServers = [], enabledServerIds = []) {
|
||||
function listServers(customServers = [], enabledServerIds = [], removedBuiltinIds = []) {
|
||||
const enabled = new Set(enabledServerIds);
|
||||
const removed = new Set(removedBuiltinIds);
|
||||
return [
|
||||
...BUILTIN_SERVERS.map(server => ({ ...server, enabled: enabled.has(server.id) })),
|
||||
...BUILTIN_SERVERS.filter(server => !removed.has(server.id)).map(server => ({ ...server, enabled: enabled.has(server.id) })),
|
||||
...customServers.map(server => {
|
||||
const normalized = normalizeCustomServer(server);
|
||||
return { ...normalized, enabled: enabled.has(normalized.id) };
|
||||
@@ -72,14 +75,17 @@ async function readResponseText(response) {
|
||||
const chunks = [];
|
||||
let length = 0;
|
||||
for await (const chunk of response.body) {
|
||||
const bytes = Buffer.from(chunk);
|
||||
const bytes = typeof chunk === 'string' ? new TextEncoder().encode(chunk) : chunk;
|
||||
length += bytes.length;
|
||||
if (length > MAX_RESPONSE_BYTES) {
|
||||
throw new Error('The key server response is too large.');
|
||||
}
|
||||
chunks.push(bytes);
|
||||
}
|
||||
return Buffer.concat(chunks, length).toString('utf8');
|
||||
const joined = new Uint8Array(length);
|
||||
let offset = 0;
|
||||
for (const bytes of chunks) { joined.set(bytes, offset); offset += bytes.length; }
|
||||
return new TextDecoder().decode(joined);
|
||||
}
|
||||
|
||||
function createKeyServerService({ fetchImpl = globalThis.fetch } = {}) {
|
||||
@@ -269,6 +275,7 @@ function createKeyServerService({ fetchImpl = globalThis.fetch } = {}) {
|
||||
|
||||
module.exports = {
|
||||
BUILTIN_SERVERS,
|
||||
BUILTIN_SERVER_IDS,
|
||||
MAX_CUSTOM_SERVERS,
|
||||
createKeyServerService,
|
||||
listServers,
|
||||
|
||||
@@ -198,11 +198,14 @@ function createKeyStore(storage) {
|
||||
customKeyServers: Array.isArray(settings.customKeyServers) ? settings.customKeyServers : [],
|
||||
enabledKeyServers: Array.isArray(settings.enabledKeyServers)
|
||||
? [...new Set(settings.enabledKeyServers.filter(id => typeof id === 'string'))]
|
||||
: [],
|
||||
removedBuiltinKeyServers: Array.isArray(settings.removedBuiltinKeyServers)
|
||||
? [...new Set(settings.removedBuiltinKeyServers.filter(id => typeof id === 'string'))]
|
||||
: []
|
||||
};
|
||||
},
|
||||
|
||||
async setSettings({ cacheMinutes, customKeyServers, enabledKeyServers }) {
|
||||
async setSettings({ cacheMinutes, customKeyServers, enabledKeyServers, removedBuiltinKeyServers }) {
|
||||
const minutes = Number(cacheMinutes);
|
||||
if (!Number.isFinite(minutes) || minutes < 0 || minutes > 1440) throw new Error('Choose between 0 and 1440 minutes.');
|
||||
const data = await read();
|
||||
@@ -224,11 +227,18 @@ function createKeyStore(storage) {
|
||||
}
|
||||
data.settings.enabledKeyServers = [...new Set(enabledKeyServers)];
|
||||
}
|
||||
if (removedBuiltinKeyServers !== undefined) {
|
||||
if (!Array.isArray(removedBuiltinKeyServers) || removedBuiltinKeyServers.length > 12 || removedBuiltinKeyServers.some(id => typeof id !== 'string' || !id.trim())) {
|
||||
throw new Error('Choose no more than 12 valid built-in key servers to remove.');
|
||||
}
|
||||
data.settings.removedBuiltinKeyServers = [...new Set(removedBuiltinKeyServers)];
|
||||
}
|
||||
await storage.save(data);
|
||||
return {
|
||||
cacheMinutes: data.settings.cacheMinutes,
|
||||
customKeyServers: Array.isArray(data.settings.customKeyServers) ? data.settings.customKeyServers : [],
|
||||
enabledKeyServers: Array.isArray(data.settings.enabledKeyServers) ? [...data.settings.enabledKeyServers] : []
|
||||
enabledKeyServers: Array.isArray(data.settings.enabledKeyServers) ? [...data.settings.enabledKeyServers] : [],
|
||||
removedBuiltinKeyServers: Array.isArray(data.settings.removedBuiltinKeyServers) ? [...data.settings.removedBuiltinKeyServers] : []
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ep-mail",
|
||||
"version": "0.5.20",
|
||||
"version": "0.5.22",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ep-mail",
|
||||
"version": "0.5.20",
|
||||
"version": "0.5.22",
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^8.5.2",
|
||||
"@capacitor/core": "^8.5.2",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ep-mail",
|
||||
"version": "0.5.20",
|
||||
"version": "0.5.22",
|
||||
"private": true,
|
||||
"description": "Eternity Project mail client",
|
||||
"homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client",
|
||||
|
||||
@@ -19,9 +19,7 @@ function openEncryptionKeys() {
|
||||
const root = selectPgpKeyUi('#modal-root');
|
||||
const account = window.epMailFeatures.mail.connectedAccount || {};
|
||||
const androidPgp = window.daybreakMail?.pgp?.platform === 'android';
|
||||
const serverSettings = androidPgp
|
||||
? '<h3 class="pgp-heading">Public key servers</h3><p class="account-note">Key-server lookup and publication are disabled in Android testing. Import a public key directly and compare its fingerprint with the owner.</p><div hidden><div id="pgp-server-list"></div><input id="pgp-search-email"><button id="pgp-find-key"></button><div id="pgp-found-keys"></div><select id="pgp-publish-server"></select><input id="pgp-server-name"><input id="pgp-server-url"><select id="pgp-server-protocol"></select><button id="pgp-add-server"></button></div>'
|
||||
: `<h3 class="pgp-heading">Public key servers</h3>
|
||||
const serverSettings = `<h3 class="pgp-heading">Public key servers</h3>
|
||||
<p class="account-note">Servers are disabled by default. Enable the servers you want to use; searching checks every enabled server, which can learn which email address you searched for. Discovered keys remain unverified until you check their fingerprints independently.</p>
|
||||
<div id="pgp-server-list" class="attachment-list">Loading key servers…</div>
|
||||
<label class="compose-line"><span>Email address</span><input id="pgp-search-email" type="email" value="${escapePgpKeyUi(account.email || '')}"></label>
|
||||
@@ -359,7 +357,6 @@ function openEncryptionKeys() {
|
||||
};
|
||||
enabledLabel.append(enabledText, enabled);
|
||||
row.append(info, enabledLabel);
|
||||
if (!server.builtin) {
|
||||
const remove = document.createElement('button');
|
||||
remove.className = 'discard';
|
||||
remove.textContent = 'Remove';
|
||||
@@ -367,11 +364,10 @@ function openEncryptionKeys() {
|
||||
try {
|
||||
await window.daybreakMail.pgp.removeKeyServer(server.id);
|
||||
await renderKeyServers();
|
||||
status('Custom key server removed.');
|
||||
status(`${server.name} removed.`);
|
||||
} catch (error) { status(error.message || 'Could not remove the key server.'); }
|
||||
};
|
||||
row.append(remove);
|
||||
}
|
||||
list.append(row);
|
||||
});
|
||||
}
|
||||
@@ -451,13 +447,13 @@ function openEncryptionKeys() {
|
||||
catch (error) { status(error.message || 'Could not save the setting.'); }
|
||||
};
|
||||
selectPgpKeyUi('#pgp-forget').onclick = async () => { await window.daybreakMail.pgp.forgetPassphrases(); status('Remembered passphrases were cleared.'); };
|
||||
if (!androidPgp) void renderKeyServers();
|
||||
void renderKeyServers();
|
||||
void renderContacts();
|
||||
void render();
|
||||
}
|
||||
|
||||
window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => function () {
|
||||
baseOpenPreferences();
|
||||
window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => async function () {
|
||||
await baseOpenPreferences();
|
||||
const fields = selectPgpKeyUi('#modal-root .compose-fields');
|
||||
if (!fields || !pgpAvailable()) return;
|
||||
const button = document.createElement('button');
|
||||
|
||||
+5564
-4942
File diff suppressed because one or more lines are too long
@@ -1,8 +1,23 @@
|
||||
import { Capacitor, registerPlugin } from '@capacitor/core';
|
||||
import { Capacitor, CapacitorHttp, registerPlugin } from '@capacitor/core';
|
||||
import { createAndroidPgp } from './android-pgp.js';
|
||||
|
||||
const EpMail = registerPlugin('EpMail');
|
||||
|
||||
// Native HTTP avoids WebView CORS limits; redirects are refused like on desktop.
|
||||
async function nativeFetch(url, options = {}) {
|
||||
const headers = options.headers || {};
|
||||
const contentType = String(headers['content-type'] || '');
|
||||
let data = options.body;
|
||||
if (typeof data === 'string' && contentType.includes('json')) data = JSON.parse(data);
|
||||
else if (typeof data === 'string' && contentType.includes('x-www-form-urlencoded')) data = Object.fromEntries(new URLSearchParams(data));
|
||||
const response = await CapacitorHttp.request({ url: String(url), method: options.method || 'GET', headers, data,
|
||||
responseType: 'text', disableRedirects: true, connectTimeout: 15000, readTimeout: 15000 });
|
||||
const text = typeof response.data === 'string' ? response.data : JSON.stringify(response.data ?? '');
|
||||
const lowered = Object.fromEntries(Object.entries(response.headers || {}).map(([name, value]) => [name.toLowerCase(), value]));
|
||||
return { status: response.status, ok: response.status >= 200 && response.status < 300,
|
||||
headers: { get: name => lowered[String(name).toLowerCase()] ?? null }, body: [new TextEncoder().encode(text)] };
|
||||
}
|
||||
|
||||
if (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'android') {
|
||||
const daybreakMail = {
|
||||
platform: 'android',
|
||||
@@ -63,6 +78,6 @@ if (Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'android') {
|
||||
davSaveContact: contact => EpMail.davSaveContact(contact),
|
||||
davDeleteContact: remote => EpMail.davDeleteContact(remote)
|
||||
};
|
||||
daybreakMail.pgp = createAndroidPgp({ EpMail, getAccount: () => EpMail.getAccount() });
|
||||
daybreakMail.pgp = createAndroidPgp({ EpMail, getAccount: () => EpMail.getAccount(), fetchImpl: nativeFetch });
|
||||
window.daybreakMail = daybreakMail;
|
||||
}
|
||||
|
||||
+70
-8
@@ -1,4 +1,7 @@
|
||||
import * as openpgp from 'openpgp';
|
||||
import keyServers from '../desktop/pgp-keyservers.cjs';
|
||||
|
||||
const { BUILTIN_SERVER_IDS, MAX_CUSTOM_SERVERS, createKeyServerService, listServers, normalizeCustomServer } = keyServers;
|
||||
|
||||
const MAX_KEY_LENGTH = 200000;
|
||||
const MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
||||
@@ -255,8 +258,19 @@ async function signatureStatuses(signatures, verification, sender) {
|
||||
return results;
|
||||
}
|
||||
|
||||
export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.confirm }) {
|
||||
export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.confirm, fetchImpl }) {
|
||||
const keyServerService = createKeyServerService({ fetchImpl });
|
||||
let storePromise;
|
||||
function serverSettings(data) {
|
||||
const settings = data.settings || {};
|
||||
const ids = value => Array.isArray(value) ? [...new Set(value.filter(id => typeof id === 'string'))] : [];
|
||||
return { ...settings, customKeyServers: Array.isArray(settings.customKeyServers) ? settings.customKeyServers : [],
|
||||
enabledKeyServers: ids(settings.enabledKeyServers), removedBuiltinKeyServers: ids(settings.removedBuiltinKeyServers) };
|
||||
}
|
||||
function currentServers(data) {
|
||||
const settings = serverSettings(data);
|
||||
return listServers(settings.customKeyServers, settings.enabledKeyServers, settings.removedBuiltinKeyServers);
|
||||
}
|
||||
const passphrases = new Map();
|
||||
let cacheMinutes = 10;
|
||||
|
||||
@@ -310,7 +324,7 @@ export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.conf
|
||||
}
|
||||
const user = await key.getPrimaryUser();
|
||||
data.contacts.push({ fingerprint, name: user.user.userID?.name || '', emails, trust: 'unknown',
|
||||
source: ['import', 'message', 'paste'].includes(source) ? source : 'import', addedAt: Date.now(), publicKey: key.armor() });
|
||||
source: ['import', 'message', 'paste', 'keyserver'].includes(source) ? source : 'import', addedAt: Date.now(), publicKey: key.armor() });
|
||||
await persist(data);
|
||||
return { contact: { fingerprint, name: user.user.userID?.name || '', emails, trust: 'unknown', source, addedAt: Date.now() }, keyChangedFrom };
|
||||
}
|
||||
@@ -607,12 +621,60 @@ export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.conf
|
||||
return { cacheMinutes };
|
||||
},
|
||||
async forgetPassphrases() { clear(); return { cleared: true }; },
|
||||
async keyServers() { return []; },
|
||||
async findKey() { throw new Error('Key-server lookup is not included in Android testing. Import a public key directly.'); },
|
||||
async addKeyServer() { throw new Error('Key-server support is not included in Android testing.'); },
|
||||
async removeKeyServer() { throw new Error('Key-server support is not included in Android testing.'); },
|
||||
async setKeyServerEnabled() { throw new Error('Key-server support is not included in Android testing.'); },
|
||||
async publishKey() { throw new Error('Key-server support is not included in Android testing.'); },
|
||||
async keyServers() { return currentServers(await store()); },
|
||||
async findKey({ email } = {}) { return keyServerService.lookupEnabled(currentServers(await store()), email); },
|
||||
async addKeyServer(input) {
|
||||
const candidate = normalizeCustomServer(input);
|
||||
const data = await store();
|
||||
const settings = serverSettings(data);
|
||||
const custom = settings.customKeyServers.map(normalizeCustomServer);
|
||||
if (custom.length >= MAX_CUSTOM_SERVERS) throw new Error(`You can configure up to ${MAX_CUSTOM_SERVERS} custom key servers.`);
|
||||
if (currentServers(data).some(server => server.url === candidate.url && server.protocol === candidate.protocol)) throw new Error('That key server is already configured.');
|
||||
const host = new URL(candidate.url).host;
|
||||
if (!confirm(`Allow ep-mail to contact ${host} for OpenPGP keys?\n\nProtocol: ${candidate.protocol.toUpperCase()}\nThe server may learn which email addresses you search for. Only add a server you trust.`)) return { canceled: true };
|
||||
candidate.id = crypto.randomUUID();
|
||||
data.settings = { ...serverSettings(data), customKeyServers: [...custom, candidate] };
|
||||
await persist(data);
|
||||
return { server: candidate };
|
||||
},
|
||||
async removeKeyServer(serverId) {
|
||||
const id = String(serverId || '');
|
||||
const data = await store();
|
||||
const settings = serverSettings(data);
|
||||
const custom = settings.customKeyServers.filter(server => server.id !== id);
|
||||
const removesBuiltin = BUILTIN_SERVER_IDS.includes(id) && !settings.removedBuiltinKeyServers.includes(id);
|
||||
if (custom.length === settings.customKeyServers.length && !removesBuiltin) throw new Error('That key server was not found.');
|
||||
data.settings = { ...settings, customKeyServers: custom,
|
||||
enabledKeyServers: settings.enabledKeyServers.filter(enabledId => enabledId !== id),
|
||||
removedBuiltinKeyServers: removesBuiltin ? [...settings.removedBuiltinKeyServers, id] : settings.removedBuiltinKeyServers };
|
||||
await persist(data);
|
||||
return { removed: true };
|
||||
},
|
||||
async setKeyServerEnabled(serverId, enabled) {
|
||||
if (typeof enabled !== 'boolean') throw new Error('Choose whether to enable or disable this key server.');
|
||||
const id = String(serverId || '');
|
||||
const data = await store();
|
||||
if (!currentServers(data).some(server => server.id === id)) throw new Error('That key server was not found.');
|
||||
const settings = serverSettings(data);
|
||||
const next = new Set(settings.enabledKeyServers);
|
||||
if (enabled) next.add(id); else next.delete(id);
|
||||
data.settings = { ...settings, enabledKeyServers: [...next] };
|
||||
await persist(data);
|
||||
return { serverId: id, enabled };
|
||||
},
|
||||
async publishKey({ fingerprint, serverId } = {}) {
|
||||
const data = await store();
|
||||
const server = currentServers(data).find(item => item.id === String(serverId || ''));
|
||||
if (!server) throw new Error('Choose a configured key server.');
|
||||
if (!server.enabled) throw new Error('Enable the selected key server before publishing to it.');
|
||||
const entry = data.keys.find(item => item.fingerprint === fingerprint);
|
||||
if (!entry) throw new Error('That key was not found.');
|
||||
if (!entry.email) throw new Error('This key has no email address to publish.');
|
||||
const publicKey = await openpgp.readKey({ armoredKey: entry.publicKey });
|
||||
if (!emailsOf(publicKey).includes(String(entry.email).toLowerCase())) throw new Error('The selected key no longer matches its stored email address.');
|
||||
if (!confirm(`Publish the public key for ${entry.email} to ${server.name}?\n\nFingerprint:\n${fingerprint.match(/.{1,4}/g).join(' ')}\n\nOnly the public key will be sent. This exposes the email address in the key to the server, which may retain it. The server may send a verification email before the key becomes searchable.`)) return { canceled: true };
|
||||
return keyServerService.publish(server, entry.email, entry.publicKey, fingerprint);
|
||||
},
|
||||
clearPassphrases: clear,
|
||||
buildOutgoing
|
||||
};
|
||||
|
||||
+2
-2
@@ -65,8 +65,8 @@ document.addEventListener('keydown', event => {
|
||||
action.run();
|
||||
});
|
||||
|
||||
shortcutProductivityUi.wrapOpenPreferences(baseOpenPreferences => function () {
|
||||
baseOpenPreferences();
|
||||
shortcutProductivityUi.wrapOpenPreferences(baseOpenPreferences => async function () {
|
||||
await baseOpenPreferences();
|
||||
const fields = selectShortcutUi('#modal-root .compose-fields');
|
||||
const save = selectShortcutUi('#save-appearance');
|
||||
if (!fields || !save) return;
|
||||
|
||||
+5
-3
@@ -114,7 +114,7 @@ body.ep-daylight .compose-line input::placeholder,body.ep-daylight .compose-body
|
||||
body.ep-daylight .modal-close,body.ep-daylight .discard{color:#59706b}
|
||||
body.ep-daylight .toast{background:#11212b;color:#f1f1e9}
|
||||
body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
.compose-modal{max-height:90vh;display:flex;flex-direction:column}.compose-fields{min-height:0;flex:1 1 auto;overflow-y:auto}
|
||||
.compose-modal{max-height:90vh;display:flex;flex-direction:column}.compose-modal>.modal-head,.compose-modal>.compose-footer{flex:none}.compose-fields{min-height:0;flex:0 1 auto;overflow-y:auto}.compose-modal>.compose-body{flex:1 1 120px;min-height:90px;height:auto}
|
||||
.snooze-options .outline-button{width:100%;text-align:left}
|
||||
.mail-rules{padding:10px 0;border-bottom:1px solid var(--line)}.mail-rule-row{display:grid;grid-template-columns:1fr 1fr 120px 1fr auto;gap:6px;align-items:center;padding:5px 0}.mail-rule-row input,.mail-rule-row select{box-sizing:border-box;min-width:0;width:100%;padding:7px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--text);font-size:10px}.mail-rule-row input:disabled{opacity:.55}.mail-rule-row .discard{white-space:nowrap}
|
||||
@media(max-width:650px){.mail-rule-row{grid-template-columns:1fr 1fr}.mail-rule-row .mail-rule-action,.mail-rule-row .mail-rule-value{grid-column:auto}}
|
||||
@@ -199,8 +199,10 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
.compose-line input[type=checkbox]{flex:0 0 auto;width:20px;height:20px}
|
||||
.compose-line span{flex:0 1 54%;line-height:1.25}
|
||||
.compose-line input:not([type=checkbox]){flex:1;max-width:100%;min-width:0}
|
||||
.compose-footer{gap:8px;padding:10px 12px}
|
||||
.compose-body{height:30vh;padding:12px}
|
||||
.compose-footer{gap:8px;padding:10px 12px;flex-wrap:wrap;justify-content:flex-end}
|
||||
.compose-footer .pgp-compose{flex:1 0 100%;flex-wrap:wrap;margin-right:0;gap:4px 12px}
|
||||
.compose-footer .send-button{order:99;padding:10px 18px;font-size:12px}
|
||||
.compose-body{padding:12px}
|
||||
.account-note,.account-status{font-size:12px}
|
||||
.mail-rule-row{grid-template-columns:1fr;gap:6px}
|
||||
.mail-rule-row>*{grid-column:1}
|
||||
|
||||
@@ -52,8 +52,11 @@ test('all built-in and custom key servers start disabled', () => {
|
||||
url: 'https://keys.example.org',
|
||||
protocol: 'hkp'
|
||||
}]);
|
||||
assert.equal(servers.length, 3);
|
||||
assert.equal(servers.length, 4);
|
||||
assert.ok(servers.some(server => server.id === 'eternity-vks' && server.url === 'https://keys.eternityproject.fi' && server.protocol === 'vks'));
|
||||
assert.ok(servers.every(server => server.enabled === false));
|
||||
const trimmed = listServers([], [], ['openpgp-vks', 'mailvelope-hkp']);
|
||||
assert.deepEqual(trimmed.map(server => server.id), ['eternity-vks']);
|
||||
const enabled = listServers([], ['openpgp-vks']);
|
||||
assert.equal(enabled.find(server => server.id === 'openpgp-vks').enabled, true);
|
||||
assert.equal(enabled.find(server => server.id === 'mailvelope-hkp').enabled, false);
|
||||
|
||||
@@ -195,7 +195,7 @@ test('keyring: contacts, trust levels, expired passphrase cache and settings', a
|
||||
await assert.rejects(async () => alice.keyStore.addContact({ armoredKey: await bob.keyStore.exportPublic(bob.key.fingerprint) }), /already/);
|
||||
await assert.rejects(async () => alice.keyStore.addContact({ armoredKey: await bob.keyStore.exportPrivate(bob.key.fingerprint, bob.passphrase) }), /private key/);
|
||||
await assert.rejects(() => alice.keyStore.addContact({ armoredKey: 'junk' }), /valid OpenPGP/);
|
||||
assert.deepEqual(await alice.keyStore.getSettings(), { cacheMinutes: 10, customKeyServers: [], enabledKeyServers: [] });
|
||||
assert.deepEqual(await alice.keyStore.getSettings(), { cacheMinutes: 10, customKeyServers: [], enabledKeyServers: [], removedBuiltinKeyServers: [] });
|
||||
const customServer = { id: 'custom', name: 'Example', url: 'https://keys.example.org/', protocol: 'hkp' };
|
||||
await alice.keyStore.setSettings({ cacheMinutes: 0, customKeyServers: [customServer], enabledKeyServers: ['custom', 'openpgp-vks'] });
|
||||
assert.equal((await alice.keyStore.getSettings()).cacheMinutes, 0);
|
||||
|
||||
+5
-9
@@ -19,9 +19,7 @@ function openEncryptionKeys() {
|
||||
const root = selectPgpKeyUi('#modal-root');
|
||||
const account = window.epMailFeatures.mail.connectedAccount || {};
|
||||
const androidPgp = window.daybreakMail?.pgp?.platform === 'android';
|
||||
const serverSettings = androidPgp
|
||||
? '<h3 class="pgp-heading">Public key servers</h3><p class="account-note">Key-server lookup and publication are disabled in Android testing. Import a public key directly and compare its fingerprint with the owner.</p><div hidden><div id="pgp-server-list"></div><input id="pgp-search-email"><button id="pgp-find-key"></button><div id="pgp-found-keys"></div><select id="pgp-publish-server"></select><input id="pgp-server-name"><input id="pgp-server-url"><select id="pgp-server-protocol"></select><button id="pgp-add-server"></button></div>'
|
||||
: `<h3 class="pgp-heading">Public key servers</h3>
|
||||
const serverSettings = `<h3 class="pgp-heading">Public key servers</h3>
|
||||
<p class="account-note">Servers are disabled by default. Enable the servers you want to use; searching checks every enabled server, which can learn which email address you searched for. Discovered keys remain unverified until you check their fingerprints independently.</p>
|
||||
<div id="pgp-server-list" class="attachment-list">Loading key servers…</div>
|
||||
<label class="compose-line"><span>Email address</span><input id="pgp-search-email" type="email" value="${escapePgpKeyUi(account.email || '')}"></label>
|
||||
@@ -359,7 +357,6 @@ function openEncryptionKeys() {
|
||||
};
|
||||
enabledLabel.append(enabledText, enabled);
|
||||
row.append(info, enabledLabel);
|
||||
if (!server.builtin) {
|
||||
const remove = document.createElement('button');
|
||||
remove.className = 'discard';
|
||||
remove.textContent = 'Remove';
|
||||
@@ -367,11 +364,10 @@ function openEncryptionKeys() {
|
||||
try {
|
||||
await window.daybreakMail.pgp.removeKeyServer(server.id);
|
||||
await renderKeyServers();
|
||||
status('Custom key server removed.');
|
||||
status(`${server.name} removed.`);
|
||||
} catch (error) { status(error.message || 'Could not remove the key server.'); }
|
||||
};
|
||||
row.append(remove);
|
||||
}
|
||||
list.append(row);
|
||||
});
|
||||
}
|
||||
@@ -451,13 +447,13 @@ function openEncryptionKeys() {
|
||||
catch (error) { status(error.message || 'Could not save the setting.'); }
|
||||
};
|
||||
selectPgpKeyUi('#pgp-forget').onclick = async () => { await window.daybreakMail.pgp.forgetPassphrases(); status('Remembered passphrases were cleared.'); };
|
||||
if (!androidPgp) void renderKeyServers();
|
||||
void renderKeyServers();
|
||||
void renderContacts();
|
||||
void render();
|
||||
}
|
||||
|
||||
window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => function () {
|
||||
baseOpenPreferences();
|
||||
window.epMailFeatures.productivity.wrapOpenPreferences(baseOpenPreferences => async function () {
|
||||
await baseOpenPreferences();
|
||||
const fields = selectPgpKeyUi('#modal-root .compose-fields');
|
||||
if (!fields || !pgpAvailable()) return;
|
||||
const button = document.createElement('button');
|
||||
|
||||
+5564
-4942
File diff suppressed because one or more lines are too long
+2
-2
@@ -65,8 +65,8 @@ document.addEventListener('keydown', event => {
|
||||
action.run();
|
||||
});
|
||||
|
||||
shortcutProductivityUi.wrapOpenPreferences(baseOpenPreferences => function () {
|
||||
baseOpenPreferences();
|
||||
shortcutProductivityUi.wrapOpenPreferences(baseOpenPreferences => async function () {
|
||||
await baseOpenPreferences();
|
||||
const fields = selectShortcutUi('#modal-root .compose-fields');
|
||||
const save = selectShortcutUi('#save-appearance');
|
||||
if (!fields || !save) return;
|
||||
|
||||
+5
-3
@@ -114,7 +114,7 @@ body.ep-daylight .compose-line input::placeholder,body.ep-daylight .compose-body
|
||||
body.ep-daylight .modal-close,body.ep-daylight .discard{color:#59706b}
|
||||
body.ep-daylight .toast{background:#11212b;color:#f1f1e9}
|
||||
body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
.compose-modal{max-height:90vh;display:flex;flex-direction:column}.compose-fields{min-height:0;flex:1 1 auto;overflow-y:auto}
|
||||
.compose-modal{max-height:90vh;display:flex;flex-direction:column}.compose-modal>.modal-head,.compose-modal>.compose-footer{flex:none}.compose-fields{min-height:0;flex:0 1 auto;overflow-y:auto}.compose-modal>.compose-body{flex:1 1 120px;min-height:90px;height:auto}
|
||||
.snooze-options .outline-button{width:100%;text-align:left}
|
||||
.mail-rules{padding:10px 0;border-bottom:1px solid var(--line)}.mail-rule-row{display:grid;grid-template-columns:1fr 1fr 120px 1fr auto;gap:6px;align-items:center;padding:5px 0}.mail-rule-row input,.mail-rule-row select{box-sizing:border-box;min-width:0;width:100%;padding:7px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--text);font-size:10px}.mail-rule-row input:disabled{opacity:.55}.mail-rule-row .discard{white-space:nowrap}
|
||||
@media(max-width:650px){.mail-rule-row{grid-template-columns:1fr 1fr}.mail-rule-row .mail-rule-action,.mail-rule-row .mail-rule-value{grid-column:auto}}
|
||||
@@ -199,8 +199,10 @@ body.ep-daylight .row-check:checked{accent-color:#526a2c}
|
||||
.compose-line input[type=checkbox]{flex:0 0 auto;width:20px;height:20px}
|
||||
.compose-line span{flex:0 1 54%;line-height:1.25}
|
||||
.compose-line input:not([type=checkbox]){flex:1;max-width:100%;min-width:0}
|
||||
.compose-footer{gap:8px;padding:10px 12px}
|
||||
.compose-body{height:30vh;padding:12px}
|
||||
.compose-footer{gap:8px;padding:10px 12px;flex-wrap:wrap;justify-content:flex-end}
|
||||
.compose-footer .pgp-compose{flex:1 0 100%;flex-wrap:wrap;margin-right:0;gap:4px 12px}
|
||||
.compose-footer .send-button{order:99;padding:10px 18px;font-size:12px}
|
||||
.compose-body{padding:12px}
|
||||
.account-note,.account-status{font-size:12px}
|
||||
.mail-rule-row{grid-template-columns:1fr;gap:6px}
|
||||
.mail-rule-row>*{grid-column:1}
|
||||
|
||||
Reference in New Issue
Block a user