Improve Android OpenPGP, drafts and release builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-11-17 22:11:05 +02:00
co-authored by Copilot
parent d0e2ce26bc
commit 96c7b6966b
28 changed files with 747 additions and 187 deletions
+9 -2
View File
@@ -537,8 +537,15 @@ export function createAndroidPgp({ EpMail, getAccount, confirm = globalThis.conf
await persist(data);
return { key: publicInfo(entry), revocationCertificate: generated.revocationCertificate };
},
async importKey({ armoredKey, passphrase, accountId = null }) {
if (!armoredKey) armoredKey = prompt('Paste an ASCII-armored OpenPGP private key (up to 200 KB):') || '';
async importKey({ armoredKey, passphrase, accountId = null, source = 'paste' }) {
if (!armoredKey && source === 'file') {
const selected = await EpMail.pickPgpPrivateKey();
if (selected.canceled) return { canceled: true };
armoredKey = selected.armoredKey;
if (typeof armoredKey !== 'string' || !armoredKey.trim()) throw new Error('That key file is empty.');
} else if (!armoredKey) {
armoredKey = prompt('Paste an ASCII-armored OpenPGP private key (up to 200 KB):') || '';
}
const armored = String(armoredKey).trim();
if (!armored || armored.length > MAX_KEY_LENGTH) throw new Error('That key file is empty or too large.');
if (typeof passphrase !== 'string' || passphrase.length < 8) throw new Error('Use a passphrase of at least 8 characters.');
+16 -13
View File
@@ -1,19 +1,22 @@
# Builds the Android APK and the Windows portable exe into .\release
param(
[string]$WslDistribution
)
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot\..
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
if (-not $env:JAVA_HOME) { $env:JAVA_HOME = 'C:\Program Files\Android\Android Studio\jbr' }
if (-not $env:ANDROID_HOME) { $env:ANDROID_HOME = Join-Path $env:LOCALAPPDATA 'Android\Sdk' }
New-Item -ItemType Directory -Force release | Out-Null
Write-Host "== Building APK $version =="
npm run android:apk
if ($LASTEXITCODE) { throw 'APK build failed' }
Copy-Item android\app\build\outputs\apk\debug\app-debug.apk "release\ep-mail $version.apk" -Force
& "$PSScriptRoot\build.ps1"
Write-Host "== Building portable exe $version =="
npm run dist:win:portable
if ($LASTEXITCODE) { throw 'Portable build failed' }
Write-Host "`n== Building Windows installer $version =="
npm run dist:win:installer
if ($LASTEXITCODE) { throw 'Windows installer build failed' }
Write-Host "`nDone:"
Get-ChildItem release | Where-Object { $_.Name -like "ep-mail $version.*" } | ForEach-Object { " $($_.FullName)" }
Write-Host "`n== Building Linux AppImage and deb $version in WSL =="
$wslArguments = @()
if ($WslDistribution) { $wslArguments += @('--distribution', $WslDistribution) }
$wslArguments += @('--exec', 'bash', './scripts/build-linux-wsl.sh')
& wsl.exe @wslArguments
if ($LASTEXITCODE) { throw 'WSL Linux build failed' }
Write-Host "`nAll platform builds completed for $version. Artifacts are in release\."
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
source_dir="$(pwd -P)"
if [[ ! -f "$source_dir/package.json" || ! -f "$source_dir/package-lock.json" ]]; then
echo "Run this script from the project root." >&2
exit 1
fi
work_dir="$(mktemp -d "${TMPDIR:-/tmp}/ep-mail-linux-build.XXXXXXXX")"
trap 'rm -rf -- "$work_dir"' EXIT
echo "Copying sources to an isolated Linux workspace..."
tar -C "$source_dir" --exclude='./.git' --exclude='./node_modules' \
--exclude='./release' --exclude='./dist' --exclude='./android' --exclude='./www' \
-cf - . | tar -C "$work_dir" -xf -
cd "$work_dir"
echo "Installing Linux dependencies from package-lock.json..."
npm ci
version="$(node -p "require('./package.json').version")"
echo "Building Linux packages for $version..."
npm run dist:linux
shopt -s nullglob
appimages=(release/ep-mail-"$version"*.AppImage)
debs=(release/ep-mail_"$version"_*.deb)
if (( ${#appimages[@]} != 1 || ${#debs[@]} != 1 )); then
echo "Expected exactly one AppImage and one deb for version $version." >&2
exit 1
fi
mkdir -p "$source_dir/release"
cp -- "${appimages[0]}" "${debs[0]}" "$source_dir/release/"
printf 'Linux artifacts copied to release/:\n %s\n %s\n' "${appimages[0]##*/}" "${debs[0]##*/}"
+20
View File
@@ -0,0 +1,20 @@
# Builds the Android debug APK and the Windows portable exe into .\release
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot\..
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
if (-not $env:JAVA_HOME) { $env:JAVA_HOME = 'C:\Program Files\Android\Android Studio\jbr' }
if (-not $env:ANDROID_HOME) { $env:ANDROID_HOME = Join-Path $env:LOCALAPPDATA 'Android\Sdk' }
New-Item -ItemType Directory -Force release | Out-Null
Write-Host "== Building APK $version =="
npm run android:apk
if ($LASTEXITCODE) { throw 'APK build failed' }
Write-Warning "The legacy ep-mail $version.apk copy is a debug APK and overwrites any existing file with that name."
Copy-Item android\app\build\outputs\apk\debug\app-debug.apk "release\ep-mail $version.apk" -Force
Write-Host "== Building portable exe $version =="
npm run dist:win:portable
if ($LASTEXITCODE) { throw 'Portable build failed' }
Write-Host "`nDone:"
Get-ChildItem release | Where-Object { $_.Name -like "ep-mail $version.*" } | ForEach-Object { " $($_.FullName)" }