fix(core): assert app schema url on open-app (#10687)

This commit is contained in:
fengmk2
2025-03-12 08:42:35 +00:00
parent c3b407041e
commit fd3ce431fe
2 changed files with 23 additions and 6 deletions
@@ -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' }
);