fix: scope iCal subscriptions per JMAP account and fix refresh/clear

This commit is contained in:
Linus Rath
2026-05-18 16:39:02 +02:00
parent fa261fecfd
commit b2d24670ff
4 changed files with 118 additions and 16 deletions
+19
View File
@@ -8,6 +8,25 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
/**
* Strip embedded Basic-auth credentials from a URL for display.
* `https://user:pass@host/path` → `https://host/path`. Falls back to
* regex stripping if URL parsing fails.
*/
export function redactUrlCredentials(rawUrl: string): string {
try {
const parsed = new URL(rawUrl);
if (parsed.username || parsed.password) {
parsed.username = '';
parsed.password = '';
return parsed.toString();
}
return rawUrl;
} catch {
return rawUrl.replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^/@\s]+@/, '$1');
}
}
export function generateUUID(): string {
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
return crypto.randomUUID();