mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-13 08:06:24 +08:00
fix(core): assert app schema url on open-app (#10687)
This commit is contained in:
@@ -42,3 +42,15 @@ export const appNames = {
|
||||
beta: 'AFFiNE Beta',
|
||||
internal: 'AFFiNE Internal',
|
||||
} satisfies Record<Channel, string>;
|
||||
|
||||
export const appSchemaUrl = z.custom<string>(
|
||||
(url: string) => {
|
||||
try {
|
||||
return appSchemes.safeParse(new URL(url).protocol.replace(':', ''))
|
||||
.success;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{ message: 'Invalid URL or protocol' }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user