Skip to content

启用伺服时显示本机所有网卡的 IP #4526

Closed
@Zuoqiu-Yingyi

Description

@Zuoqiu-Yingyi
Contributor

在什么情况下你需要该特性? In what scenarios do you need this function?

移动端设备一般具有多个网卡(移动网络, WLAN, WLAN 热点共享网络, 蓝牙共享网络, USB 共享网络等等), 且一般都是动态分配的 IP, 因此启用网络伺服功能时显示的本机 IP 在许多情况下是不满足需求的, 因此需要在启用伺服时显示本机所有网卡对应的 IP

描述可能的最优解决方案 Describe the optimal solution

启用伺服功能时在关于页面显示本机所有网卡的 IP

Activity

changed the title [-]客户端启动伺服功能时显示本机所有网卡的 IP[/-] [+]移动端启动伺服功能时显示本机所有网卡的 IP[/+] on Apr 7, 2022
self-assigned this
on Apr 7, 2022
JCJC01

JCJC01 commented on Apr 12, 2022

@JCJC01

一台手机一台pc,手机自己做热点让pc联网,然后手机想伺服在pc上网页打开siyuan;但是查看手机的伺服地址时显示的是127.0.01的地址,是无法使用的;
所以需要一台手机做热点,另外一台手机和一台pc同时连到第一台手机才能实现伺服功能,这样就复杂了,需要两台手机

88250

88250 commented on Apr 18, 2022

@88250
Member

这里有点问题,即使显示了也不能用,因为 serve path 必须是在启动时一次性传对的,否则静态资源文件中的路径就不对了(启动时会替换 window.location.hostname 为 serve path)。

暂时不做改变,等后面看有没有更好的方案。

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

这里有点问题,即使显示了也不能用,因为 serve path 必须是在启动时一次性传对的,否则静态资源文件中的路径就不对了(启动时会替换 window.location.hostname 为 serve path)。

暂时不做改变,等后面看有没有更好的方案。

这个简单, 列出所有网卡名与对应的 IP 后让用户选择, 选择后重新启动即可

88250

88250 commented on Apr 18, 2022

@88250
Member

选错了有可能就再也进不去了。

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

选错了有可能就再也进不去了。

本机访问不是使用回环地址嘛, 这个也会出问题嘛

88250

88250 commented on Apr 18, 2022

@88250
Member

静态资源用的都是一个地址,不然会跨域。

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

静态资源用的都是一个地址,不然会跨域。

桌面端启用伺服后可以同时使用回环地址与局域网段地址访问呀, 我分别使用

  1. localhost:6806
  2. 127.0.0.1:6806
  3. 192.168.1.11:6806
  4. 172.21.224.1:6806
  5. 192.168.27.1
  6. 192.168.119.1
    发现都能正常访问😂
88250

88250 commented on Apr 18, 2022

@88250
Member

那可能是浏览器缓存?

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

那可能是浏览器缓存?

不是, 已经禁用, 且发现容易出问题的 pdf.js 与 lute.js 请求 host 也都随 IP 更改更换

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

image

image

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 18, 2022

@Zuoqiu-Yingyi
ContributorAuthor

@88250 又经过了一次测试, 手机开启伺服, 同时启用 USB 共享网络(192.168.152.95:6806), 蓝牙共享网络(192.168.44.1:6806), WLAN(192.168.1.110:6806), 加上本机共四台物理设备, 可以同时访问

88250

88250 commented on Apr 19, 2022

@88250
Member

@Zuoqiu-Yingyi 比如使用其中一个 IP 访问时,静态资源的加载地址是?

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 19, 2022

@Zuoqiu-Yingyi
ContributorAuthor

@Zuoqiu-Yingyi 比如使用其中一个 IP 访问时,静态资源的加载地址是?

image

Zuoqiu-Yingyi

Zuoqiu-Yingyi commented on Apr 19, 2022

@Zuoqiu-Yingyi
ContributorAuthor

这里有点问题,即使显示了也不能用,因为 serve path 必须是在启动时一次性传对的,否则静态资源文件中的路径就不对了(启动时会替换 window.location.hostname 为 serve path)。

暂时不做改变,等后面看有没有更好的方案。

所以启用伺服后简单显示所有网卡的名称和 IP 即可,无需重新设置

88250

88250 commented on Apr 19, 2022

@88250
Member

等后面我们再确认下,感谢帮助。

reopened this on Apr 19, 2022
changed the title [-]移动端启动伺服功能时显示本机所有网卡的 IP[/-] [+]启用伺服时显示本机所有网卡的 IP[/+] on Apr 19, 2022
added this to the 2.0.0 milestone on Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@Zuoqiu-Yingyi@JCJC01

      Issue actions

        启用伺服时显示本机所有网卡的 IP · Issue #4526 · siyuan-note/siyuan