fix: admin: crash if you only got IPv6 addresses
Massimo Melina committed
Jun 11, 2024 at 08:30 UTC
62cb51fc2eddc53e4effccac6bf9c0f78b9f4c6e
1 file changed
+2
-2
src/nat.ts
+2
-2
@@ -1,7 +1,7 @@
1
import { proxy } from 'valtio'
2
import { Client } from 'nat-upnp-rejetto'
3
import { debounceAsync } from './debounceAsync'
4
-import { haveTimeout, HOUR, inCommon, MINUTE, promiseBestEffort, repeat, wantArray } from './cross'
4
+import { haveTimeout, HOUR, inCommon, ipForUrl, MINUTE, promiseBestEffort, repeat, wantArray } from './cross'
5
import { getProjectInfo } from './github'
6
import _ from 'lodash'
7
import { httpString } from './util-http'
@@ -21,7 +21,7 @@ export const defaultBaseUrl = proxy({
21
const defPort = this.proto === 'https' ? 443 : 80
22
const status = await getServerStatus()
23
const port = this.port || (this.proto === 'https' ? status.https.port : status.http.port)
24
- return `${this.proto}://${ this.publicIps[0] || this.externalIp || this.localIp}${!port || port === defPort ? '' : ':' + port}`
24
+ return `${this.proto}://${ipForUrl(this.publicIps[0] || this.externalIp || this.localIp)}${!port || port === defPort ? '' : ':' + port}`
25
}
26
})
27