feat(domains): support username root domain claims
Build and publish Docker image / build-and-publish (push) Successful in 9s
Build and publish Docker image / build-and-publish (push) Successful in 9s
This commit is contained in:
1 parent
2768f5f97d
commit
079140ce49
4 files changed
+19
-14
No files matched your search
@@ -1383,12 +1383,12 @@ async def handle_create_domain(client_id, data):
|
||||
|
||||
user_id = client_info['user_id']
|
||||
username = client_info['username']
|
||||
subdomain_name = data.get('subdomain')
|
||||
subdomain_name = '' if data.get('useUsernameDomain') is True else data.get('subdomain')
|
||||
server_id = data.get('serverId')
|
||||
|
||||
logger.info(f"DEBUG: Creating domain for user {username}, subdomain: {subdomain_name}")
|
||||
|
||||
if not subdomain_name:
|
||||
if subdomain_name is None:
|
||||
await send_message(client_id, {'type': 'error', 'error': 'Subdomain name required'})
|
||||
return
|
||||
|
||||
@@ -1398,7 +1398,7 @@ async def handle_create_domain(client_id, data):
|
||||
return
|
||||
|
||||
# Validate subdomain name
|
||||
if not domain_manager._is_valid_subdomain(subdomain_name):
|
||||
if subdomain_name and not domain_manager._is_valid_subdomain(subdomain_name):
|
||||
await send_message(client_id, {'type': 'error', 'error': 'Invalid subdomain name. Use only lowercase letters, numbers, and hyphens (1-63 chars)'})
|
||||
return
|
||||
|
||||
@@ -1409,7 +1409,7 @@ async def handle_create_domain(client_id, data):
|
||||
try:
|
||||
# Check if subdomain is available (improved check)
|
||||
user_domain = f"u-{username}.{domain_manager.base_domain}"
|
||||
full_subdomain = f"{subdomain_name}.{user_domain}"
|
||||
full_subdomain = f"{subdomain_name}.{user_domain}" if subdomain_name else user_domain
|
||||
|
||||
# Check if domain already exists in database
|
||||
with database_connection() as conn:
|
||||
|
||||
Reference in new issue
Block a user