From 2dac2bb2b30c1246edcd211c0f2fd28390b34c32 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Wed, 25 Mar 2026 21:15:07 -0600 Subject: [PATCH] restart after server name change --- .../shared/src/i18n/dictionaries/de.ts | 4 +- .../shared/src/i18n/dictionaries/en.ts | 4 +- .../shared/src/i18n/dictionaries/es.ts | 4 +- .../shared/src/i18n/dictionaries/fr.ts | 4 +- .../shared/src/i18n/dictionaries/pl.ts | 4 +- .../routes/general/general.component.ts | 43 ++++++++++++++++--- 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/web/projects/shared/src/i18n/dictionaries/de.ts b/web/projects/shared/src/i18n/dictionaries/de.ts index 8e93725b9..1eea315c0 100644 --- a/web/projects/shared/src/i18n/dictionaries/de.ts +++ b/web/projects/shared/src/i18n/dictionaries/de.ts @@ -680,7 +680,7 @@ export default { 755: 'Schnittstelle(n)', 756: 'Keine Portweiterleitungsregeln', 757: 'Portweiterleitungsregeln am Gateway erforderlich', - 763: 'Sie sind derzeit über Ihre .local-Adresse verbunden. Das Ändern des Hostnamens erfordert einen Wechsel zur neuen .local-Adresse.', + 763: 'Sie sind derzeit über Ihre .local-Adresse verbunden. Das Ändern des Hostnamens erfordert einen Wechsel zur neuen .local-Adresse. Ein Neustart des Servers ist ebenfalls erforderlich.', 764: 'Hostname geändert', 765: 'Neue Adresse öffnen', 766: 'Ihr Server ist jetzt erreichbar unter', @@ -722,4 +722,6 @@ export default { 804: 'Ich habe ein Backup meiner Daten', 805: 'Öffentliche Domain hinzufügen', 806: 'Ergebnis', + 807: 'Nach dem Öffnen der neuen Adresse werden Sie zum Neustart aufgefordert.', + 808: 'Ein Neustart ist erforderlich, damit die Dienstschnittstellen den neuen Hostnamen verwenden.', } satisfies i18n diff --git a/web/projects/shared/src/i18n/dictionaries/en.ts b/web/projects/shared/src/i18n/dictionaries/en.ts index ed961ee84..5d9a6b126 100644 --- a/web/projects/shared/src/i18n/dictionaries/en.ts +++ b/web/projects/shared/src/i18n/dictionaries/en.ts @@ -680,7 +680,7 @@ export const ENGLISH: Record = { 'Interface(s)': 755, 'No port forwarding rules': 756, 'Port forwarding rules required on gateway': 757, - 'You are currently connected via your .local address. Changing the hostname will require you to switch to the new .local address.': 763, + 'You are currently connected via your .local address. Changing the hostname will require you to switch to the new .local address. A server restart will also be needed.': 763, 'Hostname Changed': 764, 'Open new address': 765, 'Your server is now reachable at': 766, @@ -723,4 +723,6 @@ export const ENGLISH: Record = { 'I have a backup of my data': 804, 'Add Public Domain': 805, 'Result': 806, + 'After opening the new address, you will be prompted to restart.': 807, + 'A restart is required for service interfaces to use the new hostname.': 808, } diff --git a/web/projects/shared/src/i18n/dictionaries/es.ts b/web/projects/shared/src/i18n/dictionaries/es.ts index 01edc0200..2ec2a2b44 100644 --- a/web/projects/shared/src/i18n/dictionaries/es.ts +++ b/web/projects/shared/src/i18n/dictionaries/es.ts @@ -680,7 +680,7 @@ export default { 755: 'Interfaz/Interfaces', 756: 'Sin reglas de redirección de puertos', 757: 'Reglas de redirección de puertos requeridas en la puerta de enlace', - 763: 'Actualmente está conectado a través de su dirección .local. Cambiar el nombre de host requerirá que cambie a la nueva dirección .local.', + 763: 'Actualmente está conectado a través de su dirección .local. Cambiar el nombre de host requerirá que cambie a la nueva dirección .local. También será necesario reiniciar el servidor.', 764: 'Nombre de host cambiado', 765: 'Abrir nueva dirección', 766: 'Su servidor ahora es accesible en', @@ -722,4 +722,6 @@ export default { 804: 'Tengo una copia de seguridad de mis datos', 805: 'Agregar dominio público', 806: 'Resultado', + 807: 'Después de abrir la nueva dirección, se le pedirá que reinicie.', + 808: 'Se requiere un reinicio para que las interfaces de servicio utilicen el nuevo nombre de host.', } satisfies i18n diff --git a/web/projects/shared/src/i18n/dictionaries/fr.ts b/web/projects/shared/src/i18n/dictionaries/fr.ts index aa9460f85..01d95cd04 100644 --- a/web/projects/shared/src/i18n/dictionaries/fr.ts +++ b/web/projects/shared/src/i18n/dictionaries/fr.ts @@ -680,7 +680,7 @@ export default { 755: 'Interface(s)', 756: 'Aucune règle de redirection de port', 757: 'Règles de redirection de ports requises sur la passerelle', - 763: "Vous êtes actuellement connecté via votre adresse .local. Changer le nom d'hôte nécessitera de passer à la nouvelle adresse .local.", + 763: "Vous êtes actuellement connecté via votre adresse .local. Changer le nom d'hôte nécessitera de passer à la nouvelle adresse .local. Un redémarrage du serveur sera également nécessaire.", 764: "Nom d'hôte modifié", 765: 'Ouvrir la nouvelle adresse', 766: 'Votre serveur est maintenant accessible à', @@ -722,4 +722,6 @@ export default { 804: "J'ai une sauvegarde de mes données", 805: 'Ajouter un domaine public', 806: 'Résultat', + 807: 'Après avoir ouvert la nouvelle adresse, vous serez invité à redémarrer.', + 808: "Un redémarrage est nécessaire pour que les interfaces de service utilisent le nouveau nom d'hôte.", } satisfies i18n diff --git a/web/projects/shared/src/i18n/dictionaries/pl.ts b/web/projects/shared/src/i18n/dictionaries/pl.ts index d8ffd4153..d05a1dfe8 100644 --- a/web/projects/shared/src/i18n/dictionaries/pl.ts +++ b/web/projects/shared/src/i18n/dictionaries/pl.ts @@ -680,7 +680,7 @@ export default { 755: 'Interfejs(y)', 756: 'Brak reguł przekierowania portów', 757: 'Reguły przekierowania portów wymagane na bramce', - 763: 'Jesteś obecnie połączony przez adres .local. Zmiana nazwy hosta będzie wymagać przełączenia na nowy adres .local.', + 763: 'Jesteś obecnie połączony przez adres .local. Zmiana nazwy hosta będzie wymagać przełączenia na nowy adres .local. Konieczne będzie również ponowne uruchomienie serwera.', 764: 'Nazwa hosta zmieniona', 765: 'Otwórz nowy adres', 766: 'Twój serwer jest teraz dostępny pod adresem', @@ -722,4 +722,6 @@ export default { 804: 'Mam kopię zapasową moich danych', 805: 'Dodaj domenę publiczną', 806: 'Wynik', + 807: 'Po otwarciu nowego adresu zostaniesz poproszony o ponowne uruchomienie.', + 808: 'Ponowne uruchomienie jest wymagane, aby interfejsy usług używały nowej nazwy hosta.', } satisfies i18n diff --git a/web/projects/ui/src/app/routes/portal/routes/system/routes/general/general.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/routes/general/general.component.ts index 9f1057977..7a5130c36 100644 --- a/web/projects/ui/src/app/routes/portal/routes/system/routes/general/general.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/system/routes/general/general.component.ts @@ -4,10 +4,11 @@ import { Component, inject, INJECTOR, + OnInit, } from '@angular/core' import { toSignal } from '@angular/core/rxjs-interop' import { FormsModule } from '@angular/forms' -import { RouterLink } from '@angular/router' +import { ActivatedRoute, Router, RouterLink } from '@angular/router' import { WA_WINDOW } from '@ng-web-apis/common' import { DialogService, @@ -277,7 +278,7 @@ import { UPDATE } from './update.component' TuiAnimated, ], }) -export default class SystemGeneralComponent { +export default class SystemGeneralComponent implements OnInit { private readonly dialogs = inject(TuiResponsiveDialogService) private readonly loader = inject(TuiNotificationMiddleService) private readonly errorService = inject(ErrorService) @@ -287,6 +288,20 @@ export default class SystemGeneralComponent { private readonly i18n = inject(i18nPipe) private readonly injector = inject(INJECTOR) private readonly win = inject(WA_WINDOW) + private readonly route = inject(ActivatedRoute) + private readonly router = inject(Router) + + ngOnInit() { + this.route.queryParams + .pipe(filter(params => params['restart'] === 'hostname')) + .subscribe(async () => { + await this.router.navigate([], { + relativeTo: this.route, + queryParams: {}, + }) + this.promptHostnameRestart() + }) + } count = 0 @@ -399,7 +414,7 @@ export default class SystemGeneralComponent { label: 'Warning', data: { content: - 'You are currently connected via your .local address. Changing the hostname will require you to switch to the new .local address.', + 'You are currently connected via your .local address. Changing the hostname will require you to switch to the new .local address. A server restart will also be needed.', yes: 'Save', no: 'Cancel', }, @@ -419,20 +434,23 @@ export default class SystemGeneralComponent { if (wasLocal) { const { protocol, port } = this.win.location - const newUrl = `${protocol}//${hostname}.local${port ? ':' + port : ''}` + const portSuffix = port ? ':' + port : '' + const newUrl = `${protocol}//${hostname}.local${portSuffix}/system/general?restart=hostname` this.dialog .openConfirm({ label: 'Hostname Changed', data: { content: - `${this.i18n.transform('Your server is now reachable at')} ${hostname}.local` as i18nKey, + `${this.i18n.transform('Your server is now reachable at')} ${hostname}.local. ${this.i18n.transform('After opening the new address, you will be prompted to restart.')}` as i18nKey, yes: 'Open new address', no: 'Dismiss', }, }) .pipe(filter(Boolean)) .subscribe(() => this.win.open(newUrl, '_blank')) + } else { + this.promptHostnameRestart() } } catch (e: any) { this.errorService.handleError(e) @@ -563,6 +581,21 @@ export default class SystemGeneralComponent { .subscribe(() => this.restart()) } + private promptHostnameRestart() { + this.dialog + .openConfirm({ + label: 'Restart to apply', + data: { + content: + 'A restart is required for service interfaces to use the new hostname.', + yes: 'Restart now', + no: 'Later', + }, + }) + .pipe(filter(Boolean)) + .subscribe(() => this.restart()) + } + private promptLanguageRestart() { this.dialog .openConfirm({