Compare commits
16 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82676e2ec4 | ||
|
|
744c3d3d0b | ||
|
|
dbfcb0ec38 | ||
| 2fd0b4024d | |||
|
|
cb4f6094ff | ||
| 598bd61c77 | |||
|
|
4d14ecdb0e | ||
| 1518016568 | |||
|
|
34d6dc0aaf | ||
| cb7706ca90 | |||
|
|
a798025423 | ||
| 65d5e3668c | |||
|
|
f3220d0859 | ||
| 0adc56da6e | |||
|
|
24e4a09252 | ||
| 126ad1d081 |
6 changed files with 175 additions and 13 deletions
|
|
@ -19,6 +19,9 @@ jobs:
|
|||
container:
|
||||
image: electronuserland/builder:wine
|
||||
|
||||
env:
|
||||
API: https://git.vodyanoy.dev/api/v1/repos/vodyanoy/aero-mail
|
||||
|
||||
steps:
|
||||
- name: Checkout (full history for tags)
|
||||
uses: actions/checkout@v4
|
||||
|
|
@ -87,7 +90,7 @@ jobs:
|
|||
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 remote set-url origin "https://x-token:${GIT_TOKEN}@git.vodyanoy.dev/vodyanoy/aero-mail.git"
|
||||
git add package.json package-lock.json
|
||||
git diff --cached --quiet || git commit -m "Обновлена версия до ${VERSION} [skip ci]"
|
||||
git push origin master
|
||||
|
|
@ -106,22 +109,25 @@ jobs:
|
|||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "${PAYLOAD}" \
|
||||
"https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases")
|
||||
"${API}/releases")
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE" | node -e 'let input = ""; process.stdin.on("data", chunk => { input += chunk }); process.stdin.on("end", () => { const release = JSON.parse(input); if (!Number.isSafeInteger(release.id)) throw new Error("Некорректный ID релиза"); console.log(release.id) })')
|
||||
echo "id=${RELEASE_ID}" >> "$GITHUB_OUTPUT"
|
||||
RELEASE_ID=$(printf '%s' "$RELEASE" | node -e 'let input = ""; process.stdin.on("data", chunk => { input += chunk }); process.stdin.on("end", () => { const release = JSON.parse(input); if (!Number.isSafeInteger(release.id)) throw new Error("Некорректный ID релиза"); process.stdout.write(String(release.id)) })')
|
||||
printf '%s' "${RELEASE_ID}" > /tmp/release-id.txt
|
||||
|
||||
- name: Upload Linux and Windows release files
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_ID: ${{ steps.release.outputs.id }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
RELEASE_ID=$(cat /tmp/release-id.txt)
|
||||
# Только цифры: защита от ANSI-цветов (FORCE_COLOR) и прочего мусора
|
||||
printf '%s' "${RELEASE_ID}" | grep -qxE '[0-9]+' || { echo "Некорректный ID релиза: $(printf '%s' "${RELEASE_ID}" | od -c)"; exit 1; }
|
||||
for ASSET_PATH in "dist/aero-mail-${VERSION}.AppImage" "dist/aero-mail-${VERSION}-win-x64.exe" "dist/aero-mail-${VERSION}-win-x64.exe.blockmap" dist/latest.yml; do
|
||||
ASSET_NAME=$(basename "${ASSET_PATH}")
|
||||
curl --fail-with-body --silent --show-error -X POST \
|
||||
URL="${API}/releases/${RELEASE_ID}/assets?name=${ASSET_NAME}"
|
||||
curl --globoff --fail-with-body --silent --show-error -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}"
|
||||
"${URL}"
|
||||
done
|
||||
|
|
|
|||
156
AGENTS.md
Normal file
156
AGENTS.md
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
# Aero Mail — Developer Notes
|
||||
|
||||
## Agent team
|
||||
|
||||
Sub-agents live in `.Codex/agents/`. Use `Codex --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.
|
||||
IMAP (imapflow) for reading, SMTP (nodemailer) for sending.
|
||||
No Gmail API / Exchange EWS — IMAP+SMTP only.
|
||||
|
||||
## Architecture
|
||||
|
||||
Three Electron processes: **main** / **preload** (contextBridge `window.api`) / **renderer** (Vue SPA).
|
||||
|
||||
IPC: type-safe `invoke` (Renderer→Main) + push events (Main→Renderer).
|
||||
Types live in `src/shared/types/ipc.ts`.
|
||||
|
||||
Key files:
|
||||
|
||||
| File | Role |
|
||||
|------|------|
|
||||
| `src/main/index.ts` | Electron entry, window management |
|
||||
| `src/main/services/account-manager.ts` | Provider map, IPC routing, auto-reconnect |
|
||||
| `src/main/providers/imap.provider.ts` | IMAP+SMTP implementation |
|
||||
| `src/renderer/src/stores/messages.store.ts` | Message list, LRU body cache, search |
|
||||
| `src/renderer/src/stores/folders.store.ts` | Folder tree, unread counts |
|
||||
| `src/shared/types/ipc.ts` | All IPC channels |
|
||||
|
||||
## IPC event listeners — required cleanup pattern
|
||||
|
||||
`window.api.on(channel, callback)` wraps `ipcRenderer.on` and returns an **unsubscribe function**.
|
||||
If the component that registers a listener can be unmounted (i.e. it lives inside a `<router-view>`),
|
||||
the unsubscribe **must** be called in `onUnmounted`, otherwise listeners accumulate on every remount.
|
||||
|
||||
```ts
|
||||
// CORRECT
|
||||
let unsub: (() => void) | null = null
|
||||
|
||||
onMounted(() => {
|
||||
unsub = on('mail:new', handler)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
unsub?.()
|
||||
})
|
||||
```
|
||||
|
||||
```ts
|
||||
// BUG — listener survives unmount, fires N times after N navigations
|
||||
onMounted(() => {
|
||||
on('mail:new', handler) // return value discarded
|
||||
})
|
||||
```
|
||||
|
||||
Pinia store setup functions run once (singleton) — `on()` calls inside them do not need cleanup.
|
||||
|
||||
Background: `NotificationContainer.vue` had this bug. It is mounted inside `MailView` which unmounts
|
||||
on every route change (→ Settings, → Calendar). Each remount registered a new `mail:new` listener,
|
||||
causing duplicate OS push notifications per incoming email.
|
||||
Fixed in commit on branch `feature/fix-notifications`.
|
||||
|
||||
## New-mail notification flow
|
||||
|
||||
```
|
||||
IMAP exists event
|
||||
→ ImapProvider.pollSingleFolder()
|
||||
└→ pollFolderTree() ← dedup via lastUnseenCount + notifiedUids (5 min TTL)
|
||||
|
||||
App.vue poll timer (autoCheckInterval)
|
||||
→ messages:poll IPC
|
||||
└→ AccountManager.pollNewMessages()
|
||||
└→ ImapProvider.pollFolderTree() ← same dedup
|
||||
|
||||
Both paths → newMailCallback → main sends mail:new IPC → renderer
|
||||
→ NotificationContainer: OS Notification + in-app toast
|
||||
→ messages.store: insert envelope, update unread count
|
||||
```
|
||||
|
||||
Dedup keys in `ImapProvider`: `"folderPath:uid"`, TTL 5 min. `lastUnseenCount` is updated
|
||||
**before** acquiring the mailbox lock, so concurrent runs of `pollFolderTree` for the same folder
|
||||
see the updated count and skip the second notification.
|
||||
|
||||
## Meeting reminders
|
||||
|
||||
`MeetingReminderService` (main) every 5 min fetches events for now ±1 day of all accounts,
|
||||
every 30 s checks: timed — 15 min before and at start (+5 min grace); all-day — once during
|
||||
the day. Dedup key `${event.id}|${event.start}|${kind}`. Shown in a single always-on-top
|
||||
`ReminderWindow` (`#/meeting-reminder`, mounted as its own root in `renderer/main.ts`, not
|
||||
under `App.vue` — no mail polling there) + OS `Notification`. Settings (`enabled`,
|
||||
`skipCancelled`) live in main `electron-store` (`meeting-reminders`), IPC `reminder:*`.
|
||||
|
||||
EWS all-day bounds are rounded to the nearest local midnight in `parseEwsEvents()`;
|
||||
`end` is exclusive.
|
||||
|
||||
## Folder mute
|
||||
|
||||
`notifications.store.ts` stores muted folders in `localStorage` (`muted-folders` key).
|
||||
Mute is per `accountId:folderId`, supports duration (ms) or permanent (`null`).
|
||||
Mute check walks up the folder parent chain — muting a parent silences all children.
|
||||
|
||||
## Design system (Liquid Glass / Material 3) — `:global()` scoped-CSS gotcha
|
||||
|
||||
`settings.store.ts` has `designSystem: 'liquid-glass' | 'material3'`, toggled in Settings
|
||||
("Дизайн"). It sets `document.documentElement.dataset.design`, and `material3-theme.ts`
|
||||
generates the full M3 color-role set (`--md-sys-color-*`) from a seed color via
|
||||
`@material/material-color-utilities` (HCT/dynamic color, dark scheme only).
|
||||
`material3-tokens.css` holds the static tokens (typescale/shape/elevation/motion) and remaps
|
||||
the app's shared aliases (`--accent`, `--text-*`, `--radius-*`, `--glass-*`, `--shadow-*`) to
|
||||
M3 roles, plus force-kills every `backdrop-filter` under `html[data-design='material3']`.
|
||||
|
||||
Per-component M3 overrides live at the bottom of each component's own `<style scoped>` block,
|
||||
selector shape: `html[data-design='material3'] .some-existing-class { ... }`.
|
||||
|
||||
**Do not wrap that selector in `:global()`.** `:global(html[data-design='material3']) .foo { }`
|
||||
compiles (Vue 3.5 `@vue/compiler-sfc`, confirmed via `compileStyle`) to a **bare**
|
||||
`html[data-design='material3'] { }` — the `.foo` part is silently dropped, and the declared
|
||||
properties end up applied directly to `<html>` instead of the intended element. With enough
|
||||
such rules piled onto one file (as happened in `SettingsView.vue`) this can visibly break
|
||||
rendering (blank screen), and everywhere else it's just a silent no-op — the M3 look you see
|
||||
elsewhere in the app comes only from the global alias remap in `material3-tokens.css`, not
|
||||
from the broken per-component rule.
|
||||
|
||||
The correct pattern needs **no `:global()` at all** — Vue's scoped-CSS transform already
|
||||
leaves ancestor combinators alone and only appends the `[data-v-hash]` scoping attribute to
|
||||
the last compound selector in the chain:
|
||||
|
||||
```css
|
||||
/* CORRECT — compiles to: html[data-design='material3'] .foo[data-v-xxxx] { ... } */
|
||||
html[data-design='material3'] .foo { color: var(--md-sys-color-on-surface); }
|
||||
|
||||
/* BROKEN — compiles to: html[data-design='material3'] { ... }, .foo silently dropped */
|
||||
:global(html[data-design='material3']) .foo { color: var(--md-sys-color-on-surface); }
|
||||
```
|
||||
|
||||
If you ever get a suspiciously blank/broken screen after adding `html[data-design=...]`
|
||||
overrides, first check `document.styleSheets` (or the injected `<style data-vite-dev-id=...>`
|
||||
tag) for the actual compiled selector — don't trust the source file at a glance.
|
||||
|
|
@ -7,7 +7,7 @@ files:
|
|||
- out/**/*
|
||||
publish:
|
||||
provider: generic
|
||||
url: https://git.vodyanoysh.ru/vodyanoy/aero-mail/releases/download/latest
|
||||
url: https://git.vodyanoy.dev/vodyanoy/aero-mail/releases/download/latest
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "aero-mail",
|
||||
"version": "0.2.21",
|
||||
"version": "0.2.29",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "aero-mail",
|
||||
"version": "0.2.21",
|
||||
"version": "0.2.29",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@material/material-color-utilities": "^0.4.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aero-mail",
|
||||
"version": "0.2.21",
|
||||
"version": "0.2.29",
|
||||
"description": "Desktop email client built with Vue 3 + Electron",
|
||||
"author": {
|
||||
"name": "d.a.kolesov",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { join, dirname } from 'path'
|
|||
import { homedir, tmpdir } from 'os'
|
||||
import { spawn } from 'child_process'
|
||||
|
||||
const REPO_API = 'https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases/latest'
|
||||
const REPO_API = 'https://git.vodyanoy.dev/api/v1/repos/vodyanoy/aero-mail/releases/latest'
|
||||
|
||||
interface ReleaseAsset {
|
||||
name: string
|
||||
|
|
@ -88,7 +88,7 @@ function spawnWindowsInstaller(installerPath: string): void {
|
|||
// затем заменяет AppImage по оригинальному пути и запускает его.
|
||||
function spawnUpdateHelper(newPath: string, oldPath: string): void {
|
||||
const scriptPath = join(tmpdir(), 'aero-mail-update.sh')
|
||||
const ICON_URL = 'https://git.vodyanoysh.ru/vodyanoy/aero-mail/raw/branch/master/resources/icon.png'
|
||||
const ICON_URL = 'https://git.vodyanoy.dev/vodyanoy/aero-mail/raw/branch/master/resources/icon.png'
|
||||
const script = [
|
||||
'#!/bin/sh',
|
||||
'PARENT="$1" NEW="$2" OLD="$3"',
|
||||
|
|
|
|||
Loading…
Reference in a new issue