feat(server): add OIDC for AFFiNE (#6991)

Co-authored-by: LongYinan <lynweklm@gmail.com>
Co-authored-by: DarkSky <darksky2048@gmail.com>
This commit is contained in:
Tao Chen
2024-05-23 18:35:30 +02:00
committed by GitHub
parent 0c42849bc3
commit 22a8a2663e
11 changed files with 281 additions and 5 deletions
@@ -38,7 +38,7 @@ export type ConfigPaths = LeafPaths<
| 'origin'
>,
'',
'.....'
'......'
>;
/**
@@ -51,4 +51,17 @@ export class URLHelper {
// redirect to home if the url is invalid
return res.redirect(this.home);
}
verify(url: string | URL) {
try {
if (typeof url === 'string') {
url = new URL(url);
}
if (!['http:', 'https:'].includes(url.protocol)) return false;
if (!url.hostname) return false;
return true;
} catch (_) {
return false;
}
}
}