chore: fix home server address when there is no internet connection (#2696)
This commit is contained in:
@@ -220,17 +220,25 @@ export class HomeServerManager implements HomeServerManagerInterface {
|
|||||||
|
|
||||||
private getLocalIP() {
|
private getLocalIP() {
|
||||||
const interfaces = os.networkInterfaces()
|
const interfaces = os.networkInterfaces()
|
||||||
|
let internalAddress = undefined
|
||||||
for (const interfaceName in interfaces) {
|
for (const interfaceName in interfaces) {
|
||||||
const addresses = interfaces[interfaceName]
|
const addresses = interfaces[interfaceName]
|
||||||
if (!addresses) {
|
if (!addresses) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const address of addresses) {
|
for (const address of addresses) {
|
||||||
if (address.family === 'IPv4' && !address.internal) {
|
if (address.family === 'IPv4') {
|
||||||
return address.address
|
if (!address.internal) {
|
||||||
|
return address.address
|
||||||
|
}
|
||||||
|
|
||||||
|
internalAddress = address.address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return internalAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getHomeServerConfigurationObject(): Promise<HomeServerEnvironmentConfiguration | undefined> {
|
private async getHomeServerConfigurationObject(): Promise<HomeServerEnvironmentConfiguration | undefined> {
|
||||||
|
|||||||
Reference in New Issue
Block a user