Compare commits
2 commits
3c9c4344bc
...
bb25b0616d
| Author | SHA1 | Date | |
|---|---|---|---|
| bb25b0616d | |||
| 8917aba6d0 |
17 changed files with 857 additions and 54 deletions
98
.forgejo/workflows/release.yml
Normal file
98
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.forgejo/**'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: docker
|
||||
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
|
||||
steps:
|
||||
- name: Checkout (full history for tags)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Determine next version
|
||||
id: version
|
||||
run: |
|
||||
LATEST=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-version:refname | head -1)
|
||||
if [ -z "$LATEST" ]; then
|
||||
# First release — use version from package.json
|
||||
NEW=$(node -p "require('./package.json').version")
|
||||
else
|
||||
IFS='.' read -r maj min pat <<< "${LATEST#v}"
|
||||
NEW="${maj}.${min}.$((pat + 1))"
|
||||
fi
|
||||
echo "version=$NEW" >> $GITHUB_OUTPUT
|
||||
echo "tag=v$NEW" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Set version in package.json
|
||||
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
|
||||
|
||||
- name: Build Linux AppImage
|
||||
run: npm run build:linux
|
||||
env:
|
||||
# Подавляем попытку electron-builder публиковать на GitHub
|
||||
GH_TOKEN: ""
|
||||
|
||||
- name: Find built AppImage
|
||||
id: artifact
|
||||
run: |
|
||||
APPIMAGE=$(ls dist/*.AppImage | head -1)
|
||||
echo "path=$APPIMAGE" >> $GITHUB_OUTPUT
|
||||
echo "name=$(basename $APPIMAGE)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create and push tag
|
||||
env:
|
||||
TAG: ${{ steps.version.outputs.tag }}
|
||||
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git config user.email "ci@vodyanoysh.ru"
|
||||
git config user.name "Forgejo CI"
|
||||
git remote set-url origin "https://x-token:${GIT_TOKEN}@git.vodyanoysh.ru/vodyanoy/aero-mail.git"
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
|
||||
- name: Create Forgejo release
|
||||
id: release
|
||||
env:
|
||||
TAG: ${{ steps.version.outputs.tag }}
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
BODY=$(cat <<'NOTES'
|
||||
Автоматический релиз.
|
||||
NOTES
|
||||
)
|
||||
|
||||
RELEASE=$(curl -sf -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Aero Mail ${TAG}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":false}" \
|
||||
"https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases")
|
||||
|
||||
echo "id=$(echo "$RELEASE" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload AppImage to release
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_ID: ${{ steps.release.outputs.id }}
|
||||
ASSET_PATH: ${{ steps.artifact.outputs.path }}
|
||||
ASSET_NAME: ${{ steps.artifact.outputs.name }}
|
||||
run: |
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${ASSET_PATH}" \
|
||||
"https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases/${RELEASE_ID}/assets?name=${ASSET_NAME}"
|
||||
21
CLAUDE.md
21
CLAUDE.md
|
|
@ -1,5 +1,26 @@
|
|||
# Aero Mail — Developer Notes
|
||||
|
||||
## Agent team
|
||||
|
||||
Sub-agents live in `.claude/agents/`. Use `claude --agent <name>` or mention the agent in your request.
|
||||
|
||||
| Agent | When to use |
|
||||
|-------|-------------|
|
||||
| `architect` | **First** for any complex/cross-cutting feature: designs IPC contract, data model, plan — before coding starts |
|
||||
| `backend` | Main process: IMAP/SMTP, IPC handlers, account-manager, credential-store, CalDAV |
|
||||
| `frontend` | Renderer: Vue components, Pinia stores, composables, CSS |
|
||||
| `test` | Vitest setup, writing unit/integration tests |
|
||||
| `review` | Security audit, code review, performance analysis |
|
||||
| `devops` | Build, packaging, electron-builder, CI, auto-update |
|
||||
|
||||
**Routing heuristic**:
|
||||
- New feature touching IPC or both processes → `architect` first, then `backend` + `frontend`
|
||||
- Bug or small change only in `src/main/` → `backend` directly
|
||||
- Bug or small change only in `src/renderer/` → `frontend` directly
|
||||
- "write tests / fix tests" → `test`
|
||||
- "review / audit / check for bugs" → `review`
|
||||
- "build / package / CI" → `devops`
|
||||
|
||||
## Stack
|
||||
|
||||
Electron 35 + Vue 3 Composition API + Pinia + TypeScript + electron-vite.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import { resolve } from 'path'
|
||||
import { readFileSync } from 'fs'
|
||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { config as dotenv } from 'dotenv'
|
||||
|
||||
dotenv()
|
||||
|
||||
const pkg = JSON.parse(readFileSync('package.json', 'utf-8')) as { version: string }
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
|
|
@ -29,6 +32,9 @@ export default defineConfig({
|
|||
},
|
||||
renderer: {
|
||||
plugins: [vue()],
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(pkg.version)
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@shared': resolve('src/shared'),
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import { registerAccountHandlers } from './ipc/accounts.handler'
|
|||
import { registerFolderHandlers } from './ipc/folders.handler'
|
||||
import { registerMessageHandlers } from './ipc/messages.handler'
|
||||
import { registerCalendarHandlers } from './ipc/calendar.handler'
|
||||
import { registerUpdaterHandlers } from './ipc/updater.handler'
|
||||
import { updater } from './services/updater'
|
||||
import type { ComposeSession } from '@shared/types/message'
|
||||
|
||||
const accountManager = new AccountManager()
|
||||
|
|
@ -148,9 +150,14 @@ app.whenReady().then(async () => {
|
|||
registerFolderHandlers(accountManager)
|
||||
registerMessageHandlers(accountManager)
|
||||
registerCalendarHandlers(accountManager)
|
||||
registerUpdaterHandlers()
|
||||
|
||||
createWindow()
|
||||
|
||||
if (app.isPackaged) {
|
||||
setTimeout(() => updater.checkForUpdates(), 10_000)
|
||||
}
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,18 @@ import { join, extname, basename } from 'path'
|
|||
import { registerHandler } from './registry'
|
||||
import type { AccountManager } from '../services/account-manager'
|
||||
|
||||
function assertId(value: unknown, name: string): asserts value is string {
|
||||
if (typeof value !== 'string' || value.length === 0) {
|
||||
throw new Error(`Invalid IPC argument: ${name} must be a non-empty string`)
|
||||
}
|
||||
}
|
||||
|
||||
function assertIds(value: unknown, name: string): asserts value is string[] {
|
||||
if (!Array.isArray(value) || value.length === 0 || value.some((v) => typeof v !== 'string')) {
|
||||
throw new Error(`Invalid IPC argument: ${name} must be a non-empty string array`)
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveDownloadPath(folder: string, filename: string): Promise<string> {
|
||||
const ext = extname(filename)
|
||||
const base = basename(filename, ext)
|
||||
|
|
@ -30,14 +42,18 @@ function sendProgress(attachmentId: string, stage: 'downloading' | 'saving' | 'd
|
|||
|
||||
export function registerMessageHandlers(manager: AccountManager): void {
|
||||
registerHandler('messages:list', async ({ accountId, folderId, offset, limit, unseenOnly }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
assertId(folderId, 'folderId')
|
||||
return manager.listMessages(accountId, folderId, offset, limit, unseenOnly ?? false)
|
||||
})
|
||||
|
||||
registerHandler('messages:poll', async ({ accountId }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
await manager.pollNewMessages(accountId)
|
||||
})
|
||||
|
||||
registerHandler('messages:send', async ({ accountId, compose }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
try {
|
||||
await manager.sendMessage(accountId, compose)
|
||||
return { success: true }
|
||||
|
|
@ -47,18 +63,28 @@ export function registerMessageHandlers(manager: AccountManager): void {
|
|||
})
|
||||
|
||||
registerHandler('messages:search', async ({ accountId, query, limit }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
return manager.searchMessages(accountId, query, limit)
|
||||
})
|
||||
|
||||
registerHandler('messages:body', async ({ accountId, folderId, messageId }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
assertId(folderId, 'folderId')
|
||||
assertId(messageId, 'messageId')
|
||||
return manager.fetchMessageBody(accountId, folderId, messageId)
|
||||
})
|
||||
|
||||
registerHandler('messages:setFlags', async ({ accountId, folderId, messageIds, flags }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
assertId(folderId, 'folderId')
|
||||
assertIds(messageIds, 'messageIds')
|
||||
await manager.updateFlags(accountId, folderId, messageIds, flags)
|
||||
})
|
||||
|
||||
registerHandler('messages:delete', async ({ accountId, folderId, messageIds }) => {
|
||||
assertId(accountId, 'accountId')
|
||||
assertId(folderId, 'folderId')
|
||||
assertIds(messageIds, 'messageIds')
|
||||
await manager.deleteMessages(accountId, folderId, messageIds)
|
||||
})
|
||||
|
||||
|
|
|
|||
14
src/main/ipc/updater.handler.ts
Normal file
14
src/main/ipc/updater.handler.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { registerHandler } from './registry'
|
||||
import { updater } from '../services/updater'
|
||||
|
||||
export function registerUpdaterHandlers(): void {
|
||||
registerHandler('update:check', () => updater.checkForUpdates())
|
||||
|
||||
registerHandler('update:download', async () => {
|
||||
updater.downloadUpdate()
|
||||
})
|
||||
|
||||
registerHandler('update:install', async () => {
|
||||
updater.installUpdate()
|
||||
})
|
||||
}
|
||||
|
|
@ -55,10 +55,19 @@ export class ImapProvider implements IEmailProvider {
|
|||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
const timeout = new Promise<never>((_, reject) =>
|
||||
setTimeout(() => reject(new Error('Connection timed out (10s)')), 10_000)
|
||||
)
|
||||
await Promise.race([this.client.connect(), timeout])
|
||||
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
||||
const timeoutPromise = new Promise<never>((_, reject) => {
|
||||
timeoutId = setTimeout(() => reject(new Error('Connection timed out (10s)')), 10_000)
|
||||
})
|
||||
try {
|
||||
await Promise.race([this.client.connect(), timeoutPromise])
|
||||
} catch (err) {
|
||||
// Close any socket imapflow opened or is opening (timeout race case)
|
||||
this.client.logout().catch(() => {})
|
||||
throw err
|
||||
} finally {
|
||||
clearTimeout(timeoutId)
|
||||
}
|
||||
this.connected = true
|
||||
// Запускаем в фоне; промис await-ится в sendMessage() — гарантия что имя готово к отправке
|
||||
this.senderNamePromise = this.fetchSenderName().catch(() => null)
|
||||
|
|
@ -232,6 +241,9 @@ export class ImapProvider implements IEmailProvider {
|
|||
}
|
||||
|
||||
async downloadAttachment(folderId: string, messageId: string, attachmentId: string): Promise<Buffer> {
|
||||
// TODO: имапфлоу поддерживает частичный download по part-номеру из BODYSTRUCTURE
|
||||
// (client.download(uid, '2', {uid:true})). Оптимизация требует хранить part в Attachment.id
|
||||
// и пробрасывать через IPC. Сейчас скачивается всё письмо целиком.
|
||||
const lock = await this.client.getMailboxLock(folderId)
|
||||
try {
|
||||
const download = await this.client.download(messageId, undefined, { uid: true })
|
||||
|
|
@ -318,8 +330,10 @@ export class ImapProvider implements IEmailProvider {
|
|||
? ImapProvider.textToHtml(compose.body) + compose.htmlBody
|
||||
: undefined
|
||||
|
||||
console.log('[SMTP] host=%s port=%d secure=%s from=%j to=%j',
|
||||
smtpHost, smtpPort, smtpSecure, from, compose.to)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.log('[SMTP] host=%s port=%d secure=%s from=%j to=%j',
|
||||
smtpHost, smtpPort, smtpSecure, from, compose.to)
|
||||
}
|
||||
|
||||
const info = await transporter.sendMail({
|
||||
from,
|
||||
|
|
|
|||
|
|
@ -83,13 +83,14 @@ export class AccountManager {
|
|||
}
|
||||
|
||||
async testConnection(config: AccountConfig): Promise<{ success: boolean; error?: string }> {
|
||||
const provider = this.createProvider(config)
|
||||
try {
|
||||
const provider = this.createProvider(config)
|
||||
await provider.connect()
|
||||
await provider.disconnect()
|
||||
return { success: true }
|
||||
} catch (error) {
|
||||
return { success: false, error: (error as Error).message }
|
||||
} finally {
|
||||
provider.disconnect().catch(() => {})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,21 +276,23 @@ export class AccountManager {
|
|||
// ── Auto-reconnect ──────────────────────────────────────
|
||||
|
||||
private async withAutoReconnect<T>(accountId: string, fn: () => Promise<T>): Promise<T> {
|
||||
let originalError: unknown
|
||||
try {
|
||||
return await fn()
|
||||
} catch (err) {
|
||||
originalError = err
|
||||
const code = (err as { code?: string }).code ?? ''
|
||||
if (!RECONNECT_CODES.has(code)) throw err
|
||||
|
||||
try {
|
||||
await this.reconnectAccount(accountId)
|
||||
} catch (reconnectErr) {
|
||||
console.error(`[AccountManager] reconnect failed for ${accountId}:`, reconnectErr)
|
||||
throw reconnectErr
|
||||
}
|
||||
|
||||
return await fn()
|
||||
}
|
||||
|
||||
try {
|
||||
await this.reconnectAccount(accountId)
|
||||
} catch (reconnectErr) {
|
||||
console.error(`[AccountManager] reconnect failed for ${accountId}:`, reconnectErr)
|
||||
throw new Error(`Reconnect failed: ${(reconnectErr as Error).message}`, { cause: originalError })
|
||||
}
|
||||
|
||||
return await fn()
|
||||
}
|
||||
|
||||
private async reconnectAccount(accountId: string): Promise<void> {
|
||||
|
|
|
|||
163
src/main/services/updater.ts
Normal file
163
src/main/services/updater.ts
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
import { app, BrowserWindow } from 'electron'
|
||||
import { createWriteStream, chmodSync, copyFileSync, mkdirSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { homedir } from 'os'
|
||||
import https from 'https'
|
||||
import http from 'http'
|
||||
import { URL } from 'url'
|
||||
|
||||
const REPO_API = 'https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases/latest'
|
||||
|
||||
interface ReleaseAsset {
|
||||
name: string
|
||||
browser_download_url: string
|
||||
size: number
|
||||
}
|
||||
|
||||
interface Release {
|
||||
tag_name: string
|
||||
name: string
|
||||
body: string
|
||||
assets: ReleaseAsset[]
|
||||
}
|
||||
|
||||
function compareSemver(a: string, b: string): number {
|
||||
const parse = (v: string): number[] => v.replace(/^v/, '').split('.').map(Number)
|
||||
const [aMaj, aMin, aPat] = parse(a)
|
||||
const [bMaj, bMin, bPat] = parse(b)
|
||||
if (aMaj !== bMaj) return aMaj - bMaj
|
||||
if (aMin !== bMin) return aMin - bMin
|
||||
return aPat - bPat
|
||||
}
|
||||
|
||||
function fetchJson<T>(url: string): Promise<T> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const parsed = new URL(url)
|
||||
https.get(
|
||||
{ hostname: parsed.hostname, path: parsed.pathname + parsed.search, headers: { 'User-Agent': `AeroMail/${app.getVersion()}` } },
|
||||
(res) => {
|
||||
if (res.statusCode !== 200) {
|
||||
reject(new Error(`HTTP ${res.statusCode}`))
|
||||
res.resume()
|
||||
return
|
||||
}
|
||||
let data = ''
|
||||
res.on('data', (chunk: string) => { data += chunk })
|
||||
res.on('end', () => {
|
||||
try { resolve(JSON.parse(data) as T) } catch (e) { reject(e) }
|
||||
})
|
||||
}
|
||||
).on('error', reject)
|
||||
})
|
||||
}
|
||||
|
||||
function downloadFile(
|
||||
url: string,
|
||||
destPath: string,
|
||||
totalSize: number,
|
||||
onProgress: (percent: number, transferred: number, total: number) => void
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const follow = (currentUrl: string): void => {
|
||||
const parsed = new URL(currentUrl)
|
||||
const proto = parsed.protocol === 'https:' ? https : http
|
||||
proto.get(currentUrl, { headers: { 'User-Agent': `AeroMail/${app.getVersion()}` } }, (res) => {
|
||||
if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
|
||||
follow(res.headers.location!)
|
||||
return
|
||||
}
|
||||
if (res.statusCode !== 200) {
|
||||
reject(new Error(`Download failed: HTTP ${res.statusCode}`))
|
||||
res.resume()
|
||||
return
|
||||
}
|
||||
const file = createWriteStream(destPath)
|
||||
let transferred = 0
|
||||
res.on('data', (chunk: Buffer) => {
|
||||
transferred += chunk.length
|
||||
const percent = totalSize > 0 ? Math.round((transferred / totalSize) * 100) : 0
|
||||
onProgress(percent, transferred, totalSize)
|
||||
})
|
||||
res.pipe(file)
|
||||
file.on('finish', () => file.close(() => resolve()))
|
||||
file.on('error', (e) => { reject(e) })
|
||||
res.on('error', (e) => { reject(e) })
|
||||
}).on('error', reject)
|
||||
}
|
||||
follow(url)
|
||||
})
|
||||
}
|
||||
|
||||
export class UpdaterService {
|
||||
private downloadedPath: string | null = null
|
||||
|
||||
private send(channel: string, data: unknown): void {
|
||||
const win = BrowserWindow.getAllWindows()[0]
|
||||
win?.webContents.send(channel, data)
|
||||
}
|
||||
|
||||
async checkForUpdates(): Promise<{ hasUpdate: boolean; version?: string; notes?: string }> {
|
||||
try {
|
||||
const release = await fetchJson<Release>(REPO_API)
|
||||
const currentVersion = app.getVersion()
|
||||
|
||||
if (compareSemver(release.tag_name, currentVersion) > 0) {
|
||||
const version = release.tag_name.replace(/^v/, '')
|
||||
const notes = release.body ?? ''
|
||||
this.send('update:available', { version, notes })
|
||||
return { hasUpdate: true, version, notes }
|
||||
}
|
||||
|
||||
this.send('update:not-available', {})
|
||||
return { hasUpdate: false }
|
||||
} catch (e) {
|
||||
const error = (e as Error).message
|
||||
this.send('update:error', { error })
|
||||
return { hasUpdate: false }
|
||||
}
|
||||
}
|
||||
|
||||
async downloadUpdate(): Promise<void> {
|
||||
try {
|
||||
const release = await fetchJson<Release>(REPO_API)
|
||||
const asset = release.assets.find((a) => a.name.endsWith('.AppImage'))
|
||||
if (!asset) throw new Error('No AppImage asset in release')
|
||||
|
||||
const destDir = join(homedir(), '.cache', 'aero-mail', 'updates')
|
||||
mkdirSync(destDir, { recursive: true })
|
||||
const destPath = join(destDir, asset.name)
|
||||
|
||||
await downloadFile(asset.browser_download_url, destPath, asset.size, (percent, transferred, total) => {
|
||||
this.send('update:progress', { percent, transferred, total })
|
||||
})
|
||||
|
||||
chmodSync(destPath, 0o755)
|
||||
this.downloadedPath = destPath
|
||||
this.send('update:downloaded', {})
|
||||
} catch (e) {
|
||||
const error = (e as Error).message
|
||||
this.send('update:error', { error })
|
||||
}
|
||||
}
|
||||
|
||||
installUpdate(): void {
|
||||
if (!this.downloadedPath) return
|
||||
|
||||
const appImagePath = process.env['APPIMAGE']
|
||||
if (appImagePath) {
|
||||
try {
|
||||
copyFileSync(this.downloadedPath, appImagePath)
|
||||
chmodSync(appImagePath, 0o755)
|
||||
app.relaunch()
|
||||
} catch {
|
||||
app.relaunch({ execPath: this.downloadedPath })
|
||||
}
|
||||
} else {
|
||||
app.relaunch({ execPath: this.downloadedPath })
|
||||
}
|
||||
|
||||
app.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
export const updater = new UpdaterService()
|
||||
|
|
@ -3,6 +3,7 @@ import { onMounted, onUnmounted, watch } from 'vue'
|
|||
import { useAccountsStore } from './stores/accounts.store'
|
||||
import { useSettingsStore } from './stores/settings.store'
|
||||
import { useIpc } from './composables/useIpc'
|
||||
import UpdateBanner from './components/UpdateBanner.vue'
|
||||
|
||||
const accountsStore = useAccountsStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
|
@ -38,4 +39,5 @@ onUnmounted(() => { if (pollTimer) clearInterval(pollTimer) })
|
|||
|
||||
<template>
|
||||
<router-view />
|
||||
<UpdateBanner />
|
||||
</template>
|
||||
|
|
|
|||
178
src/renderer/src/components/UpdateBanner.vue
Normal file
178
src/renderer/src/components/UpdateBanner.vue
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
<script setup lang="ts">
|
||||
import { useUpdaterStore } from '../stores/updater.store'
|
||||
|
||||
const updater = useUpdaterStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Transition name="banner">
|
||||
<div
|
||||
v-if="updater.available && !updater.dismissed"
|
||||
class="update-banner"
|
||||
>
|
||||
<div class="banner-body">
|
||||
<div class="banner-icon">↑</div>
|
||||
<div class="banner-text">
|
||||
<span class="banner-title">Доступна версия {{ updater.version }}</span>
|
||||
<span v-if="updater.downloading" class="banner-sub">
|
||||
Загрузка… {{ updater.percent }}%
|
||||
</span>
|
||||
<span v-else-if="updater.downloaded" class="banner-sub">Готово к установке</span>
|
||||
</div>
|
||||
|
||||
<div class="banner-progress-wrap" v-if="updater.downloading">
|
||||
<div class="banner-progress-bar" :style="{ width: updater.percent + '%' }" />
|
||||
</div>
|
||||
|
||||
<div class="banner-actions">
|
||||
<button
|
||||
v-if="!updater.downloading && !updater.downloaded"
|
||||
class="btn-primary"
|
||||
@click="updater.download()"
|
||||
>Скачать</button>
|
||||
<button
|
||||
v-if="updater.downloaded"
|
||||
class="btn-primary"
|
||||
@click="updater.install()"
|
||||
>Установить и перезапустить</button>
|
||||
<button
|
||||
v-if="!updater.downloading"
|
||||
class="btn-dismiss"
|
||||
@click="updater.dismiss()"
|
||||
>✕</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.update-banner {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 9000;
|
||||
min-width: 340px;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
.banner-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--accent) 12%, rgba(12, 12, 20, 0.92));
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
|
||||
box-shadow:
|
||||
0 8px 32px rgba(0, 0, 0, 0.5),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
||||
backdrop-filter: blur(24px);
|
||||
-webkit-backdrop-filter: blur(24px);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.banner-icon {
|
||||
font-size: 16px;
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.banner-sub {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.banner-progress-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 0 0 12px 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-progress-bar {
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
transition: width 0.3s ease;
|
||||
border-radius: 0 0 12px 12px;
|
||||
}
|
||||
|
||||
.banner-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
padding: 4px 12px;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--accent);
|
||||
color: var(--accent-text);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: opacity var(--transition-fast), transform var(--transition-fast);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
.btn-primary:active {
|
||||
transform: translateY(1px);
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.btn-dismiss {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: color var(--transition-fast), background var(--transition-fast);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.btn-dismiss:hover {
|
||||
color: var(--text-secondary);
|
||||
background: rgba(255, 255, 255, 0.07);
|
||||
}
|
||||
|
||||
.banner-enter-active,
|
||||
.banner-leave-active {
|
||||
transition: opacity 0.25s ease, transform 0.25s ease;
|
||||
}
|
||||
|
||||
.banner-enter-from,
|
||||
.banner-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(-50%) translateY(12px);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref, onMounted, onUnmounted } from 'vue'
|
||||
import { computed, ref, watch, onMounted, onUnmounted } from 'vue'
|
||||
import type { MessageEnvelope, Address } from '@shared/types/message'
|
||||
import { formatFullDate } from '../../utils/date'
|
||||
import AppIcon from '../AppIcon.vue'
|
||||
|
|
@ -47,6 +47,27 @@ function handleForward(): void {
|
|||
|
||||
const dateDisplay = computed(() => formatFullDate(props.message.date))
|
||||
|
||||
// ── Collapse recipients ────────────────────────────────────
|
||||
|
||||
const COLLAPSE_THRESHOLD = 10
|
||||
|
||||
const toExpanded = ref(false)
|
||||
const ccExpanded = ref(false)
|
||||
|
||||
const visibleTo = computed(() =>
|
||||
toExpanded.value ? props.message.to : props.message.to.slice(0, COLLAPSE_THRESHOLD)
|
||||
)
|
||||
const visibleCc = computed(() =>
|
||||
ccExpanded.value ? props.message.cc : props.message.cc.slice(0, COLLAPSE_THRESHOLD)
|
||||
)
|
||||
const hiddenToCount = computed(() => Math.max(0, props.message.to.length - COLLAPSE_THRESHOLD))
|
||||
const hiddenCcCount = computed(() => Math.max(0, props.message.cc.length - COLLAPSE_THRESHOLD))
|
||||
|
||||
watch(() => props.message.id, () => {
|
||||
toExpanded.value = false
|
||||
ccExpanded.value = false
|
||||
})
|
||||
|
||||
// ── Contact popup ──────────────────────────────────────────
|
||||
|
||||
const activeContact = ref<Address | null>(null)
|
||||
|
|
@ -129,13 +150,27 @@ onUnmounted(() => {
|
|||
<span class="label">Кому:</span>
|
||||
<span class="value addr-list">
|
||||
<button
|
||||
v-for="addr in message.to"
|
||||
v-for="addr in visibleTo"
|
||||
:key="addr.email"
|
||||
class="addr-chip"
|
||||
@click="openContact(addr, $event)"
|
||||
>
|
||||
<span class="addr-name">{{ addr.name || addr.email }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="hiddenToCount > 0 && !toExpanded"
|
||||
class="addr-chip addr-chip--more"
|
||||
@click="toExpanded = true"
|
||||
>
|
||||
<span class="addr-name">и ещё {{ hiddenToCount }}...</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="toExpanded && message.to.length > COLLAPSE_THRESHOLD"
|
||||
class="addr-chip addr-chip--more"
|
||||
@click="toExpanded = false"
|
||||
>
|
||||
<span class="addr-name">свернуть</span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -144,13 +179,27 @@ onUnmounted(() => {
|
|||
<span class="label">Копия:</span>
|
||||
<span class="value addr-list">
|
||||
<button
|
||||
v-for="addr in message.cc"
|
||||
v-for="addr in visibleCc"
|
||||
:key="addr.email"
|
||||
class="addr-chip"
|
||||
@click="openContact(addr, $event)"
|
||||
>
|
||||
<span class="addr-name">{{ addr.name || addr.email }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="hiddenCcCount > 0 && !ccExpanded"
|
||||
class="addr-chip addr-chip--more"
|
||||
@click="ccExpanded = true"
|
||||
>
|
||||
<span class="addr-name">и ещё {{ hiddenCcCount }}...</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="ccExpanded && message.cc.length > COLLAPSE_THRESHOLD"
|
||||
class="addr-chip addr-chip--more"
|
||||
@click="ccExpanded = false"
|
||||
>
|
||||
<span class="addr-name">свернуть</span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -369,6 +418,19 @@ onUnmounted(() => {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.addr-chip--more {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
border-color: rgba(255, 255, 255, 0.07);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.addr-chip--more:hover {
|
||||
color: var(--accent);
|
||||
background: color-mix(in srgb, var(--accent) 10%, transparent);
|
||||
border-color: color-mix(in srgb, var(--accent) 30%, transparent);
|
||||
}
|
||||
|
||||
/* ── Попап контакта ──────────────────────────────────────── */
|
||||
.contact-popup {
|
||||
position: absolute;
|
||||
|
|
|
|||
2
src/renderer/src/env.d.ts
vendored
2
src/renderer/src/env.d.ts
vendored
|
|
@ -1,5 +1,7 @@
|
|||
/// <reference types="vite/client" />
|
||||
|
||||
declare const __APP_VERSION__: string
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<object, object, unknown>
|
||||
|
|
|
|||
|
|
@ -62,24 +62,6 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
const searchLoading = ref(false)
|
||||
const isSearchActive = computed(() => searchQuery.value.trim().length > 0)
|
||||
|
||||
// Отслеживание новых писем между обновлениями
|
||||
const knownIds = new Map<string, Set<string>>() // key = accountId:folderId
|
||||
const newArrivals = ref<Array<{ accountId: string; folderId: string; envelope: MessageEnvelope }>>([])
|
||||
|
||||
function detectNewMessages(accountId: string, folderId: string, fresh: MessageEnvelope[]): void {
|
||||
const key = `${accountId}:${folderId}`
|
||||
const prev = knownIds.get(key)
|
||||
const nextIds = new Set(fresh.map(m => m.id))
|
||||
knownIds.set(key, nextIds)
|
||||
|
||||
if (!prev) return
|
||||
|
||||
const arrived = fresh.filter(m => !prev.has(m.id) && !m.flags.seen)
|
||||
if (arrived.length > 0) {
|
||||
newArrivals.value = arrived.map(envelope => ({ accountId, folderId, envelope }))
|
||||
}
|
||||
}
|
||||
|
||||
const filteredMessages = computed(() =>
|
||||
unreadOnly.value ? messages.value.filter((m) => !m.flags.seen) : messages.value
|
||||
)
|
||||
|
|
@ -96,7 +78,6 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
})
|
||||
|
||||
if (offset === 0) {
|
||||
detectNewMessages(accountId, folderId, result.messages)
|
||||
messages.value = result.messages
|
||||
if (unreadOnly.value) {
|
||||
// result.total — это точное число непрочитанных из SEARCH UNSEEN
|
||||
|
|
@ -110,7 +91,11 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
|
||||
// Предзагрузка тел первых 10 писем в фоне (только в обычном режиме)
|
||||
if (!unreadOnly.value) {
|
||||
setTimeout(() => prefetchBodies(accountId, folderId, 10), 600)
|
||||
if ('requestIdleCallback' in window) {
|
||||
requestIdleCallback(() => prefetchBodies(accountId, folderId, 10), { timeout: 3000 })
|
||||
} else {
|
||||
setTimeout(() => prefetchBodies(accountId, folderId, 10), 600)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messages.value.push(...result.messages)
|
||||
|
|
@ -126,17 +111,21 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
.slice(0, count)
|
||||
.filter((m) => !getCachedBody(`${accountId}:${folderId}:${m.id}`))
|
||||
|
||||
await Promise.all(
|
||||
toFetch.map(async (msg) => {
|
||||
const key = `${accountId}:${folderId}:${msg.id}`
|
||||
try {
|
||||
const body = await invoke('messages:body', { accountId, folderId, messageId: msg.id })
|
||||
setCachedBody(key, body)
|
||||
} catch {
|
||||
// фоновая предзагрузка — ошибки не критичны
|
||||
}
|
||||
})
|
||||
)
|
||||
// Параллельность ограничена 2 — иначе 10 одновременных mailbox-lock запросов
|
||||
// блокируют любое взаимодействие пользователя с IMAP на время предзагрузки
|
||||
const CONCURRENCY = 2
|
||||
for (let i = 0; i < toFetch.length; i += CONCURRENCY) {
|
||||
const batch = toFetch.slice(i, i + CONCURRENCY)
|
||||
await Promise.all(
|
||||
batch.map(async (msg) => {
|
||||
const key = `${accountId}:${folderId}:${msg.id}`
|
||||
try {
|
||||
const body = await invoke('messages:body', { accountId, folderId, messageId: msg.id })
|
||||
setCachedBody(key, body)
|
||||
} catch { /* фоновая предзагрузка — ошибки не критичны */ }
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMore(): Promise<void> {
|
||||
|
|
@ -340,7 +329,9 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
selectedIds.value = new Set()
|
||||
}
|
||||
|
||||
// Auto-load messages when folder changes
|
||||
// Auto-load messages when folder changes (debounced 150ms — против дребезга при навигации клавишами)
|
||||
let folderLoadTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
watch(
|
||||
() => foldersStore.activeFolderId,
|
||||
(folderId) => {
|
||||
|
|
@ -350,8 +341,18 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
messages.value = []
|
||||
totalCount.value = 0
|
||||
unreadOnly.value = false
|
||||
if (folderLoadTimer !== null) {
|
||||
clearTimeout(folderLoadTimer)
|
||||
folderLoadTimer = null
|
||||
}
|
||||
if (folderId && accountsStore.activeAccountId) {
|
||||
loadMessages(accountsStore.activeAccountId, folderId)
|
||||
const snapAccountId = accountsStore.activeAccountId
|
||||
folderLoadTimer = setTimeout(() => {
|
||||
folderLoadTimer = null
|
||||
if (foldersStore.activeFolderId === folderId && accountsStore.activeAccountId === snapAccountId) {
|
||||
loadMessages(snapAccountId, folderId)
|
||||
}
|
||||
}, 150)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -408,7 +409,6 @@ export const useMessagesStore = defineStore('messages', () => {
|
|||
messageBody,
|
||||
loading,
|
||||
loadingBody,
|
||||
newArrivals,
|
||||
searchQuery,
|
||||
searchResults,
|
||||
searchLoading,
|
||||
|
|
|
|||
71
src/renderer/src/stores/updater.store.ts
Normal file
71
src/renderer/src/stores/updater.store.ts
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useIpc } from '../composables/useIpc'
|
||||
|
||||
export const useUpdaterStore = defineStore('updater', () => {
|
||||
const { invoke, on } = useIpc()
|
||||
|
||||
const available = ref(false)
|
||||
const version = ref('')
|
||||
const notes = ref('')
|
||||
const checking = ref(false)
|
||||
const downloading = ref(false)
|
||||
const percent = ref(0)
|
||||
const downloaded = ref(false)
|
||||
const dismissed = ref(false)
|
||||
const error = ref('')
|
||||
|
||||
on('update:available', (data) => {
|
||||
available.value = true
|
||||
version.value = data.version
|
||||
notes.value = data.notes
|
||||
dismissed.value = false
|
||||
})
|
||||
|
||||
on('update:progress', (data) => {
|
||||
downloading.value = true
|
||||
percent.value = data.percent
|
||||
})
|
||||
|
||||
on('update:downloaded', () => {
|
||||
downloading.value = false
|
||||
downloaded.value = true
|
||||
percent.value = 100
|
||||
})
|
||||
|
||||
on('update:error', (data) => {
|
||||
downloading.value = false
|
||||
checking.value = false
|
||||
error.value = data.error
|
||||
})
|
||||
|
||||
on('update:not-available', () => {
|
||||
checking.value = false
|
||||
})
|
||||
|
||||
async function check(): Promise<void> {
|
||||
checking.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
await invoke('update:check')
|
||||
} finally {
|
||||
checking.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function download(): void {
|
||||
downloading.value = true
|
||||
percent.value = 0
|
||||
invoke('update:download')
|
||||
}
|
||||
|
||||
function install(): void {
|
||||
invoke('update:install')
|
||||
}
|
||||
|
||||
function dismiss(): void {
|
||||
dismissed.value = true
|
||||
}
|
||||
|
||||
return { available, version, notes, checking, downloading, percent, downloaded, dismissed, error, check, download, install, dismiss }
|
||||
})
|
||||
|
|
@ -7,6 +7,7 @@ import CustomSelect from '../components/CustomSelect.vue'
|
|||
import ColorPicker from '../components/ColorPicker.vue'
|
||||
import AppIcon from '../components/AppIcon.vue'
|
||||
import EditAccountDialog from '../components/accounts/EditAccountDialog.vue'
|
||||
import { useUpdaterStore } from '../stores/updater.store'
|
||||
import type { AccountConfig } from '@shared/types/account'
|
||||
|
||||
const router = useRouter()
|
||||
|
|
@ -14,6 +15,7 @@ const accountsStore = useAccountsStore()
|
|||
const settingsStore = useSettingsStore()
|
||||
|
||||
const editingAccount = ref<AccountConfig | null>(null)
|
||||
const updaterStore = useUpdaterStore()
|
||||
|
||||
const swipeOptions: { value: SwipeAction; label: string }[] = (
|
||||
['delete', 'toggleRead', 'toggleFlag', 'none'] as SwipeAction[]
|
||||
|
|
@ -186,6 +188,58 @@ function folderDisplayName(path: string): string {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Обновления -->
|
||||
<div class="section">
|
||||
<div class="section-label">Приложение</div>
|
||||
<div class="section-body">
|
||||
<div class="row">
|
||||
<span class="col-label">Версия</span>
|
||||
<div class="col-value update-row-content">
|
||||
<span class="version-badge">v{{ __APP_VERSION__ }}</span>
|
||||
<span v-if="updaterStore.available" class="update-available-dot" v-tooltip="'Доступно обновление'">●</span>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
class="action-btn"
|
||||
:disabled="updaterStore.checking"
|
||||
@click="updaterStore.check()"
|
||||
>{{ updaterStore.checking ? 'Проверка…' : 'Проверить обновления' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="updaterStore.error" class="row error-row">
|
||||
<span class="col-label"></span>
|
||||
<span class="col-value update-error">{{ updaterStore.error }}</span>
|
||||
</div>
|
||||
<div v-if="updaterStore.available && !updaterStore.downloaded && !updaterStore.downloading" class="row">
|
||||
<span class="col-label"></span>
|
||||
<div class="col-value">
|
||||
<span class="update-note">Доступна версия {{ updaterStore.version }}</span>
|
||||
<div class="row-actions">
|
||||
<button class="action-btn" @click="updaterStore.download()">Скачать</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="updaterStore.downloading" class="row">
|
||||
<span class="col-label"></span>
|
||||
<div class="col-value update-progress-row">
|
||||
<div class="update-progress-track">
|
||||
<div class="update-progress-fill" :style="{ width: updaterStore.percent + '%' }" />
|
||||
</div>
|
||||
<span class="update-pct">{{ updaterStore.percent }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="updaterStore.downloaded" class="row">
|
||||
<span class="col-label"></span>
|
||||
<div class="col-value">
|
||||
<span class="update-note">Обновление загружено</span>
|
||||
<div class="row-actions">
|
||||
<button class="action-btn" @click="updaterStore.install()">Установить и перезапустить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -614,4 +668,77 @@ function folderDisplayName(path: string): string {
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ── Обновления ──────────────────────────────────────────────────────────── */
|
||||
|
||||
.update-row-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.version-badge {
|
||||
font-size: 11.5px;
|
||||
color: var(--text-muted);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.update-available-dot {
|
||||
color: var(--accent);
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.update-note {
|
||||
font-size: 11.5px;
|
||||
color: var(--accent);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.update-error {
|
||||
font-size: 11px;
|
||||
color: var(--danger);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.error-row {
|
||||
background: rgba(255, 85, 85, 0.04);
|
||||
}
|
||||
|
||||
.update-progress-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.update-progress-track {
|
||||
flex: 1;
|
||||
height: 3px;
|
||||
border-radius: var(--radius-full);
|
||||
background: rgba(255, 255, 255, 0.10);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.update-progress-fill {
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
border-radius: var(--radius-full);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.update-pct {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
min-width: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.action-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -59,12 +59,21 @@ export interface IpcChannelMap {
|
|||
{ accountId: string },
|
||||
{ path: string; status: number; note: string }[]
|
||||
]
|
||||
|
||||
'update:check': [void, { hasUpdate: boolean; version?: string; notes?: string }]
|
||||
'update:download': [void, void]
|
||||
'update:install': [void, void]
|
||||
}
|
||||
|
||||
export interface IpcEventMap {
|
||||
'mail:new': { accountId: string; folderId: string; envelope: MessageEnvelope }
|
||||
'account:status': { accountId: string; connected: boolean; error?: string }
|
||||
'attachment:progress': { attachmentId: string; stage: 'downloading' | 'saving' | 'done' | 'error'; progress: number; error?: string }
|
||||
'update:available': { version: string; notes: string }
|
||||
'update:not-available': Record<string, never>
|
||||
'update:progress': { percent: number; transferred: number; total: number }
|
||||
'update:downloaded': Record<string, never>
|
||||
'update:error': { error: string }
|
||||
}
|
||||
|
||||
export type IpcChannel = keyof IpcChannelMap
|
||||
|
|
|
|||
Loading…
Reference in a new issue