feat(admin-ui): add configurable Admin UI domain routing

This commit is contained in:
2026-05-24 14:46:35 +00:00
parent a86d83f835
commit d91fda084b
11 changed files with 551 additions and 38 deletions
+17
View File
@@ -0,0 +1,17 @@
export function normalizeHostname(valueArg: string): string {
const trimmedValue = valueArg.trim().toLowerCase();
if (!trimmedValue) return '';
const withoutProtocol = trimmedValue.replace(/^[a-z][a-z0-9+.-]*:\/\//, '');
const withoutPath = withoutProtocol.split('/')[0].split('?')[0].split('#')[0];
return withoutPath.replace(/:\d+$/, '').replace(/\.$/, '');
}
export function isValidHostname(hostnameArg: string): boolean {
if (!hostnameArg) return true;
if (hostnameArg.length > 253) return false;
return hostnameArg.split('.').every((label) => {
if (!label || label.length > 63) return false;
return /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(label);
});
}