mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-19 13:38:06 +01:00
🎨 Improve the network serve address list https://github.com/siyuan-note/siyuan/issues/14943
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
3e6e5fa3a4
commit
db4b91b757
7 changed files with 47 additions and 60 deletions
|
|
@ -64,18 +64,18 @@ func ShortPathForBootingDisplay(p string) string {
|
|||
|
||||
var LocalIPs []string
|
||||
|
||||
func GetLocalIPs() (ret []string) {
|
||||
if ContainerAndroid == Container || ContainerHarmony == Container {
|
||||
func GetServerAddrs() (ret []string) {
|
||||
if ContainerAndroid != Container && ContainerHarmony != Container {
|
||||
// Android 上用不了 net.InterfaceAddrs() https://github.com/golang/go/issues/40569,所以前面使用启动内核传入的参数 localIPs
|
||||
LocalIPs = append(LocalIPs, LocalHost)
|
||||
LocalIPs = gulu.Str.RemoveDuplicatedElem(LocalIPs)
|
||||
return LocalIPs
|
||||
ret = GetPrivateIPv4s()
|
||||
}
|
||||
|
||||
ret = []string{}
|
||||
ret = append(ret, GetPrivateIPv4s()...)
|
||||
ret = append(ret, LocalHost)
|
||||
ret = gulu.Str.RemoveDuplicatedElem(ret)
|
||||
|
||||
for i, _ := range ret {
|
||||
ret[i] = "http://" + ret[i] + ":" + ServerPort
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue