Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97bc26a332 | ||
|
|
55c8d430ca | ||
|
|
ef45140d32 | ||
|
|
0effb97691 | ||
|
|
f7ee204262 | ||
|
|
0c1f182b6b | ||
|
|
13010c158d | ||
|
|
de26e6da2e | ||
|
|
ddb3422852 | ||
|
|
d9a2529261 | ||
|
|
e70224317d | ||
|
|
a9ecf164ab | ||
|
|
0db3cbc959 | ||
|
|
387273288c | ||
|
|
8eff9fdfab | ||
|
|
d915e5fb64 |
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## 1.4.8 (2026-03-23)
|
||||
|
||||
### Features
|
||||
|
||||
- **Email**: Add support for marking emails as answered or forwarded and display status icons in email list and thread views
|
||||
- **Email**: Enhance identity selection by supporting sub-addressing (plus addressing) in email composer
|
||||
- **Settings**: Add notification settings with sound picker, preview playback, and configurable alert sounds
|
||||
- **Settings**: Add default mail program settings with localization support across all locales
|
||||
- **Auth**: Implement path prefix handling for OAuth callbacks and login redirects, enabling reverse proxy deployments
|
||||
- **Validation**: Add all multi-part TLDs for domain validation in favicon API (#81)
|
||||
|
||||
### Fixes
|
||||
|
||||
- **Calendar**: Fix bugs in duration parsing, RFC compliance, and event handling across calendar components
|
||||
- **Calendar**: Detect tasks created by external CalDAV clients such as Thunderbird
|
||||
- **Settings**: Enhance account settings with username and authentication method display (#90)
|
||||
|
||||
## 1.4.7 (2026-03-21)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
A modern, self-hosted webmail client for [Stalwart Mail Server](https://stalw.art/).<br/>
|
||||
Built with Next.js and the JMAP protocol.
|
||||
|
||||
[](LICENSE)
|
||||
[](CHANGELOG.md)
|
||||
[](https://ghcr.io/bulwarkmail/webmail)
|
||||
[](LICENSE)
|
||||
[](https://discord.gg/tYCujymGrT)
|
||||
[](CHANGELOG.md)
|
||||
[](https://ghcr.io/bulwarkmail/webmail)
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Suspense, useEffect, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useAuthStore } from "@/stores/auth-store";
|
||||
import { getPathPrefix } from "@/lib/browser-navigation";
|
||||
import { Loader2, AlertCircle } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useParams } from "next/navigation";
|
||||
@@ -48,7 +49,8 @@ function OAuthCallbackInner() {
|
||||
return;
|
||||
}
|
||||
|
||||
const redirectUri = `${window.location.origin}/${params.locale}/auth/callback`;
|
||||
const prefix = getPathPrefix(params.locale as string);
|
||||
const redirectUri = `${window.location.origin}${prefix}/${params.locale}/auth/callback`;
|
||||
|
||||
loginWithOAuth(serverUrl, code, codeVerifier, redirectUri)
|
||||
.then((success) => {
|
||||
@@ -57,7 +59,7 @@ function OAuthCallbackInner() {
|
||||
sessionStorage.removeItem("oauth_code_verifier");
|
||||
sessionStorage.removeItem("oauth_server_url");
|
||||
sessionStorage.removeItem("oauth_add_account_mode");
|
||||
let redirectTo = `/${params.locale}`;
|
||||
let redirectTo = `${prefix}/${params.locale}`;
|
||||
try {
|
||||
const saved = sessionStorage.getItem('redirect_after_login');
|
||||
if (saved) {
|
||||
@@ -75,10 +77,11 @@ function OAuthCallbackInner() {
|
||||
});
|
||||
} else if (state) {
|
||||
// Server-side SSO flow — state was stored in encrypted httpOnly cookie
|
||||
const ssoPrefix = getPathPrefix(params.locale as string);
|
||||
loginWithServerSso(code, state)
|
||||
.then((success) => {
|
||||
if (success) {
|
||||
let redirectTo = `/${params.locale}`;
|
||||
let redirectTo = `${ssoPrefix}/${params.locale}`;
|
||||
try {
|
||||
const saved = sessionStorage.getItem('redirect_after_login');
|
||||
if (saved) {
|
||||
@@ -114,7 +117,7 @@ function OAuthCallbackInner() {
|
||||
</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => router.push(`/${params.locale}/login`)}
|
||||
onClick={() => router.push(`${getPathPrefix(params.locale as string)}/${params.locale}/login`)}
|
||||
>
|
||||
{t("oauth_error.back_to_login")}
|
||||
</Button>
|
||||
|
||||
+31
-1
@@ -407,7 +407,10 @@ export default function Home() {
|
||||
// Handle new email notifications - play sound
|
||||
useEffect(() => {
|
||||
if (newEmailNotification) {
|
||||
playNotificationSound();
|
||||
const { emailNotificationsEnabled, emailNotificationSound, notificationSoundChoice } = useSettingsStore.getState();
|
||||
if (emailNotificationsEnabled && emailNotificationSound) {
|
||||
playNotificationSound(notificationSoundChoice);
|
||||
}
|
||||
debug.log('New email received:', newEmailNotification.subject);
|
||||
clearNewEmailNotification();
|
||||
}
|
||||
@@ -441,9 +444,27 @@ export default function Home() {
|
||||
if (!client) return;
|
||||
|
||||
try {
|
||||
const effectiveMode = pendingDraft?.mode ?? composerMode;
|
||||
const originalEmailId = selectedEmail?.id;
|
||||
|
||||
await sendEmail(client, data.to, data.subject, data.body, data.cc, data.bcc, data.identityId, data.fromEmail, data.draftId, data.fromName, data.htmlBody, data.attachments);
|
||||
setShowComposer(false);
|
||||
|
||||
// Mark the original email with $answered or $forwarded keyword
|
||||
if (originalEmailId && (effectiveMode === 'reply' || effectiveMode === 'replyAll')) {
|
||||
try {
|
||||
await client.setKeyword(originalEmailId, '$answered');
|
||||
} catch (e) {
|
||||
debug.error('Failed to set $answered keyword:', e);
|
||||
}
|
||||
} else if (originalEmailId && effectiveMode === 'forward') {
|
||||
try {
|
||||
await client.setKeyword(originalEmailId, '$forwarded');
|
||||
} catch (e) {
|
||||
debug.error('Failed to set $forwarded keyword:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh the current mailbox to update the UI
|
||||
await fetchEmails(client, selectedMailbox);
|
||||
} catch (error) {
|
||||
@@ -858,6 +879,8 @@ export default function Home() {
|
||||
// Append signature from the primary identity
|
||||
const finalBody = appendPlainTextSignature(body, primaryIdentity);
|
||||
|
||||
const originalEmailId = selectedEmail.id;
|
||||
|
||||
// Send reply with just the body text
|
||||
await sendEmail(
|
||||
client,
|
||||
@@ -872,6 +895,13 @@ export default function Home() {
|
||||
primaryIdentity?.name || undefined
|
||||
);
|
||||
|
||||
// Mark the original email as answered
|
||||
try {
|
||||
await client.setKeyword(originalEmailId, '$answered');
|
||||
} catch (e) {
|
||||
debug.error('Failed to set $answered keyword:', e);
|
||||
}
|
||||
|
||||
// Refresh emails to show the sent reply
|
||||
await fetchEmails(client, selectedMailbox);
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
BookUser,
|
||||
KeyRound,
|
||||
PanelLeftClose,
|
||||
Bell,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -44,6 +45,7 @@ import { FilesSettingsComponent } from '@/components/settings/files-settings';
|
||||
import { ContactsSettings } from '@/components/settings/contacts-settings';
|
||||
import { SmimeSettings } from '@/components/settings/smime-settings';
|
||||
import { SidebarAppsSettings } from '@/components/settings/sidebar-apps-settings';
|
||||
import { NotificationSettings } from '@/components/settings/notification-settings';
|
||||
import { useAuthStore, redirectToLogin } from '@/stores/auth-store';
|
||||
import { useEmailStore } from '@/stores/email-store';
|
||||
import { useIsDesktop } from '@/hooks/use-media-query';
|
||||
@@ -55,7 +57,7 @@ import { ResizeHandle } from '@/components/layout/resize-handle';
|
||||
import { useConfig } from '@/hooks/use-config';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
type Tab = 'appearance' | 'email' | 'account' | 'security' | 'identities' | 'encryption' | 'vacation' | 'calendar' | 'contacts' | 'filters' | 'templates' | 'folders' | 'keywords' | 'files' | 'sidebar_apps' | 'advanced';
|
||||
type Tab = 'appearance' | 'email' | 'notifications' | 'account' | 'security' | 'identities' | 'encryption' | 'vacation' | 'calendar' | 'contacts' | 'filters' | 'templates' | 'folders' | 'keywords' | 'files' | 'sidebar_apps' | 'advanced';
|
||||
type TabGroup = 'general' | 'account' | 'organization' | 'apps' | 'system';
|
||||
|
||||
interface TabDef {
|
||||
@@ -68,6 +70,7 @@ interface TabDef {
|
||||
const tabIcons: Record<Tab, LucideIcon> = {
|
||||
appearance: Palette,
|
||||
email: Mail,
|
||||
notifications: Bell,
|
||||
account: User,
|
||||
security: Shield,
|
||||
identities: UserPen,
|
||||
@@ -138,6 +141,7 @@ export default function SettingsPage() {
|
||||
const tabs: TabDef[] = [
|
||||
{ id: 'appearance', label: t('tabs.appearance'), icon: tabIcons.appearance, group: 'general' },
|
||||
{ id: 'email', label: t('tabs.email'), icon: tabIcons.email, group: 'general' },
|
||||
{ id: 'notifications', label: t('tabs.notifications'), icon: tabIcons.notifications, group: 'general' },
|
||||
{ id: 'account', label: t('tabs.account'), icon: tabIcons.account, group: 'account' },
|
||||
...(stalwartFeaturesEnabled ? [{ id: 'security' as Tab, label: t('tabs.security'), icon: tabIcons.security, group: 'account' as TabGroup }] : []),
|
||||
{ id: 'identities', label: t('tabs.identities'), icon: tabIcons.identities, group: 'account' },
|
||||
@@ -177,6 +181,7 @@ export default function SettingsPage() {
|
||||
<>
|
||||
{activeTab === 'appearance' && <AppearanceSettings />}
|
||||
{activeTab === 'email' && <EmailSettings />}
|
||||
{activeTab === 'notifications' && <NotificationSettings />}
|
||||
{activeTab === 'account' && <AccountSettings />}
|
||||
{activeTab === 'security' && <AccountSecuritySettings />}
|
||||
{activeTab === 'identities' && <IdentitySettings />}
|
||||
|
||||
+352
-26
@@ -40,32 +40,358 @@ function isValidDomain(domain: string): boolean {
|
||||
|
||||
// Known multi-part TLDs where the registrable domain includes one extra label.
|
||||
const MULTI_PART_TLDS = new Set([
|
||||
"co.uk", "org.uk", "me.uk", "ac.uk", "gov.uk", "net.uk",
|
||||
"co.jp", "or.jp", "ne.jp", "ac.jp", "go.jp",
|
||||
"co.kr", "or.kr", "go.kr", "ac.kr",
|
||||
"co.in", "net.in", "org.in", "ac.in", "gov.in",
|
||||
"co.nz", "org.nz", "net.nz", "govt.nz", "ac.nz",
|
||||
"co.za", "org.za", "net.za", "gov.za", "ac.za",
|
||||
"com.au", "net.au", "org.au", "edu.au", "gov.au",
|
||||
"com.br", "net.br", "org.br", "edu.br", "gov.br",
|
||||
"com.cn", "net.cn", "org.cn", "gov.cn", "edu.cn",
|
||||
"com.mx", "net.mx", "org.mx", "gob.mx", "edu.mx",
|
||||
"com.ar", "net.ar", "org.ar", "gob.ar", "edu.ar",
|
||||
"com.tw", "net.tw", "org.tw", "edu.tw", "gov.tw",
|
||||
"com.hk", "net.hk", "org.hk", "edu.hk", "gov.hk",
|
||||
"com.sg", "net.sg", "org.sg", "edu.sg", "gov.sg",
|
||||
"com.my", "net.my", "org.my", "edu.my", "gov.my",
|
||||
"com.ph", "net.ph", "org.ph", "edu.ph", "gov.ph",
|
||||
"com.pk", "net.pk", "org.pk", "edu.pk", "gov.pk",
|
||||
"com.ng", "net.ng", "org.ng", "edu.ng", "gov.ng",
|
||||
"co.il", "org.il", "net.il", "ac.il", "gov.il",
|
||||
"co.th", "or.th", "ac.th", "go.th", "in.th",
|
||||
"co.id", "or.id", "ac.id", "go.id", "web.id",
|
||||
"com.tr", "net.tr", "org.tr", "edu.tr", "gov.tr",
|
||||
"com.ua", "net.ua", "org.ua", "edu.ua", "gov.ua",
|
||||
"com.eg", "net.eg", "org.eg", "edu.eg", "gov.eg",
|
||||
"com.sa", "net.sa", "org.sa", "edu.sa", "gov.sa",
|
||||
"co.ke", "or.ke", "ac.ke", "go.ke", "ne.ke",
|
||||
// .ac
|
||||
"com.ac", "gov.ac", "mil.ac", "net.ac", "org.ac",
|
||||
// .ae
|
||||
"ac.ae", "co.ae", "gov.ae", "mil.ae", "name.ae", "net.ae", "org.ae", "pro.ae", "sch.ae",
|
||||
// .af
|
||||
"com.af", "edu.af", "gov.af", "net.af", "org.af",
|
||||
// .al
|
||||
"com.al", "edu.al", "gov.al", "mil.al", "net.al", "org.al",
|
||||
// .ao
|
||||
"co.ao", "ed.ao", "gv.ao", "it.ao", "og.ao", "pb.ao",
|
||||
// .ar
|
||||
"com.ar", "edu.ar", "gob.ar", "gov.ar", "int.ar", "mil.ar", "net.ar", "org.ar", "tur.ar",
|
||||
// .at
|
||||
"ac.at", "co.at", "gv.at", "or.at",
|
||||
// .au
|
||||
"asn.au", "com.au", "csiro.au", "edu.au", "gov.au", "id.au", "net.au", "org.au",
|
||||
// .ba
|
||||
"co.ba", "com.ba", "edu.ba", "gov.ba", "mil.ba", "net.ba", "org.ba", "rs.ba",
|
||||
"unbi.ba", "unmo.ba", "unsa.ba", "untz.ba", "unze.ba",
|
||||
// .bb
|
||||
"biz.bb", "co.bb", "com.bb", "edu.bb", "gov.bb", "info.bb", "net.bb", "org.bb",
|
||||
"store.bb", "tv.bb",
|
||||
// .bh
|
||||
"biz.bh", "cc.bh", "com.bh", "edu.bh", "gov.bh", "info.bh", "net.bh", "org.bh",
|
||||
// .bn
|
||||
"com.bn", "edu.bn", "gov.bn", "net.bn", "org.bn",
|
||||
// .bo
|
||||
"com.bo", "edu.bo", "gob.bo", "gov.bo", "int.bo", "mil.bo", "net.bo", "org.bo", "tv.bo",
|
||||
// .br
|
||||
"adm.br", "adv.br", "agr.br", "am.br", "arq.br", "art.br", "ato.br", "b.br",
|
||||
"bio.br", "blog.br", "bmd.br", "cim.br", "cng.br", "cnt.br", "com.br", "coop.br",
|
||||
"ecn.br", "edu.br", "eng.br", "esp.br", "etc.br", "eti.br", "far.br", "flog.br",
|
||||
"fm.br", "fnd.br", "fot.br", "fst.br", "g12.br", "ggf.br", "gov.br", "imb.br",
|
||||
"ind.br", "inf.br", "jor.br", "jus.br", "lel.br", "mat.br", "med.br", "mil.br",
|
||||
"mus.br", "net.br", "nom.br", "not.br", "ntr.br", "odo.br", "org.br", "ppg.br",
|
||||
"pro.br", "psc.br", "psi.br", "qsl.br", "rec.br", "slg.br", "srv.br", "tmp.br",
|
||||
"trd.br", "tur.br", "tv.br", "vet.br", "vlog.br", "wiki.br", "zlg.br",
|
||||
// .bs
|
||||
"com.bs", "edu.bs", "gov.bs", "net.bs", "org.bs",
|
||||
// .bz
|
||||
"com.bz", "edu.bz", "gov.bz", "net.bz", "org.bz",
|
||||
// .ca
|
||||
"ab.ca", "bc.ca", "mb.ca", "nb.ca", "nf.ca", "nl.ca", "ns.ca", "nt.ca",
|
||||
"nu.ca", "on.ca", "pe.ca", "qc.ca", "sk.ca", "yk.ca",
|
||||
// .ck
|
||||
"biz.ck", "co.ck", "edu.ck", "gen.ck", "gov.ck", "info.ck", "net.ck", "org.ck",
|
||||
// .cn
|
||||
"ac.cn", "ah.cn", "bj.cn", "com.cn", "cq.cn", "edu.cn", "fj.cn", "gd.cn",
|
||||
"gov.cn", "gs.cn", "gx.cn", "gz.cn", "ha.cn", "hb.cn", "he.cn", "hi.cn",
|
||||
"hl.cn", "hn.cn", "jl.cn", "js.cn", "jx.cn", "ln.cn", "mil.cn", "net.cn",
|
||||
"nm.cn", "nx.cn", "org.cn", "qh.cn", "sc.cn", "sd.cn", "sh.cn", "sn.cn",
|
||||
"sx.cn", "tj.cn", "tw.cn", "xj.cn", "xz.cn", "yn.cn", "zj.cn",
|
||||
// .co
|
||||
"com.co", "edu.co", "gov.co", "mil.co", "net.co", "nom.co", "org.co",
|
||||
// .cr
|
||||
"ac.cr", "co.cr", "ed.cr", "fi.cr", "go.cr", "or.cr", "sa.cr",
|
||||
// .cy
|
||||
"ac.cy", "biz.cy", "com.cy", "ekloges.cy", "gov.cy", "ltd.cy", "name.cy",
|
||||
"net.cy", "org.cy", "parliament.cy", "press.cy", "pro.cy", "tm.cy",
|
||||
// .do
|
||||
"art.do", "com.do", "edu.do", "gob.do", "gov.do", "mil.do", "net.do", "org.do",
|
||||
"sld.do", "web.do",
|
||||
// .dz
|
||||
"art.dz", "asso.dz", "com.dz", "edu.dz", "gov.dz", "net.dz", "org.dz", "pol.dz",
|
||||
// .ec
|
||||
"com.ec", "edu.ec", "fin.ec", "gov.ec", "info.ec", "med.ec", "mil.ec", "net.ec",
|
||||
"org.ec", "pro.ec",
|
||||
// .eg
|
||||
"com.eg", "edu.eg", "eun.eg", "gov.eg", "mil.eg", "name.eg", "net.eg", "org.eg", "sci.eg",
|
||||
// .er
|
||||
"com.er", "edu.er", "gov.er", "ind.er", "mil.er", "net.er", "org.er", "rochest.er", "w.er",
|
||||
// .es
|
||||
"com.es", "edu.es", "gob.es", "nom.es", "org.es",
|
||||
// .et
|
||||
"biz.et", "com.et", "edu.et", "gov.et", "info.et", "name.et", "net.et", "org.et",
|
||||
// .fj
|
||||
"ac.fj", "biz.fj", "com.fj", "info.fj", "mil.fj", "name.fj", "net.fj", "org.fj", "pro.fj",
|
||||
// .fk
|
||||
"ac.fk", "co.fk", "gov.fk", "net.fk", "nom.fk", "org.fk",
|
||||
// .fr
|
||||
"asso.fr", "com.fr", "gouv.fr", "nom.fr", "prd.fr", "presse.fr", "tm.fr",
|
||||
// .gg
|
||||
"co.gg", "net.gg", "org.gg",
|
||||
// .gh
|
||||
"com.gh", "edu.gh", "gov.gh", "mil.gh", "org.gh",
|
||||
// .gn
|
||||
"ac.gn", "com.gn", "gov.gn", "net.gn", "org.gn",
|
||||
// .gr
|
||||
"com.gr", "edu.gr", "gov.gr", "mil.gr", "net.gr", "org.gr",
|
||||
// .gt
|
||||
"com.gt", "edu.gt", "gob.gt", "ind.gt", "mil.gt", "net.gt", "org.gt",
|
||||
// .gu
|
||||
"com.gu", "edu.gu", "gov.gu", "net.gu", "org.gu",
|
||||
// .hk
|
||||
"com.hk", "edu.hk", "gov.hk", "idv.hk", "net.hk", "org.hk",
|
||||
// .id
|
||||
"ac.id", "co.id", "go.id", "mil.id", "net.id", "or.id", "sch.id", "web.id",
|
||||
// .il
|
||||
"ac.il", "co.il", "gov.il", "idf.il", "k12.il", "muni.il", "net.il", "org.il",
|
||||
// .in
|
||||
"4fd.in", "ac.in", "co.in", "edu.in", "ernet.in", "firm.in", "gen.in", "gov.in",
|
||||
"ind.in", "mil.in", "net.in", "nic.in", "org.in", "res.in",
|
||||
// .iq
|
||||
"com.iq", "edu.iq", "gov.iq", "mil.iq", "net.iq", "org.iq",
|
||||
// .ir
|
||||
"ac.ir", "co.ir", "dnssec.ir", "gov.ir", "id.ir", "net.ir", "org.ir", "sch.ir",
|
||||
// .it
|
||||
"edu.it", "gov.it",
|
||||
// .je
|
||||
"co.je", "net.je", "org.je",
|
||||
// .jo
|
||||
"com.jo", "edu.jo", "gov.jo", "mil.jo", "name.jo", "net.jo", "org.jo", "sch.jo",
|
||||
// .jp
|
||||
"ac.jp", "ad.jp", "co.jp", "ed.jp", "go.jp", "gr.jp", "lg.jp", "ne.jp", "or.jp",
|
||||
// .ke
|
||||
"ac.ke", "co.ke", "go.ke", "info.ke", "me.ke", "mobi.ke", "ne.ke", "or.ke", "sc.ke",
|
||||
// .kh
|
||||
"com.kh", "edu.kh", "gov.kh", "mil.kh", "net.kh", "org.kh", "per.kh",
|
||||
// .ki
|
||||
"biz.ki", "com.ki", "de.ki", "edu.ki", "gov.ki", "info.ki", "mob.ki", "net.ki",
|
||||
"org.ki", "tel.ki",
|
||||
// .km
|
||||
"asso.km", "com.km", "coop.km", "edu.km", "gouv.km", "medecin.km", "mil.km",
|
||||
"nom.km", "notaires.km", "pharmaciens.km", "presse.km", "tm.km", "veterinaire.km",
|
||||
// .kn
|
||||
"edu.kn", "gov.kn", "net.kn", "org.kn",
|
||||
// .kr
|
||||
"ac.kr", "busan.kr", "chungbuk.kr", "chungnam.kr", "co.kr", "daegu.kr",
|
||||
"daejeon.kr", "es.kr", "gangwon.kr", "go.kr", "gwangju.kr", "gyeongbuk.kr",
|
||||
"gyeonggi.kr", "gyeongnam.kr", "hs.kr", "incheon.kr", "jeju.kr", "jeonbuk.kr",
|
||||
"jeonnam.kr", "kg.kr", "mil.kr", "ms.kr", "ne.kr", "or.kr", "pe.kr", "re.kr",
|
||||
"sc.kr", "seoul.kr", "ulsan.kr",
|
||||
// .kw
|
||||
"com.kw", "edu.kw", "gov.kw", "net.kw", "org.kw",
|
||||
// .ky
|
||||
"com.ky", "edu.ky", "gov.ky", "net.ky", "org.ky",
|
||||
// .kz
|
||||
"com.kz", "edu.kz", "gov.kz", "mil.kz", "net.kz", "org.kz",
|
||||
// .lb
|
||||
"com.lb", "edu.lb", "gov.lb", "net.lb", "org.lb",
|
||||
// .lk
|
||||
"assn.lk", "com.lk", "edu.lk", "gov.lk", "grp.lk", "hotel.lk", "int.lk", "ltd.lk",
|
||||
"net.lk", "ngo.lk", "org.lk", "sch.lk", "soc.lk", "web.lk",
|
||||
// .lr
|
||||
"com.lr", "edu.lr", "gov.lr", "net.lr", "org.lr",
|
||||
// .lv
|
||||
"asn.lv", "com.lv", "conf.lv", "edu.lv", "gov.lv", "id.lv", "mil.lv", "net.lv", "org.lv",
|
||||
// .ly
|
||||
"com.ly", "edu.ly", "gov.ly", "id.ly", "med.ly", "net.ly", "org.ly", "plc.ly", "sch.ly",
|
||||
// .ma
|
||||
"ac.ma", "co.ma", "gov.ma", "net.ma", "org.ma", "press.ma",
|
||||
// .mc
|
||||
"asso.mc", "tm.mc",
|
||||
// .me
|
||||
"ac.me", "co.me", "edu.me", "gov.me", "its.me", "net.me", "org.me", "priv.me",
|
||||
// .mg
|
||||
"com.mg", "edu.mg", "gov.mg", "mil.mg", "nom.mg", "org.mg", "prd.mg", "tm.mg",
|
||||
// .mk
|
||||
"com.mk", "edu.mk", "gov.mk", "inf.mk", "name.mk", "net.mk", "org.mk", "pro.mk",
|
||||
// .ml
|
||||
"com.ml", "edu.ml", "gov.ml", "net.ml", "org.ml", "presse.ml",
|
||||
// .mn
|
||||
"edu.mn", "gov.mn", "org.mn",
|
||||
// .mo
|
||||
"com.mo", "edu.mo", "gov.mo", "net.mo", "org.mo",
|
||||
// .mt
|
||||
"com.mt", "edu.mt", "gov.mt", "net.mt", "org.mt",
|
||||
// .mu
|
||||
"ac.mu", "co.mu", "com.mu", "gov.mu", "net.mu", "or.mu", "org.mu",
|
||||
// .mv
|
||||
"aero.mv", "biz.mv", "com.mv", "coop.mv", "edu.mv", "gov.mv", "info.mv",
|
||||
"int.mv", "mil.mv", "museum.mv", "name.mv", "net.mv", "org.mv", "pro.mv",
|
||||
// .mw
|
||||
"ac.mw", "co.mw", "com.mw", "coop.mw", "edu.mw", "gov.mw", "int.mw",
|
||||
"museum.mw", "net.mw", "org.mw",
|
||||
// .mx
|
||||
"com.mx", "edu.mx", "gob.mx", "net.mx", "org.mx",
|
||||
// .my
|
||||
"com.my", "edu.my", "gov.my", "mil.my", "name.my", "net.my", "org.my", "sch.my",
|
||||
// .mz
|
||||
"ac.mz", "co.mz", "edu.mz", "gov.mz", "org.mz",
|
||||
// .na
|
||||
"co.na", "com.na",
|
||||
// .nf
|
||||
"arts.nf", "com.nf", "firm.nf", "info.nf", "net.nf", "other.nf", "per.nf",
|
||||
"rec.nf", "store.nf", "web.nf",
|
||||
// .ng
|
||||
"biz.ng", "com.ng", "edu.ng", "gov.ng", "mil.ng", "mobi.ng", "name.ng",
|
||||
"net.ng", "org.ng", "sch.ng",
|
||||
// .ni
|
||||
"ac.ni", "co.ni", "com.ni", "edu.ni", "gob.ni", "mil.ni", "net.ni", "nom.ni", "org.ni",
|
||||
// .np
|
||||
"com.np", "edu.np", "gov.np", "mil.np", "net.np", "org.np",
|
||||
// .nr
|
||||
"biz.nr", "com.nr", "edu.nr", "gov.nr", "info.nr", "net.nr", "org.nr",
|
||||
// .nz
|
||||
"ac.nz", "co.nz", "cri.nz", "geek.nz", "gen.nz", "govt.nz", "health.nz",
|
||||
"iwi.nz", "maori.nz", "mil.nz", "net.nz", "org.nz", "parliament.nz", "school.nz",
|
||||
// .om
|
||||
"ac.om", "biz.om", "co.om", "com.om", "edu.om", "gov.om", "med.om", "mil.om",
|
||||
"museum.om", "net.om", "org.om", "pro.om", "sch.om",
|
||||
// .pa
|
||||
"abo.pa", "ac.pa", "com.pa", "edu.pa", "gob.pa", "ing.pa", "med.pa", "net.pa",
|
||||
"nom.pa", "org.pa", "sld.pa",
|
||||
// .pe
|
||||
"com.pe", "edu.pe", "gob.pe", "mil.pe", "net.pe", "nom.pe", "org.pe", "sld.pe",
|
||||
// .ph
|
||||
"com.ph", "edu.ph", "gov.ph", "i.ph", "mil.ph", "net.ph", "ngo.ph", "org.ph",
|
||||
// .pk
|
||||
"biz.pk", "com.pk", "edu.pk", "fam.pk", "gob.pk", "gok.pk", "gon.pk", "gop.pk",
|
||||
"gos.pk", "gov.pk", "net.pk", "org.pk", "web.pk",
|
||||
// .pl
|
||||
"art.pl", "bialystok.pl", "biz.pl", "com.pl", "edu.pl", "gda.pl", "gdansk.pl",
|
||||
"gorzow.pl", "gov.pl", "info.pl", "katowice.pl", "krakow.pl", "lodz.pl",
|
||||
"lublin.pl", "mil.pl", "net.pl", "ngo.pl", "olsztyn.pl", "org.pl", "poznan.pl",
|
||||
"pwr.pl", "radom.pl", "slupsk.pl", "szczecin.pl", "torun.pl", "warszawa.pl",
|
||||
"waw.pl", "wroc.pl", "wroclaw.pl", "zgora.pl",
|
||||
// .pr
|
||||
"ac.pr", "biz.pr", "com.pr", "edu.pr", "est.pr", "gov.pr", "info.pr", "isla.pr",
|
||||
"name.pr", "net.pr", "org.pr", "pro.pr", "prof.pr",
|
||||
// .ps
|
||||
"com.ps", "edu.ps", "gov.ps", "net.ps", "org.ps", "plo.ps", "sec.ps",
|
||||
// .pt
|
||||
"com.pt", "edu.pt", "gov.pt", "int.pt", "net.pt", "nome.pt", "org.pt", "publ.pt",
|
||||
// .pw
|
||||
"belau.pw", "co.pw", "ed.pw", "go.pw", "ne.pw", "or.pw",
|
||||
// .py
|
||||
"com.py", "edu.py", "gov.py", "mil.py", "net.py", "org.py",
|
||||
// .qa
|
||||
"com.qa", "edu.qa", "gov.qa", "mil.qa", "net.qa", "org.qa",
|
||||
// .re
|
||||
"asso.re", "com.re", "nom.re",
|
||||
// .ro
|
||||
"arts.ro", "com.ro", "firm.ro", "info.ro", "nom.ro", "nt.ro", "org.ro",
|
||||
"rec.ro", "store.ro", "tm.ro", "www.ro",
|
||||
// .rs
|
||||
"ac.rs", "co.rs", "edu.rs", "gov.rs", "in.rs", "org.rs",
|
||||
// .ru
|
||||
"ac.ru", "adygeya.ru", "altai.ru", "amur.ru", "arkhangelsk.ru", "astrakhan.ru",
|
||||
"bashkiria.ru", "belgorod.ru", "bir.ru", "bryansk.ru", "buryatia.ru", "cbg.ru",
|
||||
"chel.ru", "chelyabinsk.ru", "chita.ru", "chukotka.ru", "chuvashia.ru", "com.ru",
|
||||
"dagestan.ru", "e-burg.ru", "edu.ru", "gov.ru", "grozny.ru", "int.ru",
|
||||
"irkutsk.ru", "ivanovo.ru", "izhevsk.ru", "jar.ru", "joshkar-ola.ru",
|
||||
"kalmykia.ru", "kaluga.ru", "kamchatka.ru", "karelia.ru", "kazan.ru", "kchr.ru",
|
||||
"kemerovo.ru", "khabarovsk.ru", "khakassia.ru", "khv.ru", "kirov.ru",
|
||||
"koenig.ru", "komi.ru", "kostroma.ru", "kranoyarsk.ru", "kuban.ru", "kurgan.ru",
|
||||
"kursk.ru", "lipetsk.ru", "magadan.ru", "mari.ru", "mari-el.ru", "marine.ru",
|
||||
"mil.ru", "mordovia.ru", "mosreg.ru", "msk.ru", "murmansk.ru", "nalchik.ru",
|
||||
"net.ru", "nnov.ru", "nov.ru", "novosibirsk.ru", "nsk.ru", "omsk.ru",
|
||||
"orenburg.ru", "org.ru", "oryol.ru", "penza.ru", "perm.ru", "pp.ru", "pskov.ru",
|
||||
"ptz.ru", "rnd.ru", "ryazan.ru", "sakhalin.ru", "samara.ru", "saratov.ru",
|
||||
"simbirsk.ru", "smolensk.ru", "spb.ru", "stavropol.ru", "stv.ru", "surgut.ru",
|
||||
"tambov.ru", "tatarstan.ru", "tom.ru", "tomsk.ru", "tsaritsyn.ru", "tsk.ru",
|
||||
"tula.ru", "tuva.ru", "tver.ru", "tyumen.ru", "udm.ru", "udmurtia.ru",
|
||||
"ulan-ude.ru", "vladikavkaz.ru", "vladimir.ru", "vladivostok.ru", "volgograd.ru",
|
||||
"vologda.ru", "voronezh.ru", "vrn.ru", "vyatka.ru", "yakutia.ru", "yamal.ru",
|
||||
"yekaterinburg.ru", "yuzhno-sakhalinsk.ru",
|
||||
// .rw
|
||||
"ac.rw", "co.rw", "com.rw", "edu.rw", "gouv.rw", "gov.rw", "int.rw", "mil.rw", "net.rw",
|
||||
// .sa
|
||||
"com.sa", "edu.sa", "gov.sa", "med.sa", "net.sa", "org.sa", "pub.sa", "sch.sa",
|
||||
// .sb
|
||||
"com.sb", "edu.sb", "gov.sb", "net.sb", "org.sb",
|
||||
// .sc
|
||||
"com.sc", "edu.sc", "gov.sc", "net.sc", "org.sc",
|
||||
// .sd
|
||||
"com.sd", "edu.sd", "gov.sd", "info.sd", "med.sd", "net.sd", "org.sd", "tv.sd",
|
||||
// .se
|
||||
"a.se", "ac.se", "b.se", "bd.se", "c.se", "d.se", "e.se", "f.se", "g.se",
|
||||
"h.se", "i.se", "k.se", "l.se", "m.se", "n.se", "o.se", "org.se", "p.se",
|
||||
"parti.se", "pp.se", "press.se", "r.se", "s.se", "t.se", "tm.se", "u.se",
|
||||
"w.se", "x.se", "y.se", "z.se",
|
||||
// .sg
|
||||
"com.sg", "edu.sg", "gov.sg", "idn.sg", "net.sg", "org.sg", "per.sg",
|
||||
// .sh
|
||||
"co.sh", "com.sh", "edu.sh", "gov.sh", "net.sh", "nom.sh", "org.sh",
|
||||
// .sl
|
||||
"com.sl", "edu.sl", "gov.sl", "net.sl", "org.sl",
|
||||
// .sn
|
||||
"art.sn", "com.sn", "edu.sn", "gouv.sn", "org.sn", "perso.sn", "univ.sn",
|
||||
// .st
|
||||
"co.st", "com.st", "consulado.st", "edu.st", "embaixada.st", "gov.st", "mil.st",
|
||||
"net.st", "org.st", "principe.st", "saotome.st", "store.st",
|
||||
// .sv
|
||||
"com.sv", "edu.sv", "gob.sv", "org.sv", "red.sv",
|
||||
// .sy
|
||||
"com.sy", "edu.sy", "gov.sy", "mil.sy", "net.sy", "news.sy", "org.sy",
|
||||
// .sz
|
||||
"ac.sz", "co.sz", "org.sz",
|
||||
// .th
|
||||
"ac.th", "co.th", "go.th", "in.th", "mi.th", "net.th", "or.th",
|
||||
// .tj
|
||||
"ac.tj", "biz.tj", "co.tj", "com.tj", "edu.tj", "go.tj", "gov.tj", "info.tj",
|
||||
"int.tj", "mil.tj", "name.tj", "net.tj", "nic.tj", "org.tj", "test.tj", "web.tj",
|
||||
// .tn
|
||||
"agrinet.tn", "com.tn", "defense.tn", "edunet.tn", "ens.tn", "fin.tn", "gov.tn",
|
||||
"ind.tn", "info.tn", "intl.tn", "mincom.tn", "nat.tn", "net.tn", "org.tn",
|
||||
"perso.tn", "rnrt.tn", "rns.tn", "rnu.tn", "tourism.tn",
|
||||
// .tr
|
||||
"av.tr", "bbs.tr", "bel.tr", "biz.tr", "com.tr", "dr.tr", "edu.tr", "gen.tr",
|
||||
"gov.tr", "info.tr", "k12.tr", "name.tr", "net.tr", "org.tr", "pol.tr",
|
||||
"tel.tr", "tsk.tr", "tv.tr", "web.tr",
|
||||
// .tt
|
||||
"aero.tt", "biz.tt", "cat.tt", "co.tt", "com.tt", "coop.tt", "edu.tt", "gov.tt",
|
||||
"info.tt", "int.tt", "jobs.tt", "mil.tt", "mobi.tt", "museum.tt", "name.tt",
|
||||
"net.tt", "org.tt", "pro.tt", "tel.tt", "travel.tt",
|
||||
// .tw
|
||||
"club.tw", "com.tw", "ebiz.tw", "edu.tw", "game.tw", "gov.tw", "idv.tw",
|
||||
"mil.tw", "net.tw", "org.tw",
|
||||
// .tz
|
||||
"ac.tz", "co.tz", "go.tz", "ne.tz", "or.tz",
|
||||
// .ua
|
||||
"biz.ua", "cherkassy.ua", "chernigov.ua", "chernovtsy.ua", "ck.ua", "cn.ua",
|
||||
"co.ua", "com.ua", "crimea.ua", "cv.ua", "dn.ua", "dnepropetrovsk.ua",
|
||||
"donetsk.ua", "dp.ua", "edu.ua", "gov.ua", "if.ua", "in.ua",
|
||||
"ivano-frankivsk.ua", "kh.ua", "kharkov.ua", "kherson.ua", "khmelnitskiy.ua",
|
||||
"kiev.ua", "kirovograd.ua", "km.ua", "kr.ua", "ks.ua", "kv.ua", "lg.ua",
|
||||
"lugansk.ua", "lutsk.ua", "lviv.ua", "me.ua", "mk.ua", "net.ua",
|
||||
"nikolaev.ua", "od.ua", "odessa.ua", "org.ua", "pl.ua", "poltava.ua", "pp.ua",
|
||||
"rovno.ua", "rv.ua", "sebastopol.ua", "sumy.ua", "te.ua", "ternopil.ua",
|
||||
"uzhgorod.ua", "vinnica.ua", "vn.ua", "zaporizhzhe.ua", "zhitomir.ua",
|
||||
"zp.ua", "zt.ua",
|
||||
// .ug
|
||||
"ac.ug", "co.ug", "go.ug", "ne.ug", "or.ug", "org.ug", "sc.ug",
|
||||
// .uk
|
||||
"ac.uk", "bl.uk", "british-library.uk", "co.uk", "cym.uk", "gov.uk", "govt.uk",
|
||||
"icnet.uk", "jet.uk", "lea.uk", "ltd.uk", "me.uk", "mil.uk", "mod.uk",
|
||||
"national-library-scotland.uk", "nel.uk", "net.uk", "nhs.uk", "nic.uk",
|
||||
"nls.uk", "org.uk", "orgn.uk", "parliament.uk", "plc.uk", "police.uk",
|
||||
"sch.uk", "scot.uk", "soc.uk",
|
||||
// .us
|
||||
"4fd.us", "dni.us", "fed.us", "isa.us", "kids.us", "nsn.us",
|
||||
// .uy
|
||||
"com.uy", "edu.uy", "gub.uy", "mil.uy", "net.uy", "org.uy",
|
||||
// .ve
|
||||
"co.ve", "com.ve", "edu.ve", "gob.ve", "info.ve", "mil.ve", "net.ve", "org.ve", "web.ve",
|
||||
// .vi
|
||||
"co.vi", "com.vi", "k12.vi", "net.vi", "org.vi",
|
||||
// .vn
|
||||
"ac.vn", "biz.vn", "com.vn", "edu.vn", "gov.vn", "health.vn", "info.vn",
|
||||
"int.vn", "name.vn", "net.vn", "org.vn", "pro.vn",
|
||||
// .ye
|
||||
"co.ye", "com.ye", "gov.ye", "ltd.ye", "me.ye", "net.ye", "org.ye", "plc.ye",
|
||||
// .yu
|
||||
"ac.yu", "co.yu", "edu.yu", "gov.yu", "org.yu",
|
||||
// .za
|
||||
"ac.za", "agric.za", "alt.za", "bourse.za", "city.za", "co.za", "cybernet.za",
|
||||
"db.za", "edu.za", "gov.za", "grondar.za", "iaccess.za", "imt.za", "inca.za",
|
||||
"landesign.za", "law.za", "mil.za", "net.za", "ngo.za", "nis.za", "nom.za",
|
||||
"olivetti.za", "org.za", "pix.za", "school.za", "tm.za", "web.za",
|
||||
// .zm
|
||||
"ac.zm", "co.zm", "com.zm", "edu.zm", "gov.zm", "net.zm", "org.zm", "sch.zm",
|
||||
]);
|
||||
|
||||
function getRootDomain(domain: string): string {
|
||||
|
||||
@@ -448,7 +448,8 @@ export function CalendarWeekView({
|
||||
{pendingPreview && !pendingPreview.allDay && isSameDay(pendingPreview.start, day) && (
|
||||
(() => {
|
||||
const startMin = pendingPreview.start.getHours() * 60 + pendingPreview.start.getMinutes();
|
||||
const endMin = pendingPreview.end.getHours() * 60 + pendingPreview.end.getMinutes();
|
||||
let endMin = pendingPreview.end.getHours() * 60 + pendingPreview.end.getMinutes();
|
||||
if (endMin <= startMin) endMin = 1440;
|
||||
const durationMin = Math.max(15, endMin - startMin);
|
||||
const cal = calendars.find(c => c.id === pendingPreview.calendarId);
|
||||
const color = cal?.color || "hsl(var(--primary))";
|
||||
|
||||
@@ -59,10 +59,12 @@ function buildDuration(startDate: Date, endDate: Date): string {
|
||||
const minutes = totalMinutes % 60;
|
||||
let dur = "P";
|
||||
if (days > 0) dur += `${days}D`;
|
||||
dur += "T";
|
||||
if (hours > 0) dur += `${hours}H`;
|
||||
if (minutes > 0) dur += `${minutes}M`;
|
||||
if (dur === "PT") dur = "PT0M";
|
||||
if (hours > 0 || minutes > 0) {
|
||||
dur += "T";
|
||||
if (hours > 0) dur += `${hours}H`;
|
||||
if (minutes > 0) dur += `${minutes}M`;
|
||||
}
|
||||
if (dur === "P") dur = "PT0M";
|
||||
return dur;
|
||||
}
|
||||
|
||||
@@ -83,9 +85,9 @@ function getAlertLabel(event: CalendarEvent, t: ReturnType<typeof useTranslation
|
||||
if (!first || first.trigger["@type"] !== "OffsetTrigger") return null;
|
||||
const offset = first.trigger.offset;
|
||||
if (offset === "PT0S") return t("alerts.at_time");
|
||||
const minMatch = offset.match(/-?PT?(\d+)M$/);
|
||||
const minMatch = offset.match(/-?PT(\d+)M$/);
|
||||
if (minMatch) return t("alerts.minutes_before", { count: parseInt(minMatch[1]) });
|
||||
const hourMatch = offset.match(/-?PT?(\d+)H$/);
|
||||
const hourMatch = offset.match(/-?PT(\d+)H$/);
|
||||
if (hourMatch) return t("alerts.hours_before", { count: parseInt(hourMatch[1]) });
|
||||
const dayMatch = offset.match(/-?P(\d+)D/);
|
||||
if (dayMatch) return t("alerts.days_before", { count: parseInt(dayMatch[1]) });
|
||||
@@ -209,9 +211,9 @@ export function EventModal({
|
||||
if (first.trigger["@type"] === "OffsetTrigger") {
|
||||
const offset = first.trigger.offset;
|
||||
if (offset === "PT0S") return "at_time";
|
||||
const minMatch = offset.match(/-?PT?(\d+)M$/);
|
||||
const minMatch = offset.match(/-?PT(\d+)M$/);
|
||||
if (minMatch) return minMatch[1] as AlertOption;
|
||||
const hourMatch = offset.match(/-?PT?(\d+)H$/);
|
||||
const hourMatch = offset.match(/-?PT(\d+)H$/);
|
||||
if (hourMatch) return String(parseInt(hourMatch[1]) * 60) as AlertOption;
|
||||
const dayMatch = offset.match(/-?P(\d+)D/);
|
||||
if (dayMatch) return String(parseInt(dayMatch[1]) * 1440) as AlertOption;
|
||||
@@ -384,7 +386,11 @@ export function EventModal({
|
||||
if (!event || !onDuplicate) return;
|
||||
const start = parseISO(event.start);
|
||||
const newStart = addDays(start, 1);
|
||||
const newUid = typeof crypto !== 'undefined' && crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
||||
const data: Partial<CalendarEvent> = {
|
||||
uid: newUid,
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
start: format(newStart, "yyyy-MM-dd'T'HH:mm:ss"),
|
||||
|
||||
@@ -943,11 +943,16 @@ export function EmailComposer({
|
||||
onChange={(e) => setSelectedIdentityId(e.target.value)}
|
||||
className="flex-1 bg-transparent text-sm text-foreground outline-none cursor-pointer hover:text-muted-foreground transition-colors min-w-0 truncate"
|
||||
>
|
||||
{identities.map((identity) => (
|
||||
<option key={identity.id} value={identity.id}>
|
||||
{identity.name ? `${identity.name} <${identity.email}>` : identity.email}
|
||||
</option>
|
||||
))}
|
||||
{identities.map((identity) => {
|
||||
const displayEmail = subAddressTag
|
||||
? generateSubAddress(identity.email, subAddressTag)
|
||||
: identity.email;
|
||||
return (
|
||||
<option key={identity.id} value={identity.id}>
|
||||
{identity.name ? `${identity.name} <${displayEmail}>` : displayEmail}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</select>
|
||||
) : (
|
||||
<span className="text-sm text-foreground flex-1 truncate">
|
||||
|
||||
@@ -6,7 +6,7 @@ import { formatDate } from "@/lib/utils";
|
||||
import { Email } from "@/lib/jmap/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Avatar } from "@/components/ui/avatar";
|
||||
import { Paperclip, Star, Circle, CheckSquare, Square, Tag } from "lucide-react";
|
||||
import { Paperclip, Star, Circle, CheckSquare, Square, Tag, Reply, Forward } from "lucide-react";
|
||||
import { useEmailStore } from "@/stores/email-store";
|
||||
import { useSettingsStore, KEYWORD_PALETTE } from "@/stores/settings-store";
|
||||
import { useAuthStore } from "@/stores/auth-store";
|
||||
@@ -41,6 +41,8 @@ export function EmailListItem({ email, selected, onClick, onContextMenu, onToggl
|
||||
const isUnread = !email.keywords?.$seen;
|
||||
const isStarred = email.keywords?.$flagged;
|
||||
const isImportant = email.keywords?.["$important"];
|
||||
const isAnswered = email.keywords?.$answered;
|
||||
const isForwarded = email.keywords?.$forwarded;
|
||||
const sender = email.from?.[0];
|
||||
|
||||
// Resolve color tag using keyword definitions from settings
|
||||
@@ -175,6 +177,18 @@ export function EmailListItem({ email, selected, onClick, onContextMenu, onToggl
|
||||
</span>
|
||||
)}
|
||||
<EmailIdentityBadge email={email} identities={identities} compact={true} />
|
||||
{isAnswered && !isForwarded && (
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{isForwarded && !isAnswered && (
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{isAnswered && isForwarded && (
|
||||
<>
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
</>
|
||||
)}
|
||||
{email.hasAttachment && (
|
||||
<Paperclip className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { formatDate } from "@/lib/utils";
|
||||
import { Email } from "@/lib/jmap/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Avatar } from "@/components/ui/avatar";
|
||||
import { Paperclip, Star, Circle, CheckSquare, Square } from "lucide-react";
|
||||
import { Paperclip, Star, Circle, CheckSquare, Square, Reply, Forward } from "lucide-react";
|
||||
import { useEmailDrag } from "@/hooks/use-email-drag";
|
||||
import { useLongPress } from "@/hooks/use-long-press";
|
||||
import { useEmailStore } from "@/stores/email-store";
|
||||
@@ -29,6 +29,8 @@ export function ThreadEmailItem({
|
||||
}: ThreadEmailItemProps) {
|
||||
const isUnread = !email.keywords?.$seen;
|
||||
const isStarred = email.keywords?.$flagged;
|
||||
const isAnswered = email.keywords?.$answered;
|
||||
const isForwarded = email.keywords?.$forwarded;
|
||||
const sender = email.from?.[0];
|
||||
const { selectedMailbox, selectedEmailIds, toggleEmailSelection, selectRangeEmails, clearSelection } = useEmailStore();
|
||||
const density = useSettingsStore((state) => state.density);
|
||||
@@ -151,6 +153,18 @@ export function ThreadEmailItem({
|
||||
{isStarred && (
|
||||
<Star className="w-3 h-3 fill-amber-400 text-amber-400" />
|
||||
)}
|
||||
{isAnswered && !isForwarded && (
|
||||
<Reply className="w-3 h-3 text-muted-foreground" />
|
||||
)}
|
||||
{isForwarded && !isAnswered && (
|
||||
<Forward className="w-3 h-3 text-muted-foreground" />
|
||||
)}
|
||||
{isAnswered && isForwarded && (
|
||||
<>
|
||||
<Reply className="w-3 h-3 text-muted-foreground" />
|
||||
<Forward className="w-3 h-3 text-muted-foreground" />
|
||||
</>
|
||||
)}
|
||||
{email.hasAttachment && (
|
||||
<Paperclip className="w-3 h-3 text-muted-foreground" />
|
||||
)}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { formatDate } from "@/lib/utils";
|
||||
import { Email, ThreadGroup } from "@/lib/jmap/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Avatar } from "@/components/ui/avatar";
|
||||
import { Paperclip, Star, Circle, ChevronRight, ChevronDown, Loader2, MessageSquare, CheckSquare, Square } from "lucide-react";
|
||||
import { Paperclip, Star, Circle, ChevronRight, ChevronDown, Loader2, MessageSquare, CheckSquare, Square, Reply, Forward } from "lucide-react";
|
||||
import { useSettingsStore, KEYWORD_PALETTE } from "@/stores/settings-store";
|
||||
import { useUIStore } from "@/stores/ui-store";
|
||||
import { useEmailStore } from "@/stores/email-store";
|
||||
@@ -53,6 +53,8 @@ const SingleEmailItem = React.forwardRef<HTMLDivElement, SingleEmailItemProps>(
|
||||
function SingleEmailItem({ email, selected, onClick, onContextMenu, showPreview, colorTag, onToggleStar, onMarkAsRead, onDelete, onArchive, onSetColorTag, onMarkAsSpam }, ref) {
|
||||
const isUnread = !email.keywords?.$seen;
|
||||
const isStarred = email.keywords?.$flagged;
|
||||
const isAnswered = email.keywords?.$answered;
|
||||
const isForwarded = email.keywords?.$forwarded;
|
||||
const sender = email.from?.[0];
|
||||
const { selectedMailbox, selectedEmailIds, toggleEmailSelection, selectRangeEmails, clearSelection } = useEmailStore();
|
||||
const emailKeywords = useSettingsStore((state) => state.emailKeywords);
|
||||
@@ -182,6 +184,18 @@ const SingleEmailItem = React.forwardRef<HTMLDivElement, SingleEmailItemProps>(
|
||||
{isStarred && (
|
||||
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
|
||||
)}
|
||||
{isAnswered && !isForwarded && (
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{isForwarded && !isAnswered && (
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{isAnswered && isForwarded && (
|
||||
<>
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
</>
|
||||
)}
|
||||
{email.hasAttachment && (
|
||||
<Paperclip className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
@@ -267,7 +281,7 @@ export const ThreadListItem = React.forwardRef<HTMLDivElement, ThreadListItemPro
|
||||
const showPreview = useSettingsStore((state) => state.showPreview);
|
||||
const density = useSettingsStore((state) => state.density);
|
||||
const isMobile = useUIStore((state) => state.isMobile);
|
||||
const { latestEmail, participantNames, hasUnread, hasStarred, hasAttachment, emailCount } = thread;
|
||||
const { latestEmail, participantNames, hasUnread, hasStarred, hasAttachment, hasAnswered, hasForwarded, emailCount } = thread;
|
||||
|
||||
const { selectedMailbox, selectedEmailIds, toggleEmailSelection, selectRangeEmails, clearSelection } = useEmailStore();
|
||||
|
||||
@@ -482,6 +496,18 @@ export const ThreadListItem = React.forwardRef<HTMLDivElement, ThreadListItemPro
|
||||
{hasStarred && (
|
||||
<Star className="w-3.5 h-3.5 fill-amber-400 text-amber-400" />
|
||||
)}
|
||||
{hasAnswered && !hasForwarded && (
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{hasForwarded && !hasAnswered && (
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
{hasAnswered && hasForwarded && (
|
||||
<>
|
||||
<Reply className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Forward className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
</>
|
||||
)}
|
||||
{hasAttachment && (
|
||||
<Paperclip className="w-3.5 h-3.5 text-muted-foreground" />
|
||||
)}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { isEmbedded, listenFromParent } from "@/lib/iframe-bridge";
|
||||
import { getPathPrefix, getLocaleFromPath } from "@/lib/browser-navigation";
|
||||
import { useAuthStore } from "@/stores/auth-store";
|
||||
import { useConfig } from "@/hooks/use-config";
|
||||
|
||||
@@ -16,9 +17,9 @@ export function EmbeddedBridgeProvider({ children }: { children: React.ReactNode
|
||||
switch (msg.type) {
|
||||
case "sso:trigger-login": {
|
||||
// Navigate to login page to start SSO flow
|
||||
const segments = window.location.pathname.split("/").filter(Boolean);
|
||||
const locale = segments[0] || "en";
|
||||
window.location.href = `/${locale}/login`;
|
||||
const prefix = getPathPrefix();
|
||||
const locale = getLocaleFromPath();
|
||||
window.location.href = `${prefix}/${locale}/login`;
|
||||
break;
|
||||
}
|
||||
case "sso:trigger-logout":
|
||||
|
||||
@@ -3,29 +3,44 @@
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
import { useEmailStore } from '@/stores/email-store';
|
||||
import { useAccountStore } from '@/stores/account-store';
|
||||
import { SettingsSection, SettingItem } from './settings-section';
|
||||
import { formatFileSize } from '@/lib/utils';
|
||||
|
||||
export function AccountSettings() {
|
||||
const t = useTranslations('settings.account');
|
||||
const { username, serverUrl, isDemoMode, primaryIdentity } = useAuthStore();
|
||||
const { username, serverUrl, isDemoMode, primaryIdentity, authMode, activeAccountId } = useAuthStore();
|
||||
const { quota } = useEmailStore();
|
||||
const account = useAccountStore((s) => activeAccountId ? s.getAccountById(activeAccountId) : undefined);
|
||||
|
||||
const quotaPercentage = quota ? Math.round((quota.used / quota.total) * 100) : 0;
|
||||
const displayName = primaryIdentity?.name || (isDemoMode ? 'Demo User' : undefined);
|
||||
const displayName = primaryIdentity?.name || account?.displayName || (isDemoMode ? 'Demo User' : undefined);
|
||||
const email = primaryIdentity?.email || account?.email || username;
|
||||
|
||||
return (
|
||||
<SettingsSection title={t('title')} description={t('description')}>
|
||||
{/* Display Name (show in demo mode or when identity has a name) */}
|
||||
{displayName && (
|
||||
<SettingItem label={t('name_label')}>
|
||||
<span className="text-sm text-foreground">{displayName}</span>
|
||||
</SettingItem>
|
||||
)}
|
||||
{/* Display Name */}
|
||||
<SettingItem label={t('name_label')}>
|
||||
<span className="text-sm text-foreground">{displayName || t('../../common.unknown')}</span>
|
||||
</SettingItem>
|
||||
|
||||
{/* Email Address */}
|
||||
<SettingItem label={t('email.label')}>
|
||||
<span className="text-sm text-foreground">{username || t('../../common.unknown')}</span>
|
||||
<span className="text-sm text-foreground">{email || t('../../common.unknown')}</span>
|
||||
</SettingItem>
|
||||
|
||||
{/* Username / Login (show when it differs from email) */}
|
||||
{username && username !== email && (
|
||||
<SettingItem label={t('username_label')}>
|
||||
<span className="text-sm text-foreground">{username}</span>
|
||||
</SettingItem>
|
||||
)}
|
||||
|
||||
{/* Authentication Method */}
|
||||
<SettingItem label={t('auth_method_label')}>
|
||||
<span className="text-sm text-foreground">
|
||||
{authMode === 'oauth' ? t('auth_method_oauth') : t('auth_method_basic')}
|
||||
</span>
|
||||
</SettingItem>
|
||||
|
||||
{/* Server */}
|
||||
|
||||
@@ -16,9 +16,6 @@ export function CalendarSettings() {
|
||||
firstDayOfWeek,
|
||||
showTimeInMonthView,
|
||||
showWeekNumbers,
|
||||
calendarNotificationsEnabled,
|
||||
calendarNotificationSound,
|
||||
calendarInvitationParsingEnabled,
|
||||
enableCalendarTasks,
|
||||
showTasksOnCalendar,
|
||||
updateSetting,
|
||||
@@ -103,37 +100,6 @@ export function CalendarSettings() {
|
||||
</SettingItem>
|
||||
)}
|
||||
|
||||
<SettingItem
|
||||
label={t('notifications_enabled')}
|
||||
description={t('notifications_enabled_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarNotificationsEnabled}
|
||||
onChange={(checked) => updateSetting('calendarNotificationsEnabled', checked)}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t('notification_sound')}
|
||||
description={t('notification_sound_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarNotificationSound}
|
||||
onChange={(checked) => updateSetting('calendarNotificationSound', checked)}
|
||||
disabled={!calendarNotificationsEnabled}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t('invitation_parsing')}
|
||||
description={t('invitation_parsing_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarInvitationParsingEnabled}
|
||||
onChange={(checked) => updateSetting('calendarInvitationParsingEnabled', checked)}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useConfig } from '@/hooks/use-config';
|
||||
import { useSettingsStore } from '@/stores/settings-store';
|
||||
import type { ArchiveMode, HoverAction } from '@/stores/settings-store';
|
||||
import { ALL_HOVER_ACTIONS } from '@/stores/settings-store';
|
||||
@@ -10,13 +11,26 @@ import { useEmailStore } from '@/stores/email-store';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { SettingsSection, SettingItem, Select, ToggleSwitch } from './settings-section';
|
||||
import { TrustedSendersModal } from '@/components/trusted-senders-modal';
|
||||
import { ChevronRight, AlertTriangle, FolderSync, Loader2 } from 'lucide-react';
|
||||
import { ChevronRight, AlertTriangle, FolderSync, Loader2, Mail } from 'lucide-react';
|
||||
|
||||
export function EmailSettings() {
|
||||
const t = useTranslations('settings.email_behavior');
|
||||
const { appName } = useConfig();
|
||||
const [showTrustedModal, setShowTrustedModal] = useState(false);
|
||||
const [isReorganizing, setIsReorganizing] = useState(false);
|
||||
const [reorganizeResult, setReorganizeResult] = useState<string | null>(null);
|
||||
const [defaultMailStatus, setDefaultMailStatus] = useState<'idle' | 'success' | 'error'>('idle');
|
||||
|
||||
const handleSetDefaultMailProgram = useCallback(() => {
|
||||
try {
|
||||
if (typeof navigator !== 'undefined' && navigator.registerProtocolHandler) {
|
||||
navigator.registerProtocolHandler('mailto', `${window.location.origin}/compose?mailto=%s`);
|
||||
setDefaultMailStatus('success');
|
||||
}
|
||||
} catch {
|
||||
setDefaultMailStatus('error');
|
||||
}
|
||||
}, []);
|
||||
|
||||
const {
|
||||
markAsReadDelay,
|
||||
@@ -249,6 +263,7 @@ export function EmailSettings() {
|
||||
value={emailsPerPage.toString()}
|
||||
onChange={(value) => updateSetting('emailsPerPage', parseInt(value))}
|
||||
options={[
|
||||
{ value: '10', label: t('emails_per_page.10') },
|
||||
{ value: '25', label: t('emails_per_page.25') },
|
||||
{ value: '50', label: t('emails_per_page.50') },
|
||||
{ value: '100', label: t('emails_per_page.100') },
|
||||
@@ -279,6 +294,25 @@ export function EmailSettings() {
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
{/* Default Mail Program */}
|
||||
<SettingItem label={t('default_mail_program.label')} description={t('default_mail_program.description', { appName: appName || 'Bulwark' })}>
|
||||
<div className="flex flex-col items-end gap-1">
|
||||
<button
|
||||
onClick={handleSetDefaultMailProgram}
|
||||
className="flex items-center gap-2 px-3 py-1.5 bg-muted hover:bg-accent rounded-md transition-colors"
|
||||
>
|
||||
<Mail className="w-4 h-4" />
|
||||
<span className="text-sm text-foreground">{t('default_mail_program.button')}</span>
|
||||
</button>
|
||||
{defaultMailStatus === 'success' && (
|
||||
<p className="text-xs text-green-600 dark:text-green-400">{t('default_mail_program.success')}</p>
|
||||
)}
|
||||
{defaultMailStatus === 'error' && (
|
||||
<p className="text-xs text-destructive">{t('default_mail_program.error')}</p>
|
||||
)}
|
||||
</div>
|
||||
</SettingItem>
|
||||
|
||||
{/* Trusted Senders */}
|
||||
<SettingItem label={t('trusted_senders.label')} description={t('trusted_senders.description')}>
|
||||
<button
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useSettingsStore } from '@/stores/settings-store';
|
||||
import { SettingsSection, SettingItem, ToggleSwitch, Select } from './settings-section';
|
||||
import { playNotificationSound, NOTIFICATION_SOUNDS } from '@/lib/notification-sound';
|
||||
import type { NotificationSoundChoice } from '@/lib/notification-sound';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Volume2 } from 'lucide-react';
|
||||
|
||||
export function NotificationSettings() {
|
||||
const t = useTranslations('settings.notifications');
|
||||
const {
|
||||
emailNotificationsEnabled,
|
||||
emailNotificationSound,
|
||||
notificationSoundChoice,
|
||||
calendarNotificationsEnabled,
|
||||
calendarNotificationSound,
|
||||
calendarInvitationParsingEnabled,
|
||||
updateSetting,
|
||||
} = useSettingsStore();
|
||||
|
||||
const soundOptions = NOTIFICATION_SOUNDS.map((s) => ({
|
||||
value: s.id,
|
||||
label: t(`sounds.${s.id}`),
|
||||
}));
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<SettingsSection title={t('sound_selection.title')} description={t('sound_selection.description')}>
|
||||
<SettingItem
|
||||
label={t('sound_selection.choose')}
|
||||
description={t('sound_selection.choose_desc')}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() => playNotificationSound(notificationSoundChoice)}
|
||||
title={t('test_sound')}
|
||||
>
|
||||
<Volume2 className="w-4 h-4" />
|
||||
</Button>
|
||||
<Select
|
||||
value={notificationSoundChoice}
|
||||
onChange={(value) => {
|
||||
const choice = value as NotificationSoundChoice;
|
||||
updateSetting('notificationSoundChoice', choice);
|
||||
playNotificationSound(choice);
|
||||
}}
|
||||
options={soundOptions}
|
||||
/>
|
||||
</div>
|
||||
</SettingItem>
|
||||
</SettingsSection>
|
||||
|
||||
<SettingsSection title={t('email.title')} description={t('email.description')}>
|
||||
<SettingItem
|
||||
label={t('email.enabled')}
|
||||
description={t('email.enabled_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={emailNotificationsEnabled}
|
||||
onChange={(checked) => updateSetting('emailNotificationsEnabled', checked)}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t('email.sound')}
|
||||
description={t('email.sound_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={emailNotificationSound}
|
||||
onChange={(checked) => updateSetting('emailNotificationSound', checked)}
|
||||
disabled={!emailNotificationsEnabled}
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingsSection>
|
||||
|
||||
<SettingsSection title={t('calendar.title')} description={t('calendar.description')}>
|
||||
<SettingItem
|
||||
label={t('calendar.enabled')}
|
||||
description={t('calendar.enabled_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarNotificationsEnabled}
|
||||
onChange={(checked) => updateSetting('calendarNotificationsEnabled', checked)}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t('calendar.sound')}
|
||||
description={t('calendar.sound_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarNotificationSound}
|
||||
onChange={(checked) => updateSetting('calendarNotificationSound', checked)}
|
||||
disabled={!calendarNotificationsEnabled}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t('calendar.invitation_parsing')}
|
||||
description={t('calendar.invitation_parsing_desc')}
|
||||
>
|
||||
<ToggleSwitch
|
||||
checked={calendarInvitationParsingEnabled}
|
||||
onChange={(checked) => updateSetting('calendarInvitationParsingEnabled', checked)}
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingsSection>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ const PROACTIVE_THROTTLE_MS = CHECK_INTERVAL_MS * 5;
|
||||
export function useCalendarAlerts() {
|
||||
const { isAuthenticated, client } = useAuthStore();
|
||||
const { events, calendars, supportsCalendar } = useCalendarStore();
|
||||
const { calendarNotificationsEnabled, calendarNotificationSound, enableCalendarTasks } = useSettingsStore();
|
||||
const { calendarNotificationsEnabled, calendarNotificationSound, enableCalendarTasks, notificationSoundChoice } = useSettingsStore();
|
||||
const { tasks: storeTasks } = useTaskStore();
|
||||
const { acknowledgedAlerts, acknowledgeAlert, cleanupStaleAlerts } = useCalendarNotificationStore();
|
||||
const addToast = useToastStore((s) => s.addToast);
|
||||
@@ -47,7 +47,7 @@ export function useCalendarAlerts() {
|
||||
acknowledgeAlert(key, alert.fireTimeMs);
|
||||
|
||||
if (calendarNotificationSound) {
|
||||
playNotificationSound();
|
||||
playNotificationSound(notificationSoundChoice);
|
||||
}
|
||||
|
||||
const diffMs = new Date(alert.event.utcStart || alert.event.start).getTime() - now;
|
||||
@@ -83,7 +83,7 @@ export function useCalendarAlerts() {
|
||||
acknowledgeAlert(key, taskAlert.fireTimeMs);
|
||||
|
||||
if (calendarNotificationSound) {
|
||||
playNotificationSound();
|
||||
playNotificationSound(notificationSoundChoice);
|
||||
}
|
||||
|
||||
const taskMsg = taskAlert.calendarName
|
||||
@@ -105,7 +105,7 @@ export function useCalendarAlerts() {
|
||||
// Silently ignore alert evaluation errors
|
||||
}
|
||||
}, [
|
||||
calendarNotificationsEnabled, calendarNotificationSound,
|
||||
calendarNotificationsEnabled, calendarNotificationSound, notificationSoundChoice,
|
||||
isAuthenticated, events, calendars, acknowledgedAlerts,
|
||||
acknowledgeAlert, addToast, t, locale,
|
||||
]);
|
||||
|
||||
@@ -89,6 +89,22 @@ describe('groupEmailsByThread', () => {
|
||||
expect(groupEmailsByThread(emails)[0].hasAttachment).toBe(true);
|
||||
});
|
||||
|
||||
it('detects hasAnswered when an email has $answered', () => {
|
||||
const emails = [
|
||||
makeEmail({ id: 'e1', keywords: { $seen: true } }),
|
||||
makeEmail({ id: 'e2', keywords: { $seen: true, $answered: true } }),
|
||||
];
|
||||
expect(groupEmailsByThread(emails)[0].hasAnswered).toBe(true);
|
||||
});
|
||||
|
||||
it('detects hasForwarded when an email has $forwarded', () => {
|
||||
const emails = [
|
||||
makeEmail({ id: 'e1', keywords: { $seen: true } }),
|
||||
makeEmail({ id: 'e2', keywords: { $seen: true, $forwarded: true } }),
|
||||
];
|
||||
expect(groupEmailsByThread(emails)[0].hasForwarded).toBe(true);
|
||||
});
|
||||
|
||||
it('returns empty array for empty input', () => {
|
||||
expect(groupEmailsByThread([])).toEqual([]);
|
||||
});
|
||||
@@ -110,6 +126,8 @@ describe('sortThreadGroups', () => {
|
||||
hasUnread: false,
|
||||
hasStarred: false,
|
||||
hasAttachment: false,
|
||||
hasAnswered: false,
|
||||
hasForwarded: false,
|
||||
emailCount: 1,
|
||||
},
|
||||
{
|
||||
@@ -120,6 +138,8 @@ describe('sortThreadGroups', () => {
|
||||
hasUnread: false,
|
||||
hasStarred: false,
|
||||
hasAttachment: false,
|
||||
hasAnswered: false,
|
||||
hasForwarded: false,
|
||||
emailCount: 1,
|
||||
},
|
||||
];
|
||||
@@ -169,6 +189,8 @@ describe('mergeThreadEmails', () => {
|
||||
hasUnread: false,
|
||||
hasStarred: false,
|
||||
hasAttachment: false,
|
||||
hasAnswered: false,
|
||||
hasForwarded: false,
|
||||
emailCount: 2,
|
||||
};
|
||||
const fetched = [
|
||||
@@ -189,6 +211,8 @@ describe('mergeThreadEmails', () => {
|
||||
hasUnread: false,
|
||||
hasStarred: false,
|
||||
hasAttachment: false,
|
||||
hasAnswered: false,
|
||||
hasForwarded: false,
|
||||
emailCount: 1,
|
||||
};
|
||||
const fetched = [
|
||||
|
||||
@@ -1,7 +1,51 @@
|
||||
import { locales } from '@/i18n/routing';
|
||||
|
||||
export function replaceWindowLocation(url: string): void {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.replace(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mount prefix from the current URL.
|
||||
* When the app is served behind a reverse proxy at e.g. /bulwark,
|
||||
* the browser sees /bulwark/en/login while Next.js sees /en/login.
|
||||
*
|
||||
* If a locale is supplied (e.g. from route params) it is used directly;
|
||||
* otherwise the first path segment that matches a known locale is used.
|
||||
*
|
||||
* Returns '' when there is no prefix.
|
||||
*/
|
||||
export function getPathPrefix(locale?: string): string {
|
||||
if (typeof window === 'undefined') return '';
|
||||
|
||||
const segments = window.location.pathname.split('/').filter(Boolean);
|
||||
|
||||
let localeIndex: number;
|
||||
if (locale) {
|
||||
localeIndex = segments.indexOf(locale);
|
||||
} else {
|
||||
localeIndex = segments.findIndex(s =>
|
||||
(locales as readonly string[]).includes(s)
|
||||
);
|
||||
}
|
||||
|
||||
if (localeIndex <= 0) return '';
|
||||
return '/' + segments.slice(0, localeIndex).join('/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the locale from the current URL, skipping any mount prefix.
|
||||
* Falls back to 'en' when no known locale segment is found.
|
||||
*/
|
||||
export function getLocaleFromPath(): string {
|
||||
if (typeof window === 'undefined') return 'en';
|
||||
|
||||
const segments = window.location.pathname.split('/').filter(Boolean);
|
||||
const locale = segments.find(s =>
|
||||
(locales as readonly string[]).includes(s)
|
||||
);
|
||||
return locale || 'en';
|
||||
}
|
||||
+18
-9
@@ -6,6 +6,7 @@ import type {
|
||||
Calendar,
|
||||
CalendarTask,
|
||||
} from '@/lib/jmap/types';
|
||||
import { parseDuration } from '@/components/calendar/event-card';
|
||||
|
||||
export interface PendingAlert {
|
||||
eventId: string;
|
||||
@@ -17,19 +18,20 @@ export interface PendingAlert {
|
||||
|
||||
const STALE_THRESHOLD_MS = 10 * 60 * 1000; // 10 minutes
|
||||
|
||||
const DURATION_RE = /^(-?)P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
||||
const DURATION_RE = /^(-?)P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
||||
|
||||
export function parseAlertOffset(offset: string): number | null {
|
||||
const match = DURATION_RE.exec(offset);
|
||||
if (!match) return null;
|
||||
|
||||
const negative = match[1] === '-';
|
||||
const days = parseInt(match[2] || '0', 10);
|
||||
const hours = parseInt(match[3] || '0', 10);
|
||||
const minutes = parseInt(match[4] || '0', 10);
|
||||
const seconds = parseInt(match[5] || '0', 10);
|
||||
const weeks = parseInt(match[2] || '0', 10);
|
||||
const days = parseInt(match[3] || '0', 10);
|
||||
const hours = parseInt(match[4] || '0', 10);
|
||||
const minutes = parseInt(match[5] || '0', 10);
|
||||
const seconds = parseInt(match[6] || '0', 10);
|
||||
|
||||
const ms = ((days * 24 * 60 * 60) + (hours * 60 * 60) + (minutes * 60) + seconds) * 1000;
|
||||
const ms = ((weeks * 7 * 24 * 60 * 60) + (days * 24 * 60 * 60) + (hours * 60 * 60) + (minutes * 60) + seconds) * 1000;
|
||||
return negative ? -ms : ms;
|
||||
}
|
||||
|
||||
@@ -47,9 +49,15 @@ export function computeFireTime(
|
||||
|
||||
let baseTime: number;
|
||||
if (trigger.relativeTo === 'end') {
|
||||
baseTime = event.utcEnd
|
||||
? new Date(event.utcEnd).getTime()
|
||||
: new Date(event.start).getTime();
|
||||
if (event.utcEnd) {
|
||||
baseTime = new Date(event.utcEnd).getTime();
|
||||
} else {
|
||||
// Compute end from start + duration
|
||||
const startMs = new Date(event.start).getTime();
|
||||
if (Number.isNaN(startMs)) return null;
|
||||
const durationMin = parseDuration(event.duration);
|
||||
baseTime = startMs + durationMin * 60000;
|
||||
}
|
||||
} else {
|
||||
baseTime = event.utcStart
|
||||
? new Date(event.utcStart).getTime()
|
||||
@@ -68,6 +76,7 @@ export function getEffectiveAlerts(
|
||||
return event.alerts;
|
||||
}
|
||||
|
||||
if (!event.calendarIds) return null;
|
||||
const calendarId = Object.keys(event.calendarIds)[0];
|
||||
if (!calendarId) return null;
|
||||
|
||||
|
||||
+29
-24
@@ -251,10 +251,11 @@ function looksLikeReply(event: Partial<CalendarEvent>): boolean {
|
||||
|
||||
const participants = Object.values(event.participants);
|
||||
const hasOrganizer = participants.some((participant) => isOrganizerParticipant(participant));
|
||||
if (hasOrganizer) return false;
|
||||
if (!hasOrganizer) return false;
|
||||
|
||||
return participants.some((participant) =>
|
||||
participant.roles?.attendee
|
||||
&& !isOrganizerParticipant(participant)
|
||||
&& (
|
||||
participant.participationStatus !== 'needs-action'
|
||||
|| !!participant.participationComment
|
||||
@@ -373,6 +374,10 @@ export function getInvitationMethod(
|
||||
return 'cancel';
|
||||
}
|
||||
|
||||
if (looksLikeReply(event)) {
|
||||
return 'reply';
|
||||
}
|
||||
|
||||
if (event.participants && Object.keys(event.participants).length > 0) {
|
||||
const hasOrganizer = Object.values(event.participants).some(
|
||||
(p: CalendarParticipant) => isOrganizerParticipant(p)
|
||||
@@ -382,10 +387,6 @@ export function getInvitationMethod(
|
||||
}
|
||||
}
|
||||
|
||||
if (looksLikeReply(event)) {
|
||||
return 'reply';
|
||||
}
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
@@ -524,36 +525,40 @@ export function formatEventSummary(event: Partial<CalendarEvent>): EventSummary
|
||||
}
|
||||
|
||||
function addDurationToDate(start: string, duration: string, _timeZone?: string | null): string | null {
|
||||
const match = duration.match(/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);
|
||||
const match = duration.match(/^P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);
|
||||
if (!match) return null;
|
||||
|
||||
const days = parseInt(match[1] || '0');
|
||||
const hours = parseInt(match[2] || '0');
|
||||
const minutes = parseInt(match[3] || '0');
|
||||
const seconds = parseInt(match[4] || '0');
|
||||
const weeks = parseInt(match[1] || '0');
|
||||
const days = parseInt(match[2] || '0') + weeks * 7;
|
||||
const hours = parseInt(match[3] || '0');
|
||||
const minutes = parseInt(match[4] || '0');
|
||||
const seconds = parseInt(match[5] || '0');
|
||||
|
||||
const date = new Date(start);
|
||||
if (isNaN(date.getTime())) return null;
|
||||
|
||||
const isUTC = start.endsWith('Z') || start.includes('+');
|
||||
|
||||
if (isUTC) {
|
||||
date.setUTCDate(date.getUTCDate() + days);
|
||||
date.setUTCHours(date.getUTCHours() + hours);
|
||||
date.setUTCMinutes(date.getUTCMinutes() + minutes);
|
||||
date.setUTCSeconds(date.getUTCSeconds() + seconds);
|
||||
return date.toISOString();
|
||||
}
|
||||
|
||||
date.setDate(date.getDate() + days);
|
||||
date.setHours(date.getHours() + hours);
|
||||
date.setMinutes(date.getMinutes() + minutes);
|
||||
date.setSeconds(date.getSeconds() + seconds);
|
||||
|
||||
// If the input is a local datetime (no UTC 'Z' suffix), return a local
|
||||
// format string so that all-day date arithmetic isn't shifted by the
|
||||
// browser's UTC offset (toISOString converts to UTC).
|
||||
if (!start.endsWith('Z') && !start.includes('+')) {
|
||||
const y = date.getFullYear();
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const min = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${y}-${m}-${d}T${h}:${min}:${s}`;
|
||||
}
|
||||
|
||||
return date.toISOString();
|
||||
const y = date.getFullYear();
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const min = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${y}-${m}-${d}T${h}:${min}:${s}`;
|
||||
}
|
||||
|
||||
export function findParticipantByEmail(
|
||||
|
||||
@@ -15,11 +15,30 @@ export interface StatusCounts {
|
||||
'needs-action': number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a participant matches any of the given email addresses.
|
||||
* Checks p.email, p.calendarAddress (mailto:...), and p.sendTo values.
|
||||
*/
|
||||
function participantMatchesEmail(p: CalendarParticipant, lowerEmails: string[]): boolean {
|
||||
if (p.email && lowerEmails.includes(p.email.toLowerCase())) return true;
|
||||
if (p.calendarAddress) {
|
||||
const addr = p.calendarAddress.replace(/^mailto:/i, '').toLowerCase();
|
||||
if (addr && lowerEmails.includes(addr)) return true;
|
||||
}
|
||||
if (p.sendTo) {
|
||||
for (const addr of Object.values(p.sendTo)) {
|
||||
const normalized = addr.replace(/^mailto:/i, '').toLowerCase();
|
||||
if (normalized && lowerEmails.includes(normalized)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isOrganizer(event: CalendarEvent, userEmails: string[]): boolean {
|
||||
if (!event.participants) return false;
|
||||
const lower = userEmails.map(e => e.toLowerCase());
|
||||
return Object.values(event.participants).some(p =>
|
||||
p.roles?.owner && lower.includes(p.email?.toLowerCase())
|
||||
p.roles?.owner && participantMatchesEmail(p, lower)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,7 +46,7 @@ export function getUserParticipantId(event: CalendarEvent, userEmails: string[])
|
||||
if (!event.participants) return null;
|
||||
const lower = userEmails.map(e => e.toLowerCase());
|
||||
for (const [id, p] of Object.entries(event.participants)) {
|
||||
if (lower.includes(p.email?.toLowerCase())) return id;
|
||||
if (participantMatchesEmail(p, lower)) return id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -39,20 +58,29 @@ export function getUserStatus(
|
||||
if (!event.participants) return null;
|
||||
const lower = userEmails.map(e => e.toLowerCase());
|
||||
for (const p of Object.values(event.participants)) {
|
||||
if (lower.includes(p.email?.toLowerCase())) return p.participationStatus;
|
||||
if (participantMatchesEmail(p, lower)) return p.participationStatus;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getParticipantList(event: CalendarEvent): ParticipantInfo[] {
|
||||
if (!event.participants) return [];
|
||||
return Object.entries(event.participants).map(([id, p]) => ({
|
||||
id,
|
||||
name: p.name || '',
|
||||
email: p.email || '',
|
||||
status: p.participationStatus || 'needs-action',
|
||||
isOrganizer: !!p.roles?.owner,
|
||||
}));
|
||||
return Object.entries(event.participants).map(([id, p]) => {
|
||||
let email = p.email || '';
|
||||
if (!email && p.calendarAddress) {
|
||||
email = p.calendarAddress.replace(/^mailto:/i, '');
|
||||
}
|
||||
if (!email && p.sendTo?.imip) {
|
||||
email = p.sendTo.imip.replace(/^mailto:/i, '');
|
||||
}
|
||||
return {
|
||||
id,
|
||||
name: p.name || '',
|
||||
email,
|
||||
status: p.participationStatus || 'needs-action',
|
||||
isOrganizer: !!p.roles?.owner,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function getStatusCounts(event: CalendarEvent): StatusCounts {
|
||||
@@ -76,7 +104,11 @@ export function buildParticipantMap(
|
||||
): Record<string, Partial<CalendarParticipant>> {
|
||||
const participants: Record<string, Partial<CalendarParticipant>> = {};
|
||||
|
||||
participants['organizer'] = {
|
||||
const generateId = () => typeof crypto !== 'undefined' && crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: `p-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
||||
|
||||
participants[generateId()] = {
|
||||
'@type': 'Participant',
|
||||
name: organizer.name,
|
||||
email: organizer.email,
|
||||
@@ -88,8 +120,8 @@ export function buildParticipantMap(
|
||||
kind: 'individual',
|
||||
};
|
||||
|
||||
attendees.forEach((a, i) => {
|
||||
participants[`attendee-${i}`] = {
|
||||
attendees.forEach((a) => {
|
||||
participants[generateId()] = {
|
||||
'@type': 'Participant',
|
||||
name: a.name,
|
||||
email: a.email,
|
||||
|
||||
@@ -40,9 +40,7 @@ export function normalizeAllDayDuration(duration: string | undefined): string |
|
||||
}
|
||||
|
||||
export function buildAllDayDuration(start: Date, inclusiveEnd: Date): string {
|
||||
const startDay = startOfDay(start);
|
||||
const endDay = startOfDay(inclusiveEnd);
|
||||
const dayCount = Math.max(1, Math.round((endDay.getTime() - startDay.getTime()) / 86400000) + 1);
|
||||
const dayCount = Math.max(1, differenceInCalendarDays(startOfDay(inclusiveEnd), startOfDay(start)) + 1);
|
||||
return `P${dayCount}D`;
|
||||
}
|
||||
|
||||
@@ -113,7 +111,7 @@ export function layoutOverlappingEvents(
|
||||
for (const event of sorted) {
|
||||
const start = parseISO(event.start);
|
||||
const startMin = start.getHours() * 60 + start.getMinutes();
|
||||
const endMin = startMin + Math.max(15, parseDuration(event.duration));
|
||||
const endMin = Math.min(1440, startMin + Math.max(15, parseDuration(event.duration)));
|
||||
let placed = false;
|
||||
for (let col = 0; col < columns.length; col++) {
|
||||
if (columns[col].every(e => e.end <= startMin)) {
|
||||
@@ -135,8 +133,9 @@ export function layoutOverlappingEvents(
|
||||
}
|
||||
|
||||
export function formatSnapTime(minutes: number, timeFormat: "12h" | "24h"): string {
|
||||
const h = Math.floor(minutes / 60);
|
||||
const m = minutes % 60;
|
||||
const clamped = Math.max(0, Math.min(1440, minutes));
|
||||
const h = Math.floor(clamped / 60) % 24;
|
||||
const m = clamped % 60;
|
||||
if (timeFormat === "12h") {
|
||||
return `${h % 12 || 12}:${String(m).padStart(2, "0")} ${h < 12 ? "AM" : "PM"}`;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,11 @@ export class DemoJMAPClient implements IJMAPClient {
|
||||
if (email) email.keywords = { ...email.keywords, ...keywords };
|
||||
}
|
||||
|
||||
async setKeyword(emailId: string, keyword: string): Promise<void> {
|
||||
const email = this.data.emails.find(e => e.id === emailId);
|
||||
if (email) email.keywords[keyword] = true;
|
||||
}
|
||||
|
||||
async migrateKeyword(oldKeyword: string, newKeyword: string): Promise<number> {
|
||||
let count = 0;
|
||||
for (const email of this.data.emails) {
|
||||
|
||||
@@ -72,6 +72,7 @@ export interface IJMAPClient {
|
||||
batchMarkAsRead(emailIds: string[], read?: boolean): Promise<void>;
|
||||
toggleStar(emailId: string, starred: boolean): Promise<void>;
|
||||
updateEmailKeywords(emailId: string, keywords: Record<string, boolean>): Promise<void>;
|
||||
setKeyword(emailId: string, keyword: string): Promise<void>;
|
||||
migrateKeyword(oldKeyword: string, newKeyword: string): Promise<number>;
|
||||
deleteEmail(emailId: string): Promise<void>;
|
||||
moveToTrash(emailId: string, trashMailboxId: string, accountId?: string): Promise<void>;
|
||||
|
||||
+160
-14
@@ -2,6 +2,7 @@ import type { Email, Mailbox, StateChange, AccountStates, Thread, Identity, Emai
|
||||
import type { SieveScript, SieveCapabilities } from "./sieve-types";
|
||||
import type { IJMAPClient } from "./client-interface";
|
||||
import { toWildcardQuery } from "./search-utils";
|
||||
import { debug } from "@/lib/debug";
|
||||
|
||||
// JMAP protocol types - these are intentionally flexible due to server variations
|
||||
interface JMAPSession {
|
||||
@@ -763,6 +764,19 @@ export class JMAPClient implements IJMAPClient {
|
||||
]);
|
||||
}
|
||||
|
||||
async setKeyword(emailId: string, keyword: string): Promise<void> {
|
||||
await this.request([
|
||||
["Email/set", {
|
||||
accountId: this.accountId,
|
||||
update: {
|
||||
[emailId]: {
|
||||
[`keywords/${keyword}`]: true,
|
||||
},
|
||||
},
|
||||
}, "0"],
|
||||
]);
|
||||
}
|
||||
|
||||
async migrateKeyword(oldKeyword: string, newKeyword: string): Promise<number> {
|
||||
// Query all email IDs that have the old keyword
|
||||
const allIds: string[] = [];
|
||||
@@ -1671,7 +1685,7 @@ export class JMAPClient implements IJMAPClient {
|
||||
lines.push('END:VCALENDAR');
|
||||
const icsContent = lines.join('\r\n') + '\r\n';
|
||||
|
||||
console.log('[iMIP DEBUG] Generated ICS:\n' + icsContent);
|
||||
debug.log('[iMIP] Generated ICS:\n' + icsContent);
|
||||
|
||||
const statusLabels: Record<string, string> = {
|
||||
ACCEPTED: 'Accepted',
|
||||
@@ -1681,7 +1695,7 @@ export class JMAPClient implements IJMAPClient {
|
||||
const statusLabel = statusLabels[opts.status] || opts.status;
|
||||
const subject = `${statusLabel}: ${opts.summary || 'Event'}`;
|
||||
|
||||
console.log('[iMIP DEBUG] identityId:', finalIdentityId);
|
||||
debug.log('[iMIP] identityId:', finalIdentityId);
|
||||
|
||||
const emailId = `imip-reply-${Date.now()}`;
|
||||
const emailCreate: Record<string, unknown> = {
|
||||
@@ -1714,27 +1728,27 @@ export class JMAPClient implements IJMAPClient {
|
||||
}, "1"],
|
||||
];
|
||||
|
||||
console.log('[iMIP DEBUG] Sending JMAP request with', methodCalls.length, 'method calls');
|
||||
console.log('[iMIP DEBUG] Email create payload:', JSON.stringify(emailCreate, null, 2));
|
||||
debug.log('[iMIP] Sending JMAP request with', methodCalls.length, 'method calls');
|
||||
debug.log('[iMIP] Email create payload:', JSON.stringify(emailCreate, null, 2));
|
||||
|
||||
const response = await this.request(methodCalls);
|
||||
|
||||
console.log('[iMIP DEBUG] JMAP response:', JSON.stringify(response.methodResponses, null, 2));
|
||||
debug.log('[iMIP] JMAP response:', JSON.stringify(response.methodResponses, null, 2));
|
||||
|
||||
if (response.methodResponses) {
|
||||
for (const [methodName, result] of response.methodResponses) {
|
||||
if (methodName.endsWith('/error')) {
|
||||
console.error('[iMIP DEBUG] method error:', methodName, result);
|
||||
debug.error('[iMIP] method error:', methodName, result);
|
||||
throw new Error(result.description || `iMIP reply failed: ${result.type}`);
|
||||
}
|
||||
if (result.notCreated) {
|
||||
const firstError = Object.values(result.notCreated)[0] as { description?: string; type?: string };
|
||||
console.error('[iMIP DEBUG] create error:', JSON.stringify(result.notCreated, null, 2));
|
||||
debug.error('[iMIP] create error:', JSON.stringify(result.notCreated, null, 2));
|
||||
throw new Error(firstError?.description || firstError?.type || 'Failed to send iMIP reply');
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('[iMIP DEBUG] sendImipReply completed successfully');
|
||||
debug.log('[iMIP] sendImipReply completed successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1810,6 +1824,9 @@ export class JMAPClient implements IJMAPClient {
|
||||
const formatted = formatIcalDate(event.utcEnd, event.timeZone);
|
||||
lines.push(formatted.startsWith('TZID=') ? `DTEND;${formatted}` : `DTEND:${formatted}`);
|
||||
}
|
||||
} else if (event.duration) {
|
||||
// Fallback: emit DURATION when utcEnd is absent (RFC 5545 §3.6.1)
|
||||
lines.push(`DURATION:${event.duration}`);
|
||||
}
|
||||
|
||||
if (event.title) lines.push(`SUMMARY:${event.title}`);
|
||||
@@ -1894,6 +1911,9 @@ export class JMAPClient implements IJMAPClient {
|
||||
*/
|
||||
async sendImipCancellation(event: CalendarEvent): Promise<void> {
|
||||
if (!event.participants) return;
|
||||
if (event.status && event.status !== 'cancelled') {
|
||||
debug.warn('sendImipCancellation called on non-cancelled event, status:', event.status);
|
||||
}
|
||||
|
||||
const mailboxes = await this.getMailboxes();
|
||||
const sentMailbox = mailboxes.find(mb => mb.role === 'sent');
|
||||
@@ -3178,9 +3198,24 @@ export class JMAPClient implements IJMAPClient {
|
||||
async getCalendarTasks(calendarIds?: string[], targetAccountId?: string): Promise<CalendarTask[]> {
|
||||
try {
|
||||
const events = await this.getCalendarEvents(calendarIds, targetAccountId);
|
||||
return events.filter((e): e is CalendarTask & CalendarEvent =>
|
||||
(e as unknown as CalendarTask)['@type'] === 'Task'
|
||||
) as unknown as CalendarTask[];
|
||||
return events.filter((e) => {
|
||||
const obj = e as unknown as Record<string, unknown>;
|
||||
const type = obj['@type'];
|
||||
// Explicit @type check (case-insensitive to handle server variations)
|
||||
if (typeof type === 'string' && type.toLowerCase() === 'task') return true;
|
||||
// Fallback: detect tasks created via CalDAV (e.g. Thunderbird) where @type
|
||||
// may be missing. The "progress" property is exclusive to JSCalendar Task
|
||||
// objects and never appears on Event objects.
|
||||
if (type !== 'Event' && 'progress' in obj && typeof obj.progress === 'string') return true;
|
||||
return false;
|
||||
}).map((e) => {
|
||||
const task = { ...e } as unknown as CalendarTask;
|
||||
// Normalize @type for tasks detected by fallback heuristic
|
||||
if (task['@type'] !== 'Task') {
|
||||
(task as unknown as Record<string, unknown>)['@type'] = 'Task';
|
||||
}
|
||||
return task;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to get calendar tasks:', error);
|
||||
return [];
|
||||
@@ -3479,6 +3514,8 @@ export class JMAPClient implements IJMAPClient {
|
||||
|
||||
private pollingInterval: NodeJS.Timeout | null = null;
|
||||
private pollingStates: { [key: string]: string } = {};
|
||||
private sseAbortController: AbortController | null = null;
|
||||
private sseReconnectTimeout: NodeJS.Timeout | null = null;
|
||||
|
||||
private static readonly STATE_TYPE_MAP: Record<string, string> = {
|
||||
'Mailbox/get': 'Mailbox',
|
||||
@@ -3488,13 +3525,114 @@ export class JMAPClient implements IJMAPClient {
|
||||
'SieveScript/get': 'SieveScript',
|
||||
};
|
||||
|
||||
// Polling-based push since EventSource cannot send Authorization headers
|
||||
private static readonly POLLING_INTERVAL = 3_000;
|
||||
private static readonly SSE_RECONNECT_DELAY = 3_000;
|
||||
|
||||
setupPushNotifications(): boolean {
|
||||
const eventSourceUrl = this.getEventSourceUrl();
|
||||
if (eventSourceUrl) {
|
||||
this.connectSSE(eventSourceUrl);
|
||||
} else {
|
||||
this.startPollingFallback();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private connectSSE(templateUrl: string): void {
|
||||
const url = templateUrl
|
||||
.replace('{types}', '*')
|
||||
.replace('{closeafter}', 'no')
|
||||
.replace('{ping}', '30');
|
||||
|
||||
this.sseAbortController = new AbortController();
|
||||
|
||||
fetch(url, {
|
||||
headers: { 'Authorization': this.authHeader, 'Accept': 'text/event-stream' },
|
||||
signal: this.sseAbortController.signal,
|
||||
}).then(response => {
|
||||
if (!response.ok || !response.body) {
|
||||
this.fallbackToPolling();
|
||||
return;
|
||||
}
|
||||
this.readSSEStream(response.body);
|
||||
}).catch(() => {
|
||||
this.fallbackToPolling();
|
||||
});
|
||||
}
|
||||
|
||||
private async readSSEStream(body: ReadableStream<Uint8Array>): Promise<void> {
|
||||
const reader = body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buffer = '';
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
buffer += decoder.decode(value, { stream: true });
|
||||
const parts = buffer.split('\n\n');
|
||||
buffer = parts.pop() || '';
|
||||
|
||||
for (const part of parts) {
|
||||
this.processSSEEvent(part);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof DOMException && error.name === 'AbortError') return;
|
||||
}
|
||||
|
||||
// Stream ended — reconnect unless we were intentionally closed
|
||||
if (this.sseAbortController && !this.sseAbortController.signal.aborted) {
|
||||
this.scheduleSSEReconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private processSSEEvent(raw: string): void {
|
||||
let eventType = 'message';
|
||||
let dataLines: string[] = [];
|
||||
|
||||
for (const line of raw.split('\n')) {
|
||||
if (line.startsWith('event:')) {
|
||||
eventType = line.slice(6).trim();
|
||||
} else if (line.startsWith('data:')) {
|
||||
dataLines.push(line.slice(5).trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (eventType === 'state' && dataLines.length > 0) {
|
||||
try {
|
||||
const change = JSON.parse(dataLines.join('\n')) as StateChange;
|
||||
this.stateChangeCallback?.(change);
|
||||
} catch {
|
||||
// Malformed SSE data — ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private scheduleSSEReconnect(): void {
|
||||
const eventSourceUrl = this.getEventSourceUrl();
|
||||
if (!eventSourceUrl) {
|
||||
this.fallbackToPolling();
|
||||
return;
|
||||
}
|
||||
this.sseReconnectTimeout = setTimeout(() => {
|
||||
this.connectSSE(eventSourceUrl);
|
||||
}, JMAPClient.SSE_RECONNECT_DELAY);
|
||||
}
|
||||
|
||||
private fallbackToPolling(): void {
|
||||
this.sseAbortController = null;
|
||||
if (!this.pollingInterval) {
|
||||
this.startPollingFallback();
|
||||
}
|
||||
}
|
||||
|
||||
private startPollingFallback(): void {
|
||||
this.fetchCurrentStates();
|
||||
this.pollingInterval = setInterval(() => {
|
||||
this.checkForStateChanges();
|
||||
}, 15_000);
|
||||
return true;
|
||||
}, JMAPClient.POLLING_INTERVAL);
|
||||
}
|
||||
|
||||
private buildStatePollingRequest(): { using: string[]; methodCalls: JMAPMethodCall[] } {
|
||||
@@ -3588,6 +3726,14 @@ export class JMAPClient implements IJMAPClient {
|
||||
clearInterval(this.pollingInterval);
|
||||
this.pollingInterval = null;
|
||||
}
|
||||
if (this.sseAbortController) {
|
||||
this.sseAbortController.abort();
|
||||
this.sseAbortController = null;
|
||||
}
|
||||
if (this.sseReconnectTimeout) {
|
||||
clearTimeout(this.sseReconnectTimeout);
|
||||
this.sseReconnectTimeout = null;
|
||||
}
|
||||
if (this.eventSource) {
|
||||
this.eventSource.close();
|
||||
this.eventSource = null;
|
||||
|
||||
@@ -142,6 +142,8 @@ export interface ThreadGroup {
|
||||
hasUnread: boolean; // Any unread emails in thread
|
||||
hasStarred: boolean; // Any starred emails in thread
|
||||
hasAttachment: boolean; // Any email has attachment
|
||||
hasAnswered: boolean; // Any email has been replied to
|
||||
hasForwarded: boolean; // Any email has been forwarded
|
||||
emailCount: number; // Total emails in thread
|
||||
}
|
||||
|
||||
|
||||
+44
-14
@@ -1,21 +1,51 @@
|
||||
import { debug } from '@/lib/debug';
|
||||
|
||||
export function playNotificationSound() {
|
||||
export type NotificationSoundChoice = 'default' | 'cheerful' | 'involved' | 'swift' | 'relax';
|
||||
|
||||
export const NOTIFICATION_SOUNDS: { id: NotificationSoundChoice; file?: string }[] = [
|
||||
{ id: 'default' },
|
||||
{ id: 'cheerful', file: '/notification/cheerful-527.mp3' },
|
||||
{ id: 'involved', file: '/notification/involved-notification.mp3' },
|
||||
{ id: 'swift', file: '/notification/notification-tone-swift-gesture.mp3' },
|
||||
{ id: 'relax', file: '/notification/relax-message-tone.mp3' },
|
||||
];
|
||||
|
||||
function playBeep() {
|
||||
const audioContext = new (window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext)();
|
||||
const oscillator = audioContext.createOscillator();
|
||||
const gainNode = audioContext.createGain();
|
||||
|
||||
oscillator.connect(gainNode);
|
||||
gainNode.connect(audioContext.destination);
|
||||
|
||||
oscillator.frequency.value = 800;
|
||||
oscillator.type = 'sine';
|
||||
gainNode.gain.value = 0.1;
|
||||
|
||||
oscillator.start();
|
||||
oscillator.stop(audioContext.currentTime + 0.15);
|
||||
oscillator.onended = () => audioContext.close();
|
||||
}
|
||||
|
||||
function playFile(file: string) {
|
||||
const audio = new Audio(file);
|
||||
audio.volume = 0.3;
|
||||
audio.play().catch((e) => {
|
||||
debug.log('Could not play audio file, falling back to beep:', e);
|
||||
playBeep();
|
||||
});
|
||||
}
|
||||
|
||||
export function playNotificationSound(sound?: NotificationSoundChoice) {
|
||||
try {
|
||||
const audioContext = new (window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext)();
|
||||
const oscillator = audioContext.createOscillator();
|
||||
const gainNode = audioContext.createGain();
|
||||
const choice = sound ?? 'default';
|
||||
const entry = NOTIFICATION_SOUNDS.find((s) => s.id === choice);
|
||||
|
||||
oscillator.connect(gainNode);
|
||||
gainNode.connect(audioContext.destination);
|
||||
|
||||
oscillator.frequency.value = 800;
|
||||
oscillator.type = 'sine';
|
||||
gainNode.gain.value = 0.1;
|
||||
|
||||
oscillator.start();
|
||||
oscillator.stop(audioContext.currentTime + 0.15);
|
||||
oscillator.onended = () => audioContext.close();
|
||||
if (entry?.file) {
|
||||
playFile(entry.file);
|
||||
} else {
|
||||
playBeep();
|
||||
}
|
||||
} catch (e) {
|
||||
debug.log('Could not play notification sound:', e);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ export function groupEmailsByThread(emails: Email[]): ThreadGroup[] {
|
||||
const hasUnread = sortedEmails.some(e => !e.keywords?.$seen);
|
||||
const hasStarred = sortedEmails.some(e => e.keywords?.$flagged);
|
||||
const hasAttachment = sortedEmails.some(e => e.hasAttachment);
|
||||
const hasAnswered = sortedEmails.some(e => e.keywords?.$answered);
|
||||
const hasForwarded = sortedEmails.some(e => e.keywords?.$forwarded);
|
||||
|
||||
threadGroups.push({
|
||||
threadId,
|
||||
@@ -47,6 +49,8 @@ export function groupEmailsByThread(emails: Email[]): ThreadGroup[] {
|
||||
hasUnread,
|
||||
hasStarred,
|
||||
hasAttachment,
|
||||
hasAnswered,
|
||||
hasForwarded,
|
||||
emailCount: sortedEmails.length,
|
||||
});
|
||||
}
|
||||
@@ -123,6 +127,8 @@ export function mergeThreadEmails(
|
||||
const hasUnread = mergedEmails.some(e => !e.keywords?.$seen);
|
||||
const hasStarred = mergedEmails.some(e => e.keywords?.$flagged);
|
||||
const hasAttachment = mergedEmails.some(e => e.hasAttachment);
|
||||
const hasAnswered = mergedEmails.some(e => e.keywords?.$answered);
|
||||
const hasForwarded = mergedEmails.some(e => e.keywords?.$forwarded);
|
||||
|
||||
return {
|
||||
threadId: existingGroup.threadId,
|
||||
@@ -132,6 +138,8 @@ export function mergeThreadEmails(
|
||||
hasUnread,
|
||||
hasStarred,
|
||||
hasAttachment,
|
||||
hasAnswered,
|
||||
hasForwarded,
|
||||
emailCount: mergedEmails.length,
|
||||
};
|
||||
}
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Verschlüsselung",
|
||||
"files": "Dateien",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "Sidebar-Apps"
|
||||
"sidebar_apps": "Sidebar-Apps",
|
||||
"notifications": "Benachrichtigungen"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "Allgemein",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Schlüsselwort bei bestehenden E-Mails aktualisieren…",
|
||||
"migration_error": "Schlüsselwort konnte bei bestehenden E-Mails nicht aktualisiert werden"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Benachrichtigungston testen",
|
||||
"sounds": {
|
||||
"default": "Standard (Piepton)",
|
||||
"cheerful": "Fröhlich",
|
||||
"involved": "Aufwendig",
|
||||
"swift": "Schnelle Geste",
|
||||
"relax": "Entspannt"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Benachrichtigungston",
|
||||
"description": "Wählen Sie den Ton für Benachrichtigungen",
|
||||
"choose": "Ton",
|
||||
"choose_desc": "Wählen Sie einen Benachrichtigungston und klicken Sie auf das Lautsprechersymbol zur Vorschau"
|
||||
},
|
||||
"email": {
|
||||
"title": "E-Mail-Benachrichtigungen",
|
||||
"description": "Benachrichtigungen für eingehende E-Mails konfigurieren",
|
||||
"enabled": "E-Mail-Benachrichtigungen",
|
||||
"enabled_desc": "Benachrichtigungen anzeigen, wenn neue E-Mails eintreffen",
|
||||
"sound": "Benachrichtigungston",
|
||||
"sound_desc": "Einen Ton abspielen, wenn neue E-Mails eintreffen"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Kalender-Benachrichtigungen",
|
||||
"description": "Benachrichtigungen für Kalendertermine konfigurieren",
|
||||
"enabled": "Terminbenachrichtigungen",
|
||||
"enabled_desc": "Erinnerungen für bevorstehende Kalendertermine anzeigen",
|
||||
"sound": "Benachrichtigungston",
|
||||
"sound_desc": "Einen Ton für Kalendererinnerungen abspielen",
|
||||
"invitation_parsing": "E-Mail-Einladungen erkennen",
|
||||
"invitation_parsing_desc": "Kalendereinladungen in E-Mail-Anhängen erkennen und Kalenderaktionen anzeigen"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Sprache & Region",
|
||||
"description": "Konfigurieren Sie Sprach- und Regionaleinstellungen",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Unter dem Header"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 E-Mails",
|
||||
"25": "25 E-Mails",
|
||||
"50": "50 E-Mails",
|
||||
"100": "100 E-Mails",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Schlagwort",
|
||||
"spam": "Als Spam markieren",
|
||||
"none_selected": "Keine Aktionen ausgewählt"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Standard-E-Mail-Programm",
|
||||
"description": "Registrieren Sie {appName} als Ihr Standard-E-Mail-Programm für mailto:-Links",
|
||||
"button": "Als Standard festlegen",
|
||||
"success": "Browser wurde aufgefordert, als Standard festzulegen",
|
||||
"error": "Ihr Browser unterstützt diese Funktion nicht"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Konto",
|
||||
"description": "Zeigen Sie Ihre Kontoinformationen an",
|
||||
"name_label": "Anzeigename",
|
||||
"username_label": "Benutzername",
|
||||
"account_type_label": "Kontotyp",
|
||||
"auth_method_label": "Authentifizierung",
|
||||
"auth_method_oauth": "Single Sign-On (OAuth/OIDC)",
|
||||
"auth_method_basic": "Passwort",
|
||||
"demo_account": "Demokonto",
|
||||
"email": {
|
||||
"label": "E-Mail-Adresse",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"files": "Files",
|
||||
"contacts": "Contacts",
|
||||
"encryption": "Encryption",
|
||||
"sidebar_apps": "Sidebar Apps"
|
||||
"sidebar_apps": "Sidebar Apps",
|
||||
"notifications": "Notifications"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "General",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Updating keyword on existing emails…",
|
||||
"migration_error": "Failed to update keyword on existing emails"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Test notification sound",
|
||||
"sounds": {
|
||||
"default": "Default (Beep)",
|
||||
"cheerful": "Cheerful",
|
||||
"involved": "Involved",
|
||||
"swift": "Swift Gesture",
|
||||
"relax": "Relax"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Notification Sound",
|
||||
"description": "Choose which sound to play for notifications",
|
||||
"choose": "Sound",
|
||||
"choose_desc": "Select a notification tone and click the speaker icon to preview it"
|
||||
},
|
||||
"email": {
|
||||
"title": "Email Notifications",
|
||||
"description": "Configure notifications for incoming emails",
|
||||
"enabled": "Email notifications",
|
||||
"enabled_desc": "Show notifications when new emails arrive",
|
||||
"sound": "Notification sound",
|
||||
"sound_desc": "Play an audio alert when new emails arrive"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Calendar Notifications",
|
||||
"description": "Configure notifications for calendar events",
|
||||
"enabled": "Event notifications",
|
||||
"enabled_desc": "Show alerts for upcoming calendar events",
|
||||
"sound": "Notification sound",
|
||||
"sound_desc": "Play an audio alert for calendar reminders",
|
||||
"invitation_parsing": "Parse email invitations",
|
||||
"invitation_parsing_desc": "Detect calendar invitations in email attachments and show calendar actions"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Language & Region",
|
||||
"description": "Configure language and regional preferences",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Below header"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 emails",
|
||||
"25": "25 emails",
|
||||
"50": "50 emails",
|
||||
"100": "100 emails",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Tag",
|
||||
"spam": "Mark as Spam",
|
||||
"none_selected": "No actions selected"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Default Mail Program",
|
||||
"description": "Register {appName} as your default mail program for mailto: links",
|
||||
"button": "Set as Default",
|
||||
"success": "Browser prompted to set as default",
|
||||
"error": "Your browser does not support this feature"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Account",
|
||||
"description": "View your account information",
|
||||
"name_label": "Display Name",
|
||||
"username_label": "Username",
|
||||
"account_type_label": "Account Type",
|
||||
"auth_method_label": "Authentication",
|
||||
"auth_method_oauth": "Single Sign-On (OAuth/OIDC)",
|
||||
"auth_method_basic": "Password",
|
||||
"demo_account": "Demo Account",
|
||||
"email": {
|
||||
"label": "Email Address",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Cifrado",
|
||||
"files": "Archivos",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "Apps de barra lateral"
|
||||
"sidebar_apps": "Apps de barra lateral",
|
||||
"notifications": "Notificaciones"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "General",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Actualizando etiqueta en correos existentes…",
|
||||
"migration_error": "Error al actualizar la etiqueta en correos existentes"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Probar sonido de notificación",
|
||||
"sounds": {
|
||||
"default": "Predeterminado (Pitido)",
|
||||
"cheerful": "Alegre",
|
||||
"involved": "Elaborado",
|
||||
"swift": "Gesto rápido",
|
||||
"relax": "Relajado"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Sonido de notificación",
|
||||
"description": "Elige qué sonido reproducir para las notificaciones",
|
||||
"choose": "Sonido",
|
||||
"choose_desc": "Selecciona un tono de notificación y haz clic en el icono del altavoz para previsualizarlo"
|
||||
},
|
||||
"email": {
|
||||
"title": "Notificaciones de correo",
|
||||
"description": "Configurar notificaciones para correos entrantes",
|
||||
"enabled": "Notificaciones de correo",
|
||||
"enabled_desc": "Mostrar notificaciones cuando lleguen nuevos correos",
|
||||
"sound": "Sonido de notificación",
|
||||
"sound_desc": "Reproducir un sonido cuando lleguen nuevos correos"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Notificaciones de calendario",
|
||||
"description": "Configurar notificaciones para eventos del calendario",
|
||||
"enabled": "Notificaciones de eventos",
|
||||
"enabled_desc": "Mostrar alertas para próximos eventos del calendario",
|
||||
"sound": "Sonido de notificación",
|
||||
"sound_desc": "Reproducir un sonido para recordatorios del calendario",
|
||||
"invitation_parsing": "Analizar invitaciones por correo",
|
||||
"invitation_parsing_desc": "Detectar invitaciones de calendario en archivos adjuntos y mostrar acciones de calendario"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Idioma y Región",
|
||||
"description": "Configure las preferencias de idioma y región",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Debajo del encabezado"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 correos",
|
||||
"25": "25 correos",
|
||||
"50": "50 correos",
|
||||
"100": "100 correos",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Etiqueta",
|
||||
"spam": "Marcar como spam",
|
||||
"none_selected": "No hay acciones seleccionadas"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Programa de correo predeterminado",
|
||||
"description": "Registrar {appName} como su programa de correo predeterminado para enlaces mailto:",
|
||||
"button": "Establecer como predeterminado",
|
||||
"success": "El navegador solicitó establecer como predeterminado",
|
||||
"error": "Su navegador no admite esta función"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Cuenta",
|
||||
"description": "Vea la información de su cuenta",
|
||||
"name_label": "Nombre para mostrar",
|
||||
"username_label": "Nombre de usuario",
|
||||
"account_type_label": "Tipo de cuenta",
|
||||
"auth_method_label": "Autenticación",
|
||||
"auth_method_oauth": "Inicio de sesión único (OAuth/OIDC)",
|
||||
"auth_method_basic": "Contraseña",
|
||||
"demo_account": "Cuenta de demostración",
|
||||
"email": {
|
||||
"label": "Dirección de Correo",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Chiffrement",
|
||||
"files": "Fichiers",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "Apps de la barre latérale"
|
||||
"sidebar_apps": "Apps de la barre latérale",
|
||||
"notifications": "Notifications"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "Général",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Mise à jour du mot-clé sur les e-mails existants…",
|
||||
"migration_error": "Échec de la mise à jour du mot-clé sur les e-mails existants"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Tester le son de notification",
|
||||
"sounds": {
|
||||
"default": "Par défaut (Bip)",
|
||||
"cheerful": "Joyeux",
|
||||
"involved": "Élaboré",
|
||||
"swift": "Geste rapide",
|
||||
"relax": "Détente"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Son de notification",
|
||||
"description": "Choisissez le son à jouer pour les notifications",
|
||||
"choose": "Son",
|
||||
"choose_desc": "Sélectionnez une sonnerie et cliquez sur l'icône du haut-parleur pour l'écouter"
|
||||
},
|
||||
"email": {
|
||||
"title": "Notifications par e-mail",
|
||||
"description": "Configurer les notifications pour les e-mails entrants",
|
||||
"enabled": "Notifications par e-mail",
|
||||
"enabled_desc": "Afficher des notifications à l'arrivée de nouveaux e-mails",
|
||||
"sound": "Son de notification",
|
||||
"sound_desc": "Jouer un son à l'arrivée de nouveaux e-mails"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Notifications de calendrier",
|
||||
"description": "Configurer les notifications pour les événements du calendrier",
|
||||
"enabled": "Notifications d'événements",
|
||||
"enabled_desc": "Afficher des alertes pour les événements à venir",
|
||||
"sound": "Son de notification",
|
||||
"sound_desc": "Jouer un son pour les rappels de calendrier",
|
||||
"invitation_parsing": "Analyser les invitations par e-mail",
|
||||
"invitation_parsing_desc": "Détecter les invitations de calendrier dans les pièces jointes et afficher les actions de calendrier"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Langue et région",
|
||||
"description": "Configurez vos préférences linguistiques et régionales",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Sous l'en-tête"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 emails",
|
||||
"25": "25 emails",
|
||||
"50": "50 emails",
|
||||
"100": "100 emails",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Étiquette",
|
||||
"spam": "Marquer comme spam",
|
||||
"none_selected": "Aucune action sélectionnée"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Programme de messagerie par défaut",
|
||||
"description": "Enregistrer {appName} comme programme de messagerie par défaut pour les liens mailto:",
|
||||
"button": "Définir par défaut",
|
||||
"success": "Le navigateur a été invité à définir par défaut",
|
||||
"error": "Votre navigateur ne prend pas en charge cette fonctionnalité"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Compte",
|
||||
"description": "Consultez les informations de votre compte",
|
||||
"name_label": "Nom d'affichage",
|
||||
"username_label": "Nom d'utilisateur",
|
||||
"account_type_label": "Type de compte",
|
||||
"auth_method_label": "Authentification",
|
||||
"auth_method_oauth": "Authentification unique (OAuth/OIDC)",
|
||||
"auth_method_basic": "Mot de passe",
|
||||
"demo_account": "Compte de démonstration",
|
||||
"email": {
|
||||
"label": "Adresse email",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Cifratura",
|
||||
"files": "File",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "App nella barra laterale"
|
||||
"sidebar_apps": "App nella barra laterale",
|
||||
"notifications": "Notifiche"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "Generale",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Aggiornamento parola chiave sulle email esistenti…",
|
||||
"migration_error": "Impossibile aggiornare la parola chiave sulle email esistenti"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Testa il suono di notifica",
|
||||
"sounds": {
|
||||
"default": "Predefinito (Bip)",
|
||||
"cheerful": "Allegro",
|
||||
"involved": "Elaborato",
|
||||
"swift": "Gesto veloce",
|
||||
"relax": "Rilassante"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Suono di notifica",
|
||||
"description": "Scegli quale suono riprodurre per le notifiche",
|
||||
"choose": "Suono",
|
||||
"choose_desc": "Seleziona un tono di notifica e clicca sull'icona dell'altoparlante per l'anteprima"
|
||||
},
|
||||
"email": {
|
||||
"title": "Notifiche e-mail",
|
||||
"description": "Configura le notifiche per le e-mail in arrivo",
|
||||
"enabled": "Notifiche e-mail",
|
||||
"enabled_desc": "Mostra notifiche all'arrivo di nuove e-mail",
|
||||
"sound": "Suono di notifica",
|
||||
"sound_desc": "Riproduci un suono all'arrivo di nuove e-mail"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Notifiche calendario",
|
||||
"description": "Configura le notifiche per gli eventi del calendario",
|
||||
"enabled": "Notifiche eventi",
|
||||
"enabled_desc": "Mostra avvisi per i prossimi eventi del calendario",
|
||||
"sound": "Suono di notifica",
|
||||
"sound_desc": "Riproduci un suono per i promemoria del calendario",
|
||||
"invitation_parsing": "Analizza inviti via e-mail",
|
||||
"invitation_parsing_desc": "Rileva inviti calendario negli allegati e mostra azioni calendario"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Lingua e regione",
|
||||
"description": "Configura le preferenze di lingua e regionali",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Sotto l'intestazione"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 messaggi",
|
||||
"25": "25 messaggi",
|
||||
"50": "50 messaggi",
|
||||
"100": "100 messaggi",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Etichetta",
|
||||
"spam": "Segna come spam",
|
||||
"none_selected": "Nessuna azione selezionata"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Programma di posta predefinito",
|
||||
"description": "Registra {appName} come programma di posta predefinito per i link mailto:",
|
||||
"button": "Imposta come predefinito",
|
||||
"success": "Il browser ha chiesto di impostare come predefinito",
|
||||
"error": "Il tuo browser non supporta questa funzionalità"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Account",
|
||||
"description": "Visualizza le informazioni del tuo account",
|
||||
"name_label": "Nome visualizzato",
|
||||
"username_label": "Nome utente",
|
||||
"account_type_label": "Tipo di account",
|
||||
"auth_method_label": "Autenticazione",
|
||||
"auth_method_oauth": "Single Sign-On (OAuth/OIDC)",
|
||||
"auth_method_basic": "Password",
|
||||
"demo_account": "Account dimostrativo",
|
||||
"email": {
|
||||
"label": "Indirizzo email",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "暗号化",
|
||||
"files": "ファイル",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "サイドバーアプリ"
|
||||
"sidebar_apps": "サイドバーアプリ",
|
||||
"notifications": "通知"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "一般",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "既存のメールでキーワードを更新中…",
|
||||
"migration_error": "既存のメールでのキーワード更新に失敗しました"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "通知音をテスト",
|
||||
"sounds": {
|
||||
"default": "デフォルト(ビープ)",
|
||||
"cheerful": "チアフル",
|
||||
"involved": "インボルブド",
|
||||
"swift": "スウィフトジェスチャー",
|
||||
"relax": "リラックス"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "通知音",
|
||||
"description": "通知に使用する音を選択",
|
||||
"choose": "サウンド",
|
||||
"choose_desc": "通知音を選択し、スピーカーアイコンをクリックしてプレビュー"
|
||||
},
|
||||
"email": {
|
||||
"title": "メール通知",
|
||||
"description": "受信メールの通知を設定",
|
||||
"enabled": "メール通知",
|
||||
"enabled_desc": "新しいメールが届いたときに通知を表示",
|
||||
"sound": "通知音",
|
||||
"sound_desc": "新しいメールが届いたときに音を鳴らす"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "カレンダー通知",
|
||||
"description": "カレンダーイベントの通知を設定",
|
||||
"enabled": "イベント通知",
|
||||
"enabled_desc": "今後のカレンダーイベントのアラートを表示",
|
||||
"sound": "通知音",
|
||||
"sound_desc": "カレンダーリマインダーの音を鳴らす",
|
||||
"invitation_parsing": "メール招待を解析",
|
||||
"invitation_parsing_desc": "メール添付ファイルのカレンダー招待を検出し、カレンダーアクションを表示"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "言語と地域",
|
||||
"description": "言語と地域の設定を構成",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "ヘッダーの下"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10件",
|
||||
"25": "25件",
|
||||
"50": "50件",
|
||||
"100": "100件",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "タグ",
|
||||
"spam": "スパムとしてマーク",
|
||||
"none_selected": "アクションが選択されていません"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "既定のメールプログラム",
|
||||
"description": "{appName}をmailto:リンクの既定のメールプログラムとして登録します",
|
||||
"button": "既定に設定",
|
||||
"success": "ブラウザに既定として設定するよう要求しました",
|
||||
"error": "お使いのブラウザはこの機能をサポートしていません"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "アカウント",
|
||||
"description": "アカウント情報を表示",
|
||||
"name_label": "表示名",
|
||||
"username_label": "ユーザー名",
|
||||
"account_type_label": "アカウントタイプ",
|
||||
"auth_method_label": "認証方法",
|
||||
"auth_method_oauth": "シングルサインオン (OAuth/OIDC)",
|
||||
"auth_method_basic": "パスワード",
|
||||
"demo_account": "デモアカウント",
|
||||
"email": {
|
||||
"label": "メールアドレス",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Versleuteling",
|
||||
"files": "Bestanden",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "Zijbalk-apps"
|
||||
"sidebar_apps": "Zijbalk-apps",
|
||||
"notifications": "Meldingen"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "Algemeen",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Trefwoord bijwerken op bestaande e-mails…",
|
||||
"migration_error": "Kan trefwoord niet bijwerken op bestaande e-mails"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Meldingsgeluid testen",
|
||||
"sounds": {
|
||||
"default": "Standaard (Pieptoon)",
|
||||
"cheerful": "Vrolijk",
|
||||
"involved": "Uitgebreid",
|
||||
"swift": "Snel gebaar",
|
||||
"relax": "Ontspannen"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Meldingsgeluid",
|
||||
"description": "Kies welk geluid wordt afgespeeld voor meldingen",
|
||||
"choose": "Geluid",
|
||||
"choose_desc": "Selecteer een meldingstoon en klik op het luidsprekerpictogram voor een voorbeeld"
|
||||
},
|
||||
"email": {
|
||||
"title": "E-mailmeldingen",
|
||||
"description": "Meldingen voor inkomende e-mails configureren",
|
||||
"enabled": "E-mailmeldingen",
|
||||
"enabled_desc": "Meldingen tonen wanneer nieuwe e-mails binnenkomen",
|
||||
"sound": "Meldingsgeluid",
|
||||
"sound_desc": "Een geluid afspelen wanneer nieuwe e-mails binnenkomen"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Agendameldingen",
|
||||
"description": "Meldingen voor agenda-evenementen configureren",
|
||||
"enabled": "Evenementmeldingen",
|
||||
"enabled_desc": "Waarschuwingen tonen voor aankomende agenda-evenementen",
|
||||
"sound": "Meldingsgeluid",
|
||||
"sound_desc": "Een geluid afspelen voor agendaherinneringen",
|
||||
"invitation_parsing": "E-mailuitnodigingen herkennen",
|
||||
"invitation_parsing_desc": "Agenda-uitnodigingen in e-mailbijlagen detecteren en agendaacties tonen"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Taal & Regio",
|
||||
"description": "Configureer taal- en regiovoorkeuren",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Onder de kop"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 e-mails",
|
||||
"25": "25 e-mails",
|
||||
"50": "50 e-mails",
|
||||
"100": "100 e-mails",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Label",
|
||||
"spam": "Markeer als spam",
|
||||
"none_selected": "Geen acties geselecteerd"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Standaard e-mailprogramma",
|
||||
"description": "Registreer {appName} als uw standaard e-mailprogramma voor mailto:-links",
|
||||
"button": "Instellen als standaard",
|
||||
"success": "Browser gevraagd om als standaard in te stellen",
|
||||
"error": "Uw browser ondersteunt deze functie niet"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Account",
|
||||
"description": "Bekijk je accountinformatie",
|
||||
"name_label": "Weergavenaam",
|
||||
"username_label": "Gebruikersnaam",
|
||||
"account_type_label": "Accounttype",
|
||||
"auth_method_label": "Authenticatie",
|
||||
"auth_method_oauth": "Single Sign-On (OAuth/OIDC)",
|
||||
"auth_method_basic": "Wachtwoord",
|
||||
"demo_account": "Demoaccount",
|
||||
"email": {
|
||||
"label": "E-mailadres",
|
||||
|
||||
+48
-1
@@ -624,7 +624,8 @@
|
||||
"encryption": "Criptografia",
|
||||
"files": "Arquivos",
|
||||
"contacts": "Contacts",
|
||||
"sidebar_apps": "Apps da barra lateral"
|
||||
"sidebar_apps": "Apps da barra lateral",
|
||||
"notifications": "Notificações"
|
||||
},
|
||||
"tab_groups": {
|
||||
"general": "Geral",
|
||||
@@ -696,6 +697,40 @@
|
||||
"migrating": "Atualizando etiqueta nos e-mails existentes…",
|
||||
"migration_error": "Falha ao atualizar etiqueta nos e-mails existentes"
|
||||
},
|
||||
"notifications": {
|
||||
"test_sound": "Testar som de notificação",
|
||||
"sounds": {
|
||||
"default": "Padrão (Bipe)",
|
||||
"cheerful": "Alegre",
|
||||
"involved": "Elaborado",
|
||||
"swift": "Gesto rápido",
|
||||
"relax": "Relaxante"
|
||||
},
|
||||
"sound_selection": {
|
||||
"title": "Som de notificação",
|
||||
"description": "Escolha qual som reproduzir para notificações",
|
||||
"choose": "Som",
|
||||
"choose_desc": "Selecione um toque de notificação e clique no ícone do alto-falante para pré-visualizar"
|
||||
},
|
||||
"email": {
|
||||
"title": "Notificações de e-mail",
|
||||
"description": "Configurar notificações para e-mails recebidos",
|
||||
"enabled": "Notificações de e-mail",
|
||||
"enabled_desc": "Mostrar notificações quando novos e-mails chegarem",
|
||||
"sound": "Som de notificação",
|
||||
"sound_desc": "Reproduzir um som quando novos e-mails chegarem"
|
||||
},
|
||||
"calendar": {
|
||||
"title": "Notificações de calendário",
|
||||
"description": "Configurar notificações para eventos do calendário",
|
||||
"enabled": "Notificações de eventos",
|
||||
"enabled_desc": "Mostrar alertas para próximos eventos do calendário",
|
||||
"sound": "Som de notificação",
|
||||
"sound_desc": "Reproduzir um som para lembretes do calendário",
|
||||
"invitation_parsing": "Analisar convites por e-mail",
|
||||
"invitation_parsing_desc": "Detectar convites de calendário em anexos de e-mail e mostrar ações de calendário"
|
||||
}
|
||||
},
|
||||
"language_region": {
|
||||
"title": "Idioma e Região",
|
||||
"description": "Configure preferências de idioma e região",
|
||||
@@ -774,6 +809,7 @@
|
||||
"below-header": "Abaixo do cabeçalho"
|
||||
},
|
||||
"emails_per_page": {
|
||||
"10": "10 e-mails",
|
||||
"25": "25 e-mails",
|
||||
"50": "50 e-mails",
|
||||
"100": "100 e-mails",
|
||||
@@ -820,6 +856,13 @@
|
||||
"tag": "Etiqueta",
|
||||
"spam": "Marcar como spam",
|
||||
"none_selected": "Nenhuma ação selecionada"
|
||||
},
|
||||
"default_mail_program": {
|
||||
"label": "Programa de e-mail padrão",
|
||||
"description": "Registrar {appName} como seu programa de e-mail padrão para links mailto:",
|
||||
"button": "Definir como padrão",
|
||||
"success": "O navegador solicitou definir como padrão",
|
||||
"error": "Seu navegador não suporta esta funcionalidade"
|
||||
}
|
||||
},
|
||||
"composer": {
|
||||
@@ -871,7 +914,11 @@
|
||||
"title": "Conta",
|
||||
"description": "Visualize as informações da sua conta",
|
||||
"name_label": "Nome de exibição",
|
||||
"username_label": "Nome de usuário",
|
||||
"account_type_label": "Tipo de conta",
|
||||
"auth_method_label": "Autenticação",
|
||||
"auth_method_oauth": "Login único (OAuth/OIDC)",
|
||||
"auth_method_basic": "Senha",
|
||||
"demo_account": "Conta de demonstração",
|
||||
"email": {
|
||||
"label": "Endereço de E-mail",
|
||||
|
||||
+5
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bulwark-webmail",
|
||||
"version": "1.4.7",
|
||||
"version": "1.4.8",
|
||||
"description": "Bulwark Webmail — a modern webmail client built for Stalwart Mail Server",
|
||||
"author": "Bulwark Webmail <bulwark@rbm.systems>",
|
||||
"license": "AGPL-3.0-only",
|
||||
@@ -86,7 +86,10 @@
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"overrides": {
|
||||
"elliptic": "^6.6.1",
|
||||
"elliptic": {
|
||||
".": "^6.6.1",
|
||||
"webcrypto-liner": "$elliptic"
|
||||
},
|
||||
"flatted": "^3.4.2",
|
||||
"undici": "^7.24.0"
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+16
-8
@@ -12,7 +12,7 @@ import { useAccountStore } from './account-store';
|
||||
import { fetchConfig } from '@/hooks/use-config';
|
||||
import { debug } from '@/lib/debug';
|
||||
import { generateAccountId } from '@/lib/account-utils';
|
||||
import { replaceWindowLocation } from '@/lib/browser-navigation';
|
||||
import { replaceWindowLocation, getPathPrefix, getLocaleFromPath } from '@/lib/browser-navigation';
|
||||
import { notifyParent } from '@/lib/iframe-bridge';
|
||||
import { snapshotAccount, restoreAccount, clearAllStores, evictAccount, evictAll } from '@/lib/account-state-manager';
|
||||
import type { Identity } from '@/lib/jmap/types';
|
||||
@@ -107,9 +107,9 @@ function loadIdentities(rawIdentities: Identity[], username: string): { identiti
|
||||
function getLocaleLoginPath(): string {
|
||||
if (typeof window === 'undefined') return '/en/login';
|
||||
|
||||
const segments = window.location.pathname.split('/').filter(Boolean);
|
||||
const locale = segments[0] || 'en';
|
||||
return `/${locale}/login`;
|
||||
const prefix = getPathPrefix();
|
||||
const locale = getLocaleFromPath();
|
||||
return `${prefix}/${locale}/login`;
|
||||
}
|
||||
|
||||
function saveRedirectAfterLogin(): void {
|
||||
@@ -486,8 +486,12 @@ export const useAuthStore = create<AuthState>()(
|
||||
});
|
||||
await client.connect();
|
||||
|
||||
const username = client.getUsername();
|
||||
const { identities, primaryIdentity } = loadIdentities(await client.getIdentities(), username);
|
||||
const jmapUsername = client.getUsername();
|
||||
const { identities, primaryIdentity } = loadIdentities(await client.getIdentities(), jmapUsername);
|
||||
// For OAuth/OIDC, the JMAP session account name may be the
|
||||
// preferred_username claim rather than the real email address.
|
||||
// Prefer the email from the primary identity when available.
|
||||
const username = primaryIdentity?.email || jmapUsername;
|
||||
initializeFeatureStores(client);
|
||||
|
||||
// Register in account store
|
||||
@@ -602,8 +606,12 @@ export const useAuthStore = create<AuthState>()(
|
||||
});
|
||||
await client.connect();
|
||||
|
||||
const username = client.getUsername();
|
||||
const { identities, primaryIdentity } = loadIdentities(await client.getIdentities(), username);
|
||||
const jmapUsername = client.getUsername();
|
||||
const { identities, primaryIdentity } = loadIdentities(await client.getIdentities(), jmapUsername);
|
||||
// For SSO/OIDC, the JMAP session account name may be the
|
||||
// preferred_username claim rather than the real email address.
|
||||
// Prefer the email from the primary identity when available.
|
||||
const username = primaryIdentity?.email || jmapUsername;
|
||||
initializeFeatureStores(client);
|
||||
|
||||
const accountId = generateAccountId(username, ssoServerUrl);
|
||||
|
||||
+24
-10
@@ -130,14 +130,17 @@ export const useCalendarStore = create<CalendarStore>()(
|
||||
let targetAccountId = event.accountId;
|
||||
const cleanEvent = { ...event };
|
||||
if (event.calendarIds) {
|
||||
const calId = Object.keys(event.calendarIds)[0];
|
||||
if (calId) {
|
||||
const remapped: Record<string, boolean> = {};
|
||||
for (const calId of Object.keys(event.calendarIds)) {
|
||||
const cal = get().calendars.find(c => c.id === calId);
|
||||
if (cal?.isShared && cal.originalId) {
|
||||
targetAccountId = cal.accountId;
|
||||
cleanEvent.calendarIds = { [cal.originalId]: true };
|
||||
remapped[cal.originalId] = true;
|
||||
} else {
|
||||
remapped[calId] = true;
|
||||
}
|
||||
}
|
||||
cleanEvent.calendarIds = remapped;
|
||||
}
|
||||
if (event.originalCalendarIds) {
|
||||
cleanEvent.calendarIds = event.originalCalendarIds;
|
||||
@@ -185,12 +188,18 @@ export const useCalendarStore = create<CalendarStore>()(
|
||||
if (realEvent) {
|
||||
const resolvedId = realEvent.originalId || realEvent.id;
|
||||
if (storeEvent.recurrenceId) {
|
||||
// Recurring instance: patch the master event's recurrenceOverrides
|
||||
const patchUpdates: Record<string, unknown> = {};
|
||||
// Recurring instance: patch the master event's recurrenceOverrides.
|
||||
// Escape recurrenceId per RFC 6901: ~ → ~0, / → ~1
|
||||
const escapedRecurrenceId = storeEvent.recurrenceId.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
// Build override object with all changed properties
|
||||
const overrideObj: Record<string, unknown> = {};
|
||||
for (const [key, value] of Object.entries(cleanUpdates as Record<string, unknown>)) {
|
||||
if (['id', 'uid', '@type', 'calendarIds', 'recurrenceRules', 'recurrenceOverrides', 'excludedRecurrenceRules'].includes(key)) continue;
|
||||
patchUpdates[`recurrenceOverrides/${storeEvent.recurrenceId}/${key}`] = value;
|
||||
overrideObj[key] = value;
|
||||
}
|
||||
const patchUpdates: Record<string, unknown> = {
|
||||
[`recurrenceOverrides/${escapedRecurrenceId}`]: overrideObj,
|
||||
};
|
||||
await client.updateCalendarEvent(
|
||||
resolvedId,
|
||||
patchUpdates as unknown as Partial<CalendarEvent>,
|
||||
@@ -261,12 +270,17 @@ export const useCalendarStore = create<CalendarStore>()(
|
||||
const resolvedId = realEvent.originalId || realEvent.id;
|
||||
if (storeEvent.recurrenceId) {
|
||||
// Recurring instance: patch RSVP as recurrence override on master
|
||||
const overridePatch: Record<string, unknown> = {
|
||||
[`recurrenceOverrides/${storeEvent.recurrenceId}/${patchKey}`]: status,
|
||||
// Escape recurrenceId per RFC 6901: ~ → ~0, / → ~1
|
||||
const escapedRecId = storeEvent.recurrenceId.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
const overrideObj: Record<string, unknown> = {
|
||||
[patchKey]: status,
|
||||
};
|
||||
if (replyTo) {
|
||||
overridePatch[`recurrenceOverrides/${storeEvent.recurrenceId}/replyTo`] = replyTo;
|
||||
overrideObj['replyTo'] = replyTo;
|
||||
}
|
||||
const overridePatch: Record<string, unknown> = {
|
||||
[`recurrenceOverrides/${escapedRecId}`]: overrideObj,
|
||||
};
|
||||
await client.updateCalendarEvent(
|
||||
resolvedId,
|
||||
overridePatch as unknown as Partial<CalendarEvent>,
|
||||
@@ -392,7 +406,7 @@ export const useCalendarStore = create<CalendarStore>()(
|
||||
imported++;
|
||||
} catch (error) {
|
||||
const msg = error instanceof Error ? error.message : '';
|
||||
if (msg.includes('already exists') && src.uid) {
|
||||
if ((msg.includes('already exists') || msg.includes('duplicate') || msg.includes('conflict')) && src.uid) {
|
||||
const { events: storeEvents } = get();
|
||||
const alreadyInStore = storeEvents.some((e) => e.uid === src.uid);
|
||||
if (alreadyInStore) {
|
||||
|
||||
@@ -1102,6 +1102,12 @@ export const useEmailStore = create<EmailStore>((set, get) => ({
|
||||
if (dateRange && selectedCalendarIds.length > 0) {
|
||||
calendarStore.fetchEvents(client, dateRange.start, dateRange.end);
|
||||
}
|
||||
// Refresh tasks when calendar events change (e.g. task created via CalDAV)
|
||||
const { useTaskStore } = await import('./task-store');
|
||||
const taskStore = useTaskStore.getState();
|
||||
if (taskStore.tasks.length > 0 || calendarStore.viewMode === 'tasks') {
|
||||
taskStore.fetchTasks(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import { useThemeStore } from './theme-store';
|
||||
import { useLocaleStore } from './locale-store';
|
||||
import type { NotificationSoundChoice } from '@/lib/notification-sound';
|
||||
|
||||
// Use console directly to avoid circular dependency with lib/debug.ts
|
||||
// (debug.ts imports useSettingsStore for debugMode check)
|
||||
@@ -130,6 +131,11 @@ interface SettingsState {
|
||||
enableCalendarTasks: boolean;
|
||||
showTasksOnCalendar: boolean;
|
||||
|
||||
// Email Notifications
|
||||
emailNotificationsEnabled: boolean;
|
||||
emailNotificationSound: boolean;
|
||||
notificationSoundChoice: NotificationSoundChoice;
|
||||
|
||||
// Calendar Notifications
|
||||
calendarNotificationsEnabled: boolean;
|
||||
calendarNotificationSound: boolean;
|
||||
@@ -238,6 +244,11 @@ const DEFAULT_SETTINGS = {
|
||||
enableCalendarTasks: false,
|
||||
showTasksOnCalendar: true,
|
||||
|
||||
// Email Notifications
|
||||
emailNotificationsEnabled: true,
|
||||
emailNotificationSound: true,
|
||||
notificationSoundChoice: 'default' as NotificationSoundChoice,
|
||||
|
||||
// Calendar Notifications
|
||||
calendarNotificationsEnabled: true,
|
||||
calendarNotificationSound: true,
|
||||
@@ -319,6 +330,9 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
sendConfirmation: state.sendConfirmation,
|
||||
defaultReplyMode: state.defaultReplyMode,
|
||||
sessionTimeout: state.sessionTimeout,
|
||||
emailNotificationsEnabled: state.emailNotificationsEnabled,
|
||||
emailNotificationSound: state.emailNotificationSound,
|
||||
notificationSoundChoice: state.notificationSoundChoice,
|
||||
calendarNotificationsEnabled: state.calendarNotificationsEnabled,
|
||||
calendarNotificationSound: state.calendarNotificationSound,
|
||||
calendarInvitationParsingEnabled: state.calendarInvitationParsingEnabled,
|
||||
|
||||
Reference in New Issue
Block a user