restart after server name change

This commit is contained in:
Matt Hill
2026-03-25 21:15:07 -06:00
parent 58f1dc5025
commit 2dac2bb2b3
6 changed files with 53 additions and 10 deletions

View File

@@ -680,7 +680,7 @@ export default {
755: 'Schnittstelle(n)', 755: 'Schnittstelle(n)',
756: 'Keine Portweiterleitungsregeln', 756: 'Keine Portweiterleitungsregeln',
757: 'Portweiterleitungsregeln am Gateway erforderlich', 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', 764: 'Hostname geändert',
765: 'Neue Adresse öffnen', 765: 'Neue Adresse öffnen',
766: 'Ihr Server ist jetzt erreichbar unter', 766: 'Ihr Server ist jetzt erreichbar unter',
@@ -722,4 +722,6 @@ export default {
804: 'Ich habe ein Backup meiner Daten', 804: 'Ich habe ein Backup meiner Daten',
805: 'Öffentliche Domain hinzufügen', 805: 'Öffentliche Domain hinzufügen',
806: 'Ergebnis', 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 } satisfies i18n

View File

@@ -680,7 +680,7 @@ export const ENGLISH: Record<string, number> = {
'Interface(s)': 755, 'Interface(s)': 755,
'No port forwarding rules': 756, 'No port forwarding rules': 756,
'Port forwarding rules required on gateway': 757, '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, 'Hostname Changed': 764,
'Open new address': 765, 'Open new address': 765,
'Your server is now reachable at': 766, 'Your server is now reachable at': 766,
@@ -723,4 +723,6 @@ export const ENGLISH: Record<string, number> = {
'I have a backup of my data': 804, 'I have a backup of my data': 804,
'Add Public Domain': 805, 'Add Public Domain': 805,
'Result': 806, '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,
} }

View File

@@ -680,7 +680,7 @@ export default {
755: 'Interfaz/Interfaces', 755: 'Interfaz/Interfaces',
756: 'Sin reglas de redirección de puertos', 756: 'Sin reglas de redirección de puertos',
757: 'Reglas de redirección de puertos requeridas en la puerta de enlace', 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', 764: 'Nombre de host cambiado',
765: 'Abrir nueva dirección', 765: 'Abrir nueva dirección',
766: 'Su servidor ahora es accesible en', 766: 'Su servidor ahora es accesible en',
@@ -722,4 +722,6 @@ export default {
804: 'Tengo una copia de seguridad de mis datos', 804: 'Tengo una copia de seguridad de mis datos',
805: 'Agregar dominio público', 805: 'Agregar dominio público',
806: 'Resultado', 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 } satisfies i18n

View File

@@ -680,7 +680,7 @@ export default {
755: 'Interface(s)', 755: 'Interface(s)',
756: 'Aucune règle de redirection de port', 756: 'Aucune règle de redirection de port',
757: 'Règles de redirection de ports requises sur la passerelle', 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é", 764: "Nom d'hôte modifié",
765: 'Ouvrir la nouvelle adresse', 765: 'Ouvrir la nouvelle adresse',
766: 'Votre serveur est maintenant accessible à', 766: 'Votre serveur est maintenant accessible à',
@@ -722,4 +722,6 @@ export default {
804: "J'ai une sauvegarde de mes données", 804: "J'ai une sauvegarde de mes données",
805: 'Ajouter un domaine public', 805: 'Ajouter un domaine public',
806: 'Résultat', 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 } satisfies i18n

View File

@@ -680,7 +680,7 @@ export default {
755: 'Interfejs(y)', 755: 'Interfejs(y)',
756: 'Brak reguł przekierowania portów', 756: 'Brak reguł przekierowania portów',
757: 'Reguły przekierowania portów wymagane na bramce', 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', 764: 'Nazwa hosta zmieniona',
765: 'Otwórz nowy adres', 765: 'Otwórz nowy adres',
766: 'Twój serwer jest teraz dostępny pod adresem', 766: 'Twój serwer jest teraz dostępny pod adresem',
@@ -722,4 +722,6 @@ export default {
804: 'Mam kopię zapasową moich danych', 804: 'Mam kopię zapasową moich danych',
805: 'Dodaj domenę publiczną', 805: 'Dodaj domenę publiczną',
806: 'Wynik', 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 } satisfies i18n

View File

@@ -4,10 +4,11 @@ import {
Component, Component,
inject, inject,
INJECTOR, INJECTOR,
OnInit,
} from '@angular/core' } from '@angular/core'
import { toSignal } from '@angular/core/rxjs-interop' import { toSignal } from '@angular/core/rxjs-interop'
import { FormsModule } from '@angular/forms' 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 { WA_WINDOW } from '@ng-web-apis/common'
import { import {
DialogService, DialogService,
@@ -277,7 +278,7 @@ import { UPDATE } from './update.component'
TuiAnimated, TuiAnimated,
], ],
}) })
export default class SystemGeneralComponent { export default class SystemGeneralComponent implements OnInit {
private readonly dialogs = inject(TuiResponsiveDialogService) private readonly dialogs = inject(TuiResponsiveDialogService)
private readonly loader = inject(TuiNotificationMiddleService) private readonly loader = inject(TuiNotificationMiddleService)
private readonly errorService = inject(ErrorService) private readonly errorService = inject(ErrorService)
@@ -287,6 +288,20 @@ export default class SystemGeneralComponent {
private readonly i18n = inject(i18nPipe) private readonly i18n = inject(i18nPipe)
private readonly injector = inject(INJECTOR) private readonly injector = inject(INJECTOR)
private readonly win = inject(WA_WINDOW) 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 count = 0
@@ -399,7 +414,7 @@ export default class SystemGeneralComponent {
label: 'Warning', label: 'Warning',
data: { data: {
content: 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', yes: 'Save',
no: 'Cancel', no: 'Cancel',
}, },
@@ -419,20 +434,23 @@ export default class SystemGeneralComponent {
if (wasLocal) { if (wasLocal) {
const { protocol, port } = this.win.location 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 this.dialog
.openConfirm({ .openConfirm({
label: 'Hostname Changed', label: 'Hostname Changed',
data: { data: {
content: 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', yes: 'Open new address',
no: 'Dismiss', no: 'Dismiss',
}, },
}) })
.pipe(filter(Boolean)) .pipe(filter(Boolean))
.subscribe(() => this.win.open(newUrl, '_blank')) .subscribe(() => this.win.open(newUrl, '_blank'))
} else {
this.promptHostnameRestart()
} }
} catch (e: any) { } catch (e: any) {
this.errorService.handleError(e) this.errorService.handleError(e)
@@ -563,6 +581,21 @@ export default class SystemGeneralComponent {
.subscribe(() => this.restart()) .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() { private promptLanguageRestart() {
this.dialog this.dialog
.openConfirm({ .openConfirm({