Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Zuoqiu-Yingyi opened this issue Apr 7, 2022 · 15 comments
Closed

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

Zuoqiu-Yingyi opened this issue Apr 7, 2022 · 15 comments
Assignees
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Apr 7, 2022

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

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

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

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

@88250 88250 changed the title 客户端启动伺服功能时显示本机所有网卡的 IP 移动端启动伺服功能时显示本机所有网卡的 IP Apr 7, 2022
@88250 88250 self-assigned this Apr 7, 2022
@JCJC01
Copy link

JCJC01 commented Apr 12, 2022

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

@88250
Copy link
Member

88250 commented Apr 18, 2022

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

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

@88250 88250 closed this as completed Apr 18, 2022
@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Apr 18, 2022

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

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

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

@88250
Copy link
Member

88250 commented Apr 18, 2022

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

@Zuoqiu-Yingyi
Copy link
Contributor Author

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

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

@88250
Copy link
Member

88250 commented Apr 18, 2022

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

@Zuoqiu-Yingyi
Copy link
Contributor Author

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

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

  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
Copy link
Member

88250 commented Apr 18, 2022

那可能是浏览器缓存?

@Zuoqiu-Yingyi
Copy link
Contributor Author

那可能是浏览器缓存?

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

@Zuoqiu-Yingyi
Copy link
Contributor Author

image

image

@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented Apr 18, 2022

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

@88250
Copy link
Member

88250 commented Apr 19, 2022

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

@Zuoqiu-Yingyi
Copy link
Contributor Author

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

image

@Zuoqiu-Yingyi
Copy link
Contributor Author

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

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

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

@88250
Copy link
Member

88250 commented Apr 19, 2022

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

@88250 88250 reopened this Apr 19, 2022
@88250 88250 changed the title 移动端启动伺服功能时显示本机所有网卡的 IP 启用伺服时显示本机所有网卡的 IP Apr 19, 2022
@88250 88250 added this to the 2.0.0 milestone Apr 19, 2022
@88250 88250 closed this as completed Apr 19, 2022
88250 added a commit to siyuan-note/appearance that referenced this issue Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants