Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(notifications): fix SMTP error surfacing, webhook button label, backup timestamp

jubnl13af757ad195
diff --git a/client/src/pages/AdminPage.tsx b/client/src/pages/AdminPage.tsx
index 062a3650a..da4e28ef7 100644
--- a/client/src/pages/AdminPage.tsx
+++ b/client/src/pages/AdminPage.tsx
@@ -1353,7 +1353,7 @@ export default function AdminPage(): React.ReactElement {
disabled={!smtpValues.admin_webhook_url?.trim()}
className="px-4 py-2 border border-slate-300 text-slate-700 rounded-lg text-sm font-medium hover:bg-slate-50 transition-colors disabled:opacity-40"
>
- {t('admin.smtp.testButton')}
+ {t('admin.notifications.testWebhook')}
</button>
</div>
</div>
diff --git a/server/src/services/backupService.ts b/server/src/services/backupService.ts
index cfc8f9766..0075521ba 100644
--- a/server/src/services/backupService.ts
+++ b/server/src/services/backupService.ts
@@ -117,7 +117,7 @@ export function listBackups(): BackupInfo[] {
filename,
size: stat.size,
sizeText: formatSize(stat.size),
- created_at: stat.birthtime.toISOString(),
+ created_at: stat.mtime.toISOString(),
};
})
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
diff --git a/server/src/services/notifications.ts b/server/src/services/notifications.ts
index 563634043..db3371778 100644
--- a/server/src/services/notifications.ts
+++ b/server/src/services/notifications.ts
@@ -399,9 +399,24 @@ export async function sendWebhook(url: string, payload: { event: string; title:
}
export async function testSmtp(to: string): Promise<{ success: boolean; error?: string }> {
+ if (!getSmtpConfig()) return { success: false, error: 'SMTP not configured' };
try {
- const sent = await sendEmail(to, 'Test Notification', 'This is a test email from TREK. If you received this, your SMTP configuration is working correctly.');
- return sent ? { success: true } : { success: false, error: 'SMTP not configured' };
+ const config = getSmtpConfig()!;
+ const skipTls = process.env.SMTP_SKIP_TLS_VERIFY === 'true' || getAppSetting('smtp_skip_tls_verify') === 'true';
+ const transporter = nodemailer.createTransport({
+ host: config.host,
+ port: config.port,
+ secure: config.secure,
+ auth: config.user ? { user: config.user, pass: config.pass } : undefined,
+ ...(skipTls ? { tls: { rejectUnauthorized: false } } : {}),
+ });
+ await transporter.sendMail({
+ from: config.from,
+ to,
+ subject: 'TREK — Test Notification',
+ text: 'This is a test email from TREK. If you received this, your SMTP configuration is working correctly.',
+ });
+ return { success: true };
} catch (err) {
return { success: false, error: err instanceof Error ? err.message : 'Unknown error' };
}