-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(subdomain): use subdomain by workspace #8378
Conversation
TODOs/FIXMEs:
|
1866118
to
ce86332
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started having a quick look but not in depth. Looks like great work!!! Big piece!
.../twenty-server/src/database/typeorm/core/migrations/1730137590546-addSubdomainToWorkspace.ts
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,13 @@ | |||
export const getWorkspaceSubdomainByOrigin = (origin: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really understand what origin meant in this context, is it getWorkspaceSubdomainFromUrl or fromHostName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's from the origin header:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
|
||
const subdomain = hostParts[0]; | ||
|
||
if (subdomain === 'app') return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have SERVER_URL
and FRONT_BASE_URL
I think. Could we re-use that instead of hardcoding app maybe?
# v0.32.0 to v0.33.0 | ||
|
||
Upgrade your Twenty instance to use v0.33.0 image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we need to do I think is deprecate IS_SIGN_UP_DISABLED
, instead it might be handy to introduce something like IS_MULTIWORKSPACE_ENABLED
which defaults to false, could that help simplifying the code in other places? I'm not sure if this should be fully handled as part of this PR as there might be a few edge cases that are not well covered with the current IS_SIGN_UP_DISABLED
(for the first time the user is signing up on a host instance / if workspaces.count === 0 then he's allowed to create a workspace)
packages/twenty-server/test/utils/createTestingService.utils.ts
Outdated
Show resolved
Hide resolved
``` | ||
|
||
The `yarn database:migrate:prod` command will apply the migrations to the database structure (core and metadata schemas) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add instructions somewhere in the doc on how to setup/test multi-sub domains locally? That would help me review the PR also, as I didn't figure out how to test this locally
import { isDefined } from '~/utils/isDefined'; | ||
import { sleep } from '~/utils/sleep'; | ||
import { buildWorkspaceUrl } from '~/utils/workspace-url.helper'; | ||
|
||
export const useWorkspaceSwitching = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace switcher still works locally even though I'm in mono-domain mode, is that expected? I thought we wouldn't manage to make it work without multi-domain
# Conflicts: # packages/twenty-website/src/content/developers/self-hosting/upgrade-guide.mdx # Conflicts: # packages/twenty-front/vite.config.ts
# Conflicts: # packages/twenty-front/src/generated/graphql.tsx
# Conflicts: # packages/twenty-front/src/modules/settings/security/components/SettingsSecurityOptionsList.tsx
d6b17ee
to
42eafbb
Compare
42eafbb
to
d80e940
Compare
…switch workspace button
…ML parsing Simplified the retrieval of server URLs by introducing `ServerUrl` utility. Updated callback and issuer URL building in SSO service to use this utility. Enhanced SAML metadata parsing to handle potential null scenarios, and fixed type issues in several frontend components.
Replace SignInUpForm with SignInUpWorkspaceScopeForm to handle SSO identity provider selection. Update workspace service and GraphQL queries to support detailed SSO identity provider information.
Separated sign-in/up password and email input fields into their own components for better modularity and readability. Also unified various states and utility functions under a multi-workspace enablement flag.
…by-workspace # Conflicts: # packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpForm.tsx # packages/twenty-front/src/pages/auth/SSOWorkspaceSelection.tsx
Consolidate all HorizontalSeparator imports to 'twenty-ui' instead of local paths. This change simplifies module dependencies and ensures consistency across the sign-in and sign-up components.
836b2d5
to
f63f488
Compare
Refactor codebase to streamline user workspace handling by removing the findAvailableWorkspacesByEmail query. Updated related resolvers and components to integrate workspace retrieval logic directly within checkUserExists. Simplified GraphQL and client-side state management by consolidating workspace data flow.
Removed the useFindAvailableWorkspacesByEmail hook as it was no longer in use. Improved the workspace token handling by adding support for workspace-specific tokens and streamlined subdomain generation for workspaces based on user email or display name.
…by-workspace # Conflicts: # packages/twenty-front/src/modules/settings/components/SettingsOptionCardContent.tsx # packages/twenty-front/src/modules/settings/security/components/SettingsSecurityOptionsList.tsx # packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx # packages/twenty-front/vite.config.ts
Simplify the login token generation process by eliminating the workspace ID parameter. Adjust relevant services and controllers to accommodate this change, reducing parameter dependency and enhancing code clarity.
Renamed StyledDeveloperSection to StyledContainer for reuse. Adjusted the security item rendering to conditionally include the advanced mode icon when enabled. Added comments regarding design considerations for this change.
Remove the workspace selection component and its associated state management logic. Updated the authentication flow to redirect to the first available workspace directly.
Updated various controllers and services to include WorkspaceService for multiworkspace subdomain conditional logic. Adjusted URL construction logic to handle single and multiworkspace modes seamlessly, ensuring proper redirects and configurations based on the environment settings.
…by-workspace # Conflicts: # packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSection.tsx
…ndling Add a TODO comment for workspace logger issue where message becomes undefined. Adjust target workspace subdomain initialization based on multi-workspace environment setting.
Add conditional rendering to the domain section based on the multi-workspace feature state. This ensures the section is only displayed if the multi-workspace feature is enabled.
Resolve #8386