mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
feat(server): support multiple hosts in one deployment (#12950)
close CLOUD-233 #### PR Dependency Tree * **PR #12950** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for configuring multiple server hosts across backend and frontend settings. * Enhanced deployment and Helm chart configuration to allow specifying multiple ingress hosts. * Updated admin and configuration interfaces to display and manage multiple server hosts. * **Improvements** * Improved URL generation, OAuth, and worker service logic to dynamically handle requests from multiple hosts. * Enhanced captcha verification to support multiple allowed hostnames. * Updated frontend logic for platform-specific server base URLs and allowed origins, including Apple app domains. * Expanded test coverage for multi-host scenarios. * **Bug Fixes** * Corrected backend logic to consistently use dynamic base URLs and origins based on request host context. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -63,7 +63,11 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
|
||||
? [
|
||||
{
|
||||
id: 'affine-cloud',
|
||||
baseUrl: 'https://app.affine.pro',
|
||||
baseUrl: BUILD_CONFIG.isNative
|
||||
? BUILD_CONFIG.isIOS
|
||||
? 'https://apple.getaffineapp.com'
|
||||
: 'https://app.affine.pro'
|
||||
: location.origin,
|
||||
config: {
|
||||
serverName: 'Affine Cloud',
|
||||
features: [
|
||||
@@ -91,7 +95,11 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
|
||||
? [
|
||||
{
|
||||
id: 'affine-cloud',
|
||||
baseUrl: 'https://insider.affine.pro',
|
||||
baseUrl: BUILD_CONFIG.isNative
|
||||
? BUILD_CONFIG.isIOS
|
||||
? 'https://apple.getaffineapp.com'
|
||||
: 'https://insider.affine.pro'
|
||||
: location.origin,
|
||||
config: {
|
||||
serverName: 'Affine Cloud',
|
||||
features: [
|
||||
@@ -147,7 +155,9 @@ export const BUILD_IN_SERVERS: (ServerMetadata & { config: ServerConfig })[] =
|
||||
? [
|
||||
{
|
||||
id: 'affine-cloud',
|
||||
baseUrl: 'https://affine.fail',
|
||||
baseUrl: BUILD_CONFIG.isNative
|
||||
? 'https://affine.fail'
|
||||
: location.origin,
|
||||
config: {
|
||||
serverName: 'Affine Cloud',
|
||||
features: [
|
||||
|
||||
@@ -8,6 +8,7 @@ function maybeAffineOrigin(origin: string, baseUrl: string) {
|
||||
return (
|
||||
origin.startsWith('file://') ||
|
||||
origin.endsWith('affine.pro') || // stable/beta
|
||||
origin.endsWith('apple.getaffineapp.com') || // stable/beta
|
||||
origin.endsWith('affine.fail') || // canary
|
||||
origin === baseUrl // localhost or self-hosted
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user