rejetto / hfs

HFS is a web file server to run on your computer. Share folders or even a single file thanks to the virtual file system.
GNU General Public License v3.0
2.13k stars 209 forks source link

admin pannel show frontend url wrong #581

Closed cnzyan closed 4 months ago

cnzyan commented 4 months ago

BEFORE

To Reproduce Steps to reproduce the behavior: When 80 port used by other app,hfs will require a “config port 1080” command in console,but after hfs started on the port set by the command such as 1080,admin pannel “Shared files” tab still advise me to visit frontend with sentence “Your shared files can be browsed from http://192.168.1.3/ or http://192.168.1.3:1080/ or http://172.17.8.15:1080/

Screenshots Try to provide videos or else screenshots to help explain your problem. image image

Environment (please complete the following information):

cnzyan commented 4 months ago

the url http://192.168.1.3/ cannot go to hfs

rejetto commented 4 months ago

this is happening because you selected that "wrong" address, manually. go to that same page, and click the pencil icon in the link field

image

it's the same if you go to the "internet" page and change the "address"

cnzyan commented 4 months ago

but i did not select any thing in this pannel. all i did were started hfs,then selected a disk location to share

rejetto commented 4 months ago

the default value is "automatic" and should not display the wrong address. it is possible that you may have selected and forgot. If you find that this is not the case please let me know, we'll reopen the issue.

cnzyan commented 4 months ago

i did not selected that option. when i try open this option,it was "automatic" already. but when i clicked "save",the urls showed in pannel changed image after a manually "save" operation, those urls showed were correct.

cnzyan commented 4 months ago

i reproduced this . when i closed hfs and removed all yaml files in hfs folder then i restartd hfs this situation reproduced

cnzyan commented 4 months ago

image screenshot above

rejetto commented 4 months ago

i will soon try to reproduce myself and let you know. thanks for reporting

cnzyan commented 4 months ago

find another possible bug hfs told me "Your shared files can be browsed from http://192.168.1.3/ or http://192.168.1.3:1080/ or http://192.168.174.1:1080/" but i cannot visit my hfs site using ip 192.168.1.3 when i use ipconfig/all command,win11 told me:

C:\Users\cnzya>ipconfig /all

Windows IP 配置

   主机名  . . . . . . . . . . . . . : Y9kX
   主 DNS 后缀 . . . . . . . . . . . :
   节点类型  . . . . . . . . . . . . : 混合
   IP 路由已启用 . . . . . . . . . . : 否
   WINS 代理已启用 . . . . . . . . . : 否

以太网适配器 以太网 4:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : VPN
   物理地址. . . . . . . . . . . . . : 00-FF-AA-BB-CC-DE
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是

以太网适配器 以太网 2:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Realtek USB GbE Family Controller
   物理地址. . . . . . . . . . . . . : 00-E0-4C-7C-7E-00
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是

无线局域网适配器 本地连接* 1:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   物理地址. . . . . . . . . . . . . : 08-8E-90-08-23-5D
   DHCP 已启用 . . . . . . . . . . . : 是
   自动配置已启用. . . . . . . . . . : 是

无线局域网适配器 本地连接* 2:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   物理地址. . . . . . . . . . . . . : 0A-8E-90-08-23-5C
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是

