mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 12:06:35 +08:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user