diff --git a/package-lock.json b/package-lock.json index 9637618..69919d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "vue-mail", + "name": "aero-mail", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "vue-mail", + "name": "aero-mail", "version": "0.1.0", "hasInstallScript": true, "dependencies": { diff --git a/src/main/index.ts b/src/main/index.ts index a021050..6f8b347 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -43,6 +43,10 @@ function createWindow(): BrowserWindow { Menu.setApplicationMenu(null) +ipcMain.handle('app:setZoom', (event, { factor }: { factor: number }) => { + event.sender.setZoomFactor(Math.max(0.5, Math.min(3, factor))) +}) + app.whenReady().then(async () => { await accountManager.initialize() diff --git a/src/main/services/credential-store.ts b/src/main/services/credential-store.ts index 0e1aa4c..cd85d7b 100644 --- a/src/main/services/credential-store.ts +++ b/src/main/services/credential-store.ts @@ -16,9 +16,16 @@ export class CredentialStore { if (!existsSync(this.filePath)) return const raw = await readFile(this.filePath, 'utf-8') const parsed = JSON.parse(raw) as Record - for (const [key, encrypted] of Object.entries(parsed)) { + for (const [key, value] of Object.entries(parsed)) { try { - this.data[key] = safeStorage.decryptString(Buffer.from(encrypted, 'base64')) + if (value.startsWith('plain:')) { + this.data[key] = Buffer.from(value.slice(6), 'base64').toString() + } else if (value.startsWith('enc:')) { + this.data[key] = safeStorage.decryptString(Buffer.from(value.slice(4), 'base64')) + } else { + // старый формат без префикса — пробуем расшифровать + this.data[key] = safeStorage.decryptString(Buffer.from(value, 'base64')) + } } catch { console.warn(`Failed to decrypt credential for ${key}`) } @@ -43,14 +50,20 @@ export class CredentialStore { } private async persist(): Promise { - const encrypted: Record = {} + const canEncrypt = safeStorage.isEncryptionAvailable() + const out: Record = {} for (const [key, value] of Object.entries(this.data)) { - encrypted[key] = safeStorage.encryptString(value).toString('base64') + if (canEncrypt) { + out[key] = 'enc:' + safeStorage.encryptString(value).toString('base64') + } else { + // safeStorage недоступен (нет keychain-демона в системе) — храним plain + out[key] = 'plain:' + Buffer.from(value).toString('base64') + } } const dir = dirname(this.filePath) if (!existsSync(dir)) { await mkdir(dir, { recursive: true }) } - await writeFile(this.filePath, JSON.stringify(encrypted, null, 2), 'utf-8') + await writeFile(this.filePath, JSON.stringify(out, null, 2), 'utf-8') } } diff --git a/src/renderer/src/components/accounts/AddAccountDialog.vue b/src/renderer/src/components/accounts/AddAccountDialog.vue index e731323..7081ee6 100644 --- a/src/renderer/src/components/accounts/AddAccountDialog.vue +++ b/src/renderer/src/components/accounts/AddAccountDialog.vue @@ -80,7 +80,7 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value && imapP -
+
{{ error }}
@@ -128,47 +128,112 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value && imapP diff --git a/src/renderer/src/stores/settings.store.ts b/src/renderer/src/stores/settings.store.ts index 326aae9..6d9a7d2 100644 --- a/src/renderer/src/stores/settings.store.ts +++ b/src/renderer/src/stores/settings.store.ts @@ -62,6 +62,11 @@ function applyAccentColor(hex: string): void { root.style.setProperty('--accent-swipe-bg', `rgba(${r},${g},${b},${swipeAlpha})`) } +// ─── UI Scale ──────────────────────────────────────────── +function applyUiScale(scale: number): void { + window.api.invoke('app:setZoom', { factor: scale }) +} + // ─── Auto-check intervals ──────────────────────────────── export const AUTO_CHECK_INTERVALS: { value: number; label: string }[] = [ { value: 0, label: 'Выключено' }, @@ -79,6 +84,7 @@ function load(): { swipeRightAction?: SwipeAction accentColor?: string autoCheckInterval?: number + uiScale?: number } { try { return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '{}') @@ -94,15 +100,22 @@ export const useSettingsStore = defineStore('settings', () => { const swipeRightAction = ref(saved.swipeRightAction ?? 'toggleRead') const accentColor = ref(saved.accentColor ?? '#a8e600') const autoCheckInterval = ref(saved.autoCheckInterval ?? 5) + const uiScale = ref(saved.uiScale ?? 1.0) // Apply on init applyAccentColor(accentColor.value) + applyUiScale(uiScale.value) watch(accentColor, (hex) => { applyAccentColor(hex) persist() }) + watch(uiScale, (scale) => { + applyUiScale(scale) + persist() + }) + watch([swipeLeftAction, swipeRightAction, autoCheckInterval], persist) function persist(): void { @@ -111,8 +124,9 @@ export const useSettingsStore = defineStore('settings', () => { swipeRightAction: swipeRightAction.value, accentColor: accentColor.value, autoCheckInterval: autoCheckInterval.value, + uiScale: uiScale.value, })) } - return { swipeLeftAction, swipeRightAction, accentColor, autoCheckInterval } + return { swipeLeftAction, swipeRightAction, accentColor, autoCheckInterval, uiScale } }) diff --git a/src/renderer/src/views/SettingsView.vue b/src/renderer/src/views/SettingsView.vue index b83b876..493bfae 100644 --- a/src/renderer/src/views/SettingsView.vue +++ b/src/renderer/src/views/SettingsView.vue @@ -59,6 +59,39 @@ const swipeOptions: { value: SwipeAction; label: string }[] = (
+ +
+

Масштаб интерфейса

+

Масштабирует весь интерфейс приложения

+
+ +
+ {{ Math.round(settingsStore.uiScale * 100) }}% + +
+
+
+ 50% + 100% + 150% + 200% +
+
+

Авто-проверка почты

@@ -283,6 +316,97 @@ const swipeOptions: { value: SwipeAction; label: string }[] = ( } +/* Масштаб */ +.scale-row { + display: flex; + align-items: center; + gap: 14px; +} + +.scale-slider { + flex: 1; + -webkit-appearance: none; + appearance: none; + height: 4px; + border-radius: var(--radius-full); + background: rgba(255, 255, 255, 0.10); + border: none; + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); + outline: none; + cursor: pointer; + padding: 0; +} + +.scale-slider::-webkit-slider-runnable-track { + height: 4px; + border-radius: var(--radius-full); + background: linear-gradient( + to right, + var(--accent) var(--pct, 33%), + rgba(255, 255, 255, 0.10) var(--pct, 33%) + ); +} + +.scale-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 18px; + height: 18px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.95); + box-shadow: + inset 0 1px 0 rgba(255, 255, 255, 1), + 0 2px 8px rgba(0, 0, 0, 0.45), + 0 0 0 1px rgba(0, 0, 0, 0.15); + cursor: pointer; + margin-top: -7px; + transition: transform var(--transition-fast), box-shadow var(--transition-fast); +} + +.scale-slider::-webkit-slider-thumb:hover { + transform: scale(1.15); + box-shadow: + inset 0 1px 0 rgba(255, 255, 255, 1), + 0 3px 12px rgba(0, 0, 0, 0.5), + 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); +} + +.scale-slider::-webkit-slider-thumb:active { + transform: scale(1.05); +} + +.scale-value { + display: flex; + align-items: center; + gap: 6px; + min-width: 52px; + font-size: 13px; + font-weight: 600; + color: var(--text-primary); + font-variant-numeric: tabular-nums; +} + +.scale-reset { + font-size: 14px; + color: var(--text-muted); + line-height: 1; + transition: color var(--transition-fast), transform var(--transition-fast); +} + +.scale-reset:hover { + color: var(--text-secondary); + transform: rotate(-30deg); +} + +.scale-ticks { + display: flex; + justify-content: space-between; + margin-top: 6px; + padding: 0 1px; + font-size: 10px; + color: var(--text-muted); +} + /* Color picker */ .color-picker-row { display: flex; diff --git a/src/shared/types/ipc.ts b/src/shared/types/ipc.ts index 23a3190..4d255e3 100644 --- a/src/shared/types/ipc.ts +++ b/src/shared/types/ipc.ts @@ -29,6 +29,8 @@ export interface IpcChannelMap { ] 'oauth:gmail': [void, { email: string; accessToken: string; refreshToken: string } | null] + + 'app:setZoom': [{ factor: number }, void] } export interface IpcEventMap {