mirror of
https://github.com/docmost/docmost.git
synced 2026-08-29 18:14:58 +08:00
feat(integrations): route OAuth callbacks back to originating workspace host
This commit is contained in:
@@ -18,4 +18,20 @@ export class DomainService {
|
||||
const protocol = this.environmentService.isHttps() ? 'https' : 'http';
|
||||
return `${protocol}://${hostname}.${domain}`;
|
||||
}
|
||||
|
||||
// Canonical workspace URL: prefers customDomain, falls back to {hostname}.{cloud-domain},
|
||||
// falls back to APP_URL for self-hosted. Used for multi-tenant OAuth return-redirects.
|
||||
getWorkspaceUrl(workspace: {
|
||||
hostname?: string | null;
|
||||
customDomain?: string | null;
|
||||
}): string {
|
||||
if (!this.environmentService.isCloud()) {
|
||||
return this.environmentService.getAppUrl();
|
||||
}
|
||||
if (workspace.customDomain) {
|
||||
const protocol = this.environmentService.isHttps() ? 'https' : 'http';
|
||||
return `${protocol}://${workspace.customDomain}`;
|
||||
}
|
||||
return this.getUrl(workspace.hostname ?? undefined);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user