diff --git a/src/main/index.ts b/src/main/index.ts
index 719ff95..779cdf1 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -1,4 +1,4 @@
-import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut } from 'electron'
+import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut, clipboard } from 'electron'
import { join, basename } from 'node:path'
import { statSync } from 'node:fs'
import { AccountManager } from './services/account-manager'
@@ -136,6 +136,10 @@ ipcMain.handle('app:openFile', async (_event, { path }: { path: string }) => {
return err ? { success: false, error: err } : { success: true }
})
+ipcMain.handle('app:copyToClipboard', (_event, { text }: { text: string }) => {
+ clipboard.writeText(text)
+})
+
app.whenReady().then(async () => {
await accountManager.initialize()
diff --git a/src/main/providers/caldav.provider.ts b/src/main/providers/caldav.provider.ts
index 348846f..760f9ea 100644
--- a/src/main/providers/caldav.provider.ts
+++ b/src/main/providers/caldav.provider.ts
@@ -10,7 +10,7 @@ import https from 'node:https'
import http from 'node:http'
import type { IncomingMessage } from 'node:http'
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
-import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
+import type { CalendarInfo, CalendarEvent, AttendeeInfo, AttendeeStatus } from '@shared/types/calendar'
import {
buildNegotiateHeader,
parseChallenge,
@@ -226,7 +226,11 @@ export class CalDavProvider {
`)
if (result.status !== 200) return []
- return this.parseEwsEvents(result.body, accountId, calendarId)
+ const events = this.parseEwsEvents(result.body, accountId, calendarId)
+ if (events.length > 0) {
+ try { await this.enrichWithAttendees(events) } catch { /* non-fatal */ }
+ }
+ return events
}
// ── EWS helpers ───────────────────────────────────────────────────────────
@@ -260,6 +264,100 @@ export class CalDavProvider {
return distinguishedId === 'calendar' ? 'Календарь' : distinguishedId
}
+ private static htmlToText(html: string): string {
+ return html
+ .replace(/
/gi, '\n')
+ .replace(/<\/p\s*>/gi, '\n\n')
+ .replace(/<\/div\s*>/gi, '\n')
+ .replace(/<\/li\s*>/gi, '\n')
+ .replace(/<\/tr\s*>/gi, '\n')
+ .replace(/<[^>]+>/g, '')
+ .replace(/ /g, ' ')
+ .replace(/</g, '<')
+ .replace(/>/g, '>')
+ .replace(/&/g, '&')
+ .replace(/"/g, '"')
+ .replace(/(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
+ .replace(/\n{3,}/g, '\n\n')
+ .trim()
+ }
+
+ private async enrichWithAttendees(events: CalendarEvent[]): Promise {
+ const eventMap = new Map()
+ for (const e of events) eventMap.set(e.uid, e)
+
+ const idsXml = events.map((e) => ``).join('\n ')
+ const result = await this.ewsReq('GetItem', `
+
+
+ IdOnly
+
+
+
+
+
+ ${idsXml}
+ `)
+
+ if (result.status !== 200) return
+
+ const responseRe = /([\s\S]*?)<\/m:Items>/g
+ let rm: RegExpExecArray | null
+ while ((rm = responseRe.exec(result.body)) !== null) {
+ const itemBlock = rm[1]
+ const idM = itemBlock.match(/([\s\S]*?)<\/t:Attendee>/g
+ let m: RegExpExecArray | null
+ while ((m = re.exec(xml)) !== null) {
+ const ab = m[1]
+ const nameM = ab.match(/([^<]+)<\/t:Name>/)
+ const emailM = ab.match(/([^<]+)<\/t:EmailAddress>/)
+ const rtM = ab.match(/([^<]+)<\/t:ResponseType>/)
+ const email = emailM ? CalDavProvider.smtpEmail(emailM[1]) : undefined
+ const name = nameM ? nameM[1].trim() : undefined
+ if (!name && !email) continue
+ result.push({
+ name: name ?? email!,
+ email: email ?? '',
+ required,
+ status: rtM ? CalDavProvider.parseRt(rtM[1]) : 'unknown',
+ })
+ }
+ return result
+ }
+
+ private parseAttendeesList(block: string): AttendeeInfo[] {
+ const req = block.match(/([\s\S]*?)<\/t:RequiredAttendees>/)
+ const opt = block.match(/([\s\S]*?)<\/t:OptionalAttendees>/)
+ return [
+ ...(req ? this.parseAttendeeSection(req[1], true) : []),
+ ...(opt ? this.parseAttendeeSection(opt[1], false) : []),
+ ]
+ }
+
private parseEwsEvents(xml: string, accountId: string, calendarId: string): CalendarEvent[] {
const events: CalendarEvent[] = []
const re = /([\s\S]*?)<\/t:CalendarItem>/g
@@ -270,6 +368,12 @@ export class CalDavProvider {
const r = block.match(new RegExp(`]*)?>([\\s\\S]*?)<\\/t:${tag}>`))
return r ? r[1].replace(/<[^>]+>/g, '').trim() : ''
}
+ const getBody = (): string | undefined => {
+ const r = block.match(/]*)?>([\\s\\S]*?)<\/t:Body>/)
+ if (!r) return undefined
+ const text = CalDavProvider.htmlToText(r[1])
+ return text || undefined
+ }
const idM = block.match(/[\s\S]*?([^<]+)<\/t:EmailAddress>/)
+ const orgBlock = block.match(/([\s\S]*?)<\/t:Organizer>/)
+ const orgName = orgBlock ? (orgBlock[1].match(/([^<]+)<\/t:Name>/) ?? [])[1]?.trim() : undefined
+ const orgEmailRaw = orgBlock ? (orgBlock[1].match(/([^<]+)<\/t:EmailAddress>/) ?? [])[1]?.trim() : undefined
+ // Exchange sometimes returns X500/routing addresses — keep only SMTP emails
+ const orgEmail = orgEmailRaw?.replace(/^smtp:/i, '').includes('@')
+ ? orgEmailRaw.replace(/^smtp:/i, '').trim()
+ : undefined
+ const organizer = orgName && orgEmail
+ ? `${orgName} <${orgEmail}>`
+ : orgName ?? orgEmail
events.push({
id: `ews::${idM[1]}`,
uid: idM[1],
@@ -290,8 +403,8 @@ export class CalDavProvider {
end: end.toISOString(),
isAllDay,
location: get('Location') || undefined,
- description: get('Body') || undefined,
- organizer: organizerM ? organizerM[1] : undefined,
+ description: getBody(),
+ organizer,
attendees: [],
status: fbStatus === 'tentative' ? 'tentative' : 'confirmed'
})
diff --git a/src/renderer/src/components/AppIcon.vue b/src/renderer/src/components/AppIcon.vue
index 131c3f5..9b7203e 100644
--- a/src/renderer/src/components/AppIcon.vue
+++ b/src/renderer/src/components/AppIcon.vue
@@ -29,6 +29,8 @@ export type IconName =
| 'location'
| 'person'
| 'people'
+ | 'copy'
+ | 'check'
const props = defineProps<{
name: IconName
@@ -171,6 +173,13 @@ const paths: Record = {
`,
+ copy: `
+
+
+ `,
+ check: `
+
+ `,
}
diff --git a/src/renderer/src/components/calendar/EventBlock.vue b/src/renderer/src/components/calendar/EventBlock.vue
index 7e2ff1b..32669da 100644
--- a/src/renderer/src/components/calendar/EventBlock.vue
+++ b/src/renderer/src/components/calendar/EventBlock.vue
@@ -92,7 +92,6 @@ const statusClass = computed(() => {
bottom: 0;
width: 3px;
background: var(--ev-color);
- box-shadow: 1px 0 8px color-mix(in srgb, var(--ev-color) 60%, transparent);
border-radius: 8px 0 0 8px;
}
@@ -101,9 +100,8 @@ const statusClass = computed(() => {
z-index: 3;
box-shadow:
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 25%, rgba(255,255,255,0.22)),
- 0 4px 16px rgba(0, 0, 0, 0.40),
- 0 0 20px color-mix(in srgb, var(--ev-color) 22%, transparent);
- filter: brightness(1.12);
+ 0 4px 16px rgba(0, 0, 0, 0.40);
+ filter: brightness(1.10);
}
.event-block.cancelled {
diff --git a/src/renderer/src/components/calendar/EventDetailPopup.vue b/src/renderer/src/components/calendar/EventDetailPopup.vue
index 55d8a8b..feaee56 100644
--- a/src/renderer/src/components/calendar/EventDetailPopup.vue
+++ b/src/renderer/src/components/calendar/EventDetailPopup.vue
@@ -1,9 +1,10 @@
-