Add OAuth-protected MCP server with generated API client packages

This commit is contained in:
Mike Cao committed 2026-09-03 16:58:47 -07:00
1 parent 26e236c95c
commit 65bf19e067
235 files changed
+33755 -3199

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { getItem, removeItem, setItem } from '@/lib/storage';
const RETURN_URL = 'umami.return-url';
/** Only same-origin relative paths are accepted to prevent open redirects. */
export function isSafeReturnUrl(value: unknown): value is string {
return (
typeof value === 'string' &&
value.startsWith('/') &&
!value.startsWith('//') &&
!value.startsWith('/\\') &&
!/[\r\n]/.test(value)
);
}
export function setReturnUrl(url: string) {
if (isSafeReturnUrl(url)) {
setItem(RETURN_URL, url, true);
}
}
export function consumeReturnUrl(): string | null {
const value = getItem(RETURN_URL, true);
removeItem(RETURN_URL, true);
return isSafeReturnUrl(value) ? value : null;
}