以太网适配器 VMware Network Adapter VMnet1:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet1
   物理地址. . . . . . . . . . . . . : 00-50-56-C0-00-01
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::b7ce:dcd6:b829:159b%16(首选)
   IPv4 地址 . . . . . . . . . . . . : 192.168.174.1(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 1040207958
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-2B-2A-57-32-08-8E-90-08-23-5C
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用

以太网适配器 VMware Network Adapter VMnet8:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet8
   物理地址. . . . . . . . . . . . . : 00-50-56-C0-00-08
   DHCP 已启用 . . . . . . . . . . . : 是
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::6131:ba14:b023:273%4(首选)
   IPv4 地址 . . . . . . . . . . . . : 192.168.230.1(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   获得租约的时间  . . . . . . . . . : 2024年5月5日 10:12:42
   租约过期的时间  . . . . . . . . . : 2024年5月5日 22:18:58
   默认网关. . . . . . . . . . . . . :
   DHCP 服务器 . . . . . . . . . . . : 192.168.230.254
   DHCPv6 IAID . . . . . . . . . . . : 1073762390
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-2B-2A-57-32-08-8E-90-08-23-5C
   主 WINS 服务器  . . . . . . . . . : 192.168.230.2
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用

无线局域网适配器 WLAN:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Intel(R) Wi-Fi 6E AX211 160MHz
   物理地址. . . . . . . . . . . . . : 08-8E-90-08-23-5C
   DHCP 已启用 . . . . . . . . . . . : 是
   自动配置已启用. . . . . . . . . . : 是
   IPv6 地址 . . . . . . . . . . . . : 2408:8214:431d:2461::1000(首选)
   获得租约的时间  . . . . . . . . . : 2024年5月5日 21:07:40
   租约过期的时间  . . . . . . . . . : 2024年5月6日 10:12:30
   IPv6 地址 . . . . . . . . . . . . : 2408:8214:431d:2461:8119:12df:4c2b:19c7(首选)
   临时 IPv6 地址. . . . . . . . . . : 2408:8214:431d:2461:adcb:fa22:d693:acd6(首选)
   本地链接 IPv6 地址. . . . . . . . : fe80::c33e:69b6:d230:505b%14(首选)
   IPv4 地址 . . . . . . . . . . . . : 192.168.10.111(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   获得租约的时间  . . . . . . . . . : 2024年5月5日 16:19:08
   租约过期的时间  . . . . . . . . . : 2024年5月5日 23:19:22
   默认网关. . . . . . . . . . . . . : fe80::ee60:73ff:fef9:a71%14
                                       192.168.10.1
   DHCP 服务器 . . . . . . . . . . . : 192.168.10.1
   DHCPv6 IAID . . . . . . . . . . . : 118001296
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-2B-2A-57-32-08-8E-90-08-23-5C
   DNS 服务器  . . . . . . . . . . . : 240c::6666
                                       2400:3200::1
                                       192.168.1.1
                                       192.168.10.1
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用

以太网适配器 蓝牙网络连接:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   物理地址. . . . . . . . . . . . . : 08-8E-90-08-23-60
   DHCP 已启用 . . . . . . . . . . . : 是
   自动配置已启用. . . . . . . . . . : 是

i have no network adapters with ip 192.168.1.3 at all

rejetto commented 4 months ago

i see, that's a bit weird, but i get those addresses from the system. do you have any disabled network?

cnzyan commented 4 months ago

i checked registry "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters" no 192.168.1.3 setted for any unpluged adapters

but i find out that my router's uplink ip is 192.168.1.3 i did not set any DMZ or upnp for hfs since hfs can read router's ip, when showed in pannel, maybe a notice “ this is your router‘s ip and you need to set upnp or DMZ” should be added by the side

cnzyan commented 4 months ago

and automatic url should prefer local ip, not router's ip

cnzyan commented 4 months ago

image "internet" tab can show correct local ip,so i think "Shared files" tab can show too

rejetto commented 4 months ago

my request to the system is for local network, not router's. i'm no network expert, and i can't say why the system is giving me that ip. i (and other people) don't get router's ip in that phase. (i get it later if i access the internet page) is it possible that you have a bridged configuration for your router? because IF your router is 192.168.1.3 as you say, then normally you should have also an address 192.168.1.XX

you are right that i can consider using the info in the "internet" page, but nobody ever reported a problem like yours.

cnzyan commented 4 months ago

my router’s LAN ip is 192.168.10.1 so my pc has ip 192.168.10.111 ipconfig/all showed: IPv4 地址 . . . . . . . . . . . . : 192.168.10.111(首选) my router's WAN ip is 192.168.1.3 i have a EPON device connect to my router‘s WAN port,which LAN ip is 192.168.1.1 and EPON has a fiber link to Internet Service Provider

cnzyan commented 4 months ago

my request to the system is for local network, not router's. i'm no network expert, and i can't say why the system is giving me that ip. i (and other people) don't get router's ip in that phase. (i get it later if i access the internet page) is it possible that you have a bridged configuration for your router? because IF your router is 192.168.1.3 as you say, then normally you should have also an address 192.168.1.XX

you are right that i can consider using the info in the "internet" page, but nobody ever reported a problem like yours.

maybe only in china ipv4 addresses are rare and we chinese must use several layers of NAT

rejetto commented 4 months ago

yes, that's possible, I too have fiber with PON but my router gets a public address.

image

this means that HFS correctly detected that you have a double NAT.

Still don't know why i see that ip if it's not really yours. What I do is to call this https://nodejs.org/api/os.html#osnetworkinterfaces

cnzyan commented 4 months ago

yes, that's possible, I too have fiber with PON but my router gets a public address. image this means that HFS correctly detected that you have a double NAT.

Still don't know why i see that ip if it's not really yours. What I do is to call this https://nodejs.org/api/os.html#osnetworkinterfaces

i run "os.networkInterfaces()" in node:

Welcome to Node.js v18.15.0.
Type ".help" for more information.
> os.networkInterfaces()
{
  '以太网 4': [
    {
      address: 'fe80::de71:2a6b:9471:970a',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:ff:aa:bb:cc:de',
      internal: false,
      cidr: 'fe80::de71:2a6b:9471:970a/64',
      scopeid: 5
    },
    {
      address: '172.17.8.33',
      netmask: '255.255.255.255',
      family: 'IPv4',
      mac: '00:ff:aa:bb:cc:de',
      internal: false,
      cidr: '172.17.8.33/32'
    }
  ],
  'VMware Network Adapter VMnet1': [
    {
      address: 'fe80::b7ce:dcd6:b829:159b',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:50:56:c0:00:01',
      internal: false,
      cidr: 'fe80::b7ce:dcd6:b829:159b/64',
      scopeid: 16
    },
    {
      address: '192.168.174.1',
      netmask: '255.255.255.0',
      family: 'IPv4',
      mac: '00:50:56:c0:00:01',
      internal: false,
      cidr: '192.168.174.1/24'
    }
  ],
  'VMware Network Adapter VMnet8': [
    {
      address: 'fe80::6131:ba14:b023:273',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:50:56:c0:00:08',
      internal: false,
      cidr: 'fe80::6131:ba14:b023:273/64',
      scopeid: 4
    },
    {
      address: '192.168.230.1',
      netmask: '255.255.255.0',
      family: 'IPv4',
      mac: '00:50:56:c0:00:08',
      internal: false,
      cidr: '192.168.230.1/24'
    }
  ],
  WLAN: [
    {
      address: '2408:8214:431d:2461::1000',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '08:8e:90:08:23:5c',
      internal: false,
      cidr: '2408:8214:431d:2461::1000/128',
      scopeid: 0
    },
    {
      address: '2408:8214:431d:2461:8119:12df:4c2b:19c7',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '08:8e:90:08:23:5c',
      internal: false,
      cidr: '2408:8214:431d:2461:8119:12df:4c2b:19c7/64',
      scopeid: 0
    },
    {
      address: '2408:8214:431d:2461:34fb:f2f8:8e0f:219',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '08:8e:90:08:23:5c',
      internal: false,
      cidr: '2408:8214:431d:2461:34fb:f2f8:8e0f:219/128',
      scopeid: 0
    },
    {
      address: 'fe80::c33e:69b6:d230:505b',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '08:8e:90:08:23:5c',
      internal: false,
      cidr: 'fe80::c33e:69b6:d230:505b/64',
      scopeid: 14
    },
    {
      address: '192.168.10.111',
      netmask: '255.255.255.0',
      family: 'IPv4',
      mac: '08:8e:90:08:23:5c',
      internal: false,
      cidr: '192.168.10.111/24'
    }
  ],
  'Loopback Pseudo-Interface 1': [
    {
      address: '::1',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      internal: true,
      cidr: '::1/128',
      scopeid: 0
    },
    {
      address: '127.0.0.1',
      netmask: '255.0.0.0',
      family: 'IPv4',
      mac: '00:00:00:00:00:00',
      internal: true,
      cidr: '127.0.0.1/8'
    }
  ]
}
>
rejetto commented 4 months ago

ok, now i understand, thanks

rejetto commented 4 months ago

i had forgotten that i add the "external ip" to the list of ips. this ip will be a public ip if you have single NAT, or otherwise if you have a double NAT like you do. if it's public, most of the cases you'll want to use that one with people, so i thought to be good to give precedence to it instead of local ones, because it has more visibility (after you configure the port-forward). I know this is not always true, because you may want to share in your LAN, but i cannot know, it's just a default and the user must configure it if necessary. In your case I don't know if this precedence is still good, i have no experience with that. I expect that you may still be reached by more people with that address. Isn't it true? I'd like to get opinions on this.

I'm not considering the port problem here. I'll do it later.

cnzyan commented 4 months ago

when use external ip, the port may change too if DMZ not setted , external port maybe setted by UPNP module in the router's setting pages , then it could by different with port set in hfs. when hfs give external urls, it will be difficult to get the correct port

rejetto commented 4 months ago

this seems a different problem, tho. HFS cannot know how you configured your router. HFS suggests an automatic address based on what it knows, but if it doesn't fit your case you have to set the address manually. You can type any address, manually. Anyway, this doesn't answer my previous question.

rejetto commented 4 months ago

fixed port bug in 0.52.5

rejetto commented 4 months ago

will you please tell me how will you use HFS on your computer behind double nat? will you use it with ipv6 or what?

cnzyan commented 4 months ago

just use hfs in lan 

---Original--- From: "Massimo @.> Date: Mon, May 6, 2024 16:11 PM To: @.>; Cc: @.**@.>; Subject: Re: [rejetto/hfs] admin pannel show frontend url wrong (Issue #581)

will you please tell me how will you use HFS on your computer behind double nat? will you use it with ipv6 or what?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rejetto commented 4 months ago

your home lan or the wan with other users of same internet provider?

cnzyan commented 4 months ago

nonono,just devices in my home lan

---Original--- From: "Massimo @.> Date: Mon, May 6, 2024 17:17 PM To: @.>; Cc: @.**@.>; Subject: Re: [rejetto/hfs] admin pannel show frontend url wrong (Issue #581)

your home lan or the wan with other users of same internet provider?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>