From 0a0f0850d7a9b359f4ffbef26b63a4c89544882f Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 19 Jan 2026 17:23:29 -0700 Subject: [PATCH] fix dns selection --- .../shared/src/i18n/dictionaries/de.ts | 7 ++-- .../shared/src/i18n/dictionaries/en.ts | 7 ++-- .../shared/src/i18n/dictionaries/es.ts | 7 ++-- .../shared/src/i18n/dictionaries/fr.ts | 7 ++-- .../shared/src/i18n/dictionaries/pl.ts | 7 ++-- .../routes/system/routes/dns/dns.component.ts | 34 +++++++++++++------ 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/web/projects/shared/src/i18n/dictionaries/de.ts b/web/projects/shared/src/i18n/dictionaries/de.ts index 5495c2c6e..370338362 100644 --- a/web/projects/shared/src/i18n/dictionaries/de.ts +++ b/web/projects/shared/src/i18n/dictionaries/de.ts @@ -494,6 +494,7 @@ export default { 516: 'Empfohlen', 517: 'Möchten Sie diese Aufgabe wirklich verwerfen?', 518: 'Verwerfen', + 519: 'Muss eine gültige IPv4- oder IPv6-Adresse mit optionalem Port sein', 520: 'Update verfügbar', 521: 'Um das Problem zu beheben, siehe', 522: 'SDK version', @@ -583,10 +584,10 @@ export default { 612: 'Grund', 613: 'Private Gateways für die StartOS-Benutzeroberfläche können nicht deaktiviert werden', 614: 'Root-CA', - 615: 'DHCP-Server', - 616: 'DHCP-Server können nicht bearbeitet werden', + 615: 'Die von Ihrem Router bereitgestellten DNS-Server verwenden', + 616: 'Manuell festgelegte DNS-Server verwenden', 617: 'Statisch', - 618: 'Statische Server', + 618: 'Server', 619: 'Warnung. StartOS verwendet derzeit das folgende Gateway für DNS', 620: 'Wenn Sie dieses Gateway für die Auflösung privater Domains verwenden möchten, legen Sie alternative statische DNS-Server mit dem obigen Formular fest.', 621: 'Einen Dienst paketieren', diff --git a/web/projects/shared/src/i18n/dictionaries/en.ts b/web/projects/shared/src/i18n/dictionaries/en.ts index 737fe5af5..5822feb65 100644 --- a/web/projects/shared/src/i18n/dictionaries/en.ts +++ b/web/projects/shared/src/i18n/dictionaries/en.ts @@ -493,6 +493,7 @@ export const ENGLISH = { 'Recommended': 516, // as in, we recommend this 'Are you sure you want to dismiss this task?': 517, 'Dismiss': 518, // as in, dismiss or delete a task + 'Must be a valid IPv4 or Ipv6 address with optional port': 519, 'Update available': 520, 'To resolve the issue, refer to': 521, 'SDK version': 522, @@ -582,10 +583,10 @@ export const ENGLISH = { 'Reason': 612, // as in, an explanation for something 'Cannot disable private gateways for StartOS UI': 613, 'Root CA': 614, // as in, the unique, fixed-length digital identifier generated from a certificate's data using a cryptographic hash function - 'DHCP Servers': 615, - 'Cannot edit DHCP servers': 616, + 'Use the DNS servers provided by your router': 615, + 'Use DNS servers you specify manually': 616, 'Static': 617, // as in, unchanging - 'Static Servers': 618, // as in, servers that do not change + 'Servers': 618, // as in, computer servers 'Warning. StartOS is currently using the following gateway for DNS': 619, 'If you intend to use this gateway for private domain resolution, set alternative static DNS servers using the form above.': 620, 'Package a service': 621, // as in, package a software application for an operating system diff --git a/web/projects/shared/src/i18n/dictionaries/es.ts b/web/projects/shared/src/i18n/dictionaries/es.ts index 2f6ef60a3..f5bca9c40 100644 --- a/web/projects/shared/src/i18n/dictionaries/es.ts +++ b/web/projects/shared/src/i18n/dictionaries/es.ts @@ -494,6 +494,7 @@ export default { 516: 'Recomendado', 517: '¿Estás seguro de que deseas descartar esta tarea?', 518: 'Descartar', + 519: 'Debe ser una dirección IPv4 o IPv6 válida con puerto opcional', 520: 'Actualización disponible', 521: 'Para resolver el problema, consulta', 522: 'Versión de SDK', @@ -583,10 +584,10 @@ export default { 612: 'Razón', 613: 'No se pueden deshabilitar las puertas de enlace privadas para la interfaz de usuario de StartOS', 614: 'CA raíz', - 615: 'Servidores DHCP', - 616: 'No se pueden editar los servidores DHCP', + 615: 'Usar los servidores DNS proporcionados por su router', + 616: 'Usar servidores DNS que especifique manualmente', 617: 'Estático', - 618: 'Servidores estáticos', + 618: 'Servidores', 619: 'Advertencia. StartOS está utilizando actualmente la siguiente puerta de enlace para DNS', 620: 'Si deseas usar esta puerta de enlace para la resolución de dominios privados, configura servidores DNS estáticos alternativos usando el formulario anterior.', 621: 'Empaquetar un servicio', diff --git a/web/projects/shared/src/i18n/dictionaries/fr.ts b/web/projects/shared/src/i18n/dictionaries/fr.ts index fdc31c417..d5df17f61 100644 --- a/web/projects/shared/src/i18n/dictionaries/fr.ts +++ b/web/projects/shared/src/i18n/dictionaries/fr.ts @@ -494,6 +494,7 @@ export default { 516: 'Recommandé', 517: 'Êtes-vous sûr de vouloir ignorer cette tâche ?', 518: 'Ignorer', + 519: 'Doit être une adresse IPv4 ou IPv6 valide avec un port facultatif', 520: 'Mise à jour disponible', 521: 'Pour résoudre le problème, consultez', 522: 'Version de SDK', @@ -583,10 +584,10 @@ export default { 612: 'Raison', 613: "Impossible de désactiver les passerelles privées pour l'interface utilisateur StartOS", 614: 'CA racine', - 615: 'Serveurs DHCP', - 616: 'Impossible de modifier les serveurs DHCP', + 615: 'Utiliser les serveurs DNS fournis par votre routeur', + 616: 'Utiliser des serveurs DNS que vous spécifiez manuellement', 617: 'Statique', - 618: 'Serveurs statiques', + 618: 'Serveurs', 619: 'Avertissement. StartOS utilise actuellement la passerelle suivante pour le DNS', 620: 'Si vous souhaitez utiliser cette passerelle pour la résolution de domaines privés, définissez des serveurs DNS statiques alternatifs à l’aide du formulaire ci-dessus.', 621: 'Emballer un service', diff --git a/web/projects/shared/src/i18n/dictionaries/pl.ts b/web/projects/shared/src/i18n/dictionaries/pl.ts index 874a7a368..63b9ef1e7 100644 --- a/web/projects/shared/src/i18n/dictionaries/pl.ts +++ b/web/projects/shared/src/i18n/dictionaries/pl.ts @@ -494,6 +494,7 @@ export default { 516: 'Zalecane', 517: 'Czy na pewno chcesz odrzucić to zadanie?', 518: 'Odrzuć', + 519: 'Musi być prawidłowym adresem IPv4 lub IPv6 z opcjonalnym portem', 520: 'Aktualizacja dostępna', 521: 'Aby rozwiązać problem, zapoznaj się z', 522: 'Wersja SDK', @@ -583,10 +584,10 @@ export default { 612: 'Powód', 613: 'Nie można wyłączyć prywatnych bram dla interfejsu użytkownika StartOS', 614: 'głównego CA', - 615: 'Serwery DHCP', - 616: 'Nie można edytować serwerów DHCP', + 615: 'Użyj serwerów DNS dostarczonych przez router', + 616: 'Użyj serwerów DNS określonych ręcznie', 617: 'Statyczny', - 618: 'Serwery statyczne', + 618: 'Serwery', 619: 'Ostrzeżenie. StartOS obecnie używa następującej bramy do DNS', 620: 'Jeśli zamierzasz używać tej bramy do rozwiązywania domen prywatnych, ustaw alternatywne statyczne serwery DNS za pomocą powyższego formularza.', 621: 'Spakietuj usługę', diff --git a/web/projects/ui/src/app/routes/portal/routes/system/routes/dns/dns.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/routes/dns/dns.component.ts index 63a3928c6..58e8170e8 100644 --- a/web/projects/ui/src/app/routes/portal/routes/system/routes/dns/dns.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/system/routes/dns/dns.component.ts @@ -9,7 +9,7 @@ import { i18nPipe, LoadingService, } from '@start9labs/shared' -import { ISB } from '@start9labs/start-sdk' +import { ISB, utils } from '@start9labs/start-sdk' import { TuiButton, TuiTitle } from '@taiga-ui/core' import { TuiHeader } from '@taiga-ui/layout' import { PatchDB } from 'patch-db-client' @@ -21,6 +21,14 @@ import { DataModel } from 'src/app/services/patch-db/data-model' import { TitleDirective } from 'src/app/services/title.service' import { configBuilderToSpec } from 'src/app/utils/configBuilderToSpec' +// IPv4 +const ipv4 = + /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/ + +// IPv6 (your existing pattern) +const ipv6 = + /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/ + @Component({ template: ` @@ -111,17 +119,11 @@ export default class SystemDnsComponent { strategy: ISB.Value.union({ name: 'strategy', default: 'dhcp', + description: ``, variants: ISB.Variants.of({ dhcp: { name: 'DHCP', - spec: ISB.InputSpec.of({ - servers: ISB.Value.dynamicText(() => ({ - name: this.i18n.transform('DHCP Servers'), - default: null, - required: true, - disabled: this.i18n.transform('Cannot edit DHCP servers'), - })), - }), + spec: ISB.InputSpec.of({}), }, static: { name: this.i18n.transform('Static'), @@ -129,11 +131,21 @@ export default class SystemDnsComponent { servers: ISB.Value.list( ISB.List.text( { - name: this.i18n.transform('Static Servers'), + name: this.i18n.transform('Servers'), minLength: 1, maxLength: 3, }, - { placeholder: '1.1.1.1' }, + { + placeholder: '1.1.1.1', + patterns: [ + { + regex: `^(${ipv4.source}(:\\d{1,5})?|${ipv6.source}|\\[${ipv6.source}\\](:\\d{1,5})?)$`, + description: this.i18n.transform( + 'Must be a valid IPv4 or Ipv6 address with optional port', + ), + }, + ], + }, ), ), }),