Skidamek / AutoModpack

Enjoy a seamless modpack installation process and effortless updates with a user-friendly solution that simplifies management, making your gaming experience a breeze.
https://modrinth.com/mod/automodpack
GNU Lesser General Public License v3.0
91 stars 29 forks source link

Send proper message when client fails to ping http server #134

Closed IfgiU closed 11 months ago

IfgiU commented 1 year ago

Bug description

Hi! I'm currently testing out this mod, and stumbled upon some weird behaviour: When joining for the first time, everything works fine, the modpack gets downloaded by the client. However, if I delete the instance where the mods are installed and create a new one that only runs AutoModpack, it won't download the modpack again, leading to errors. Is the server caching which players have downloaded the modpack? If so, maybe this is the cause of it? Tho I haven't found a file that could be a cache.

Steps to reproduce

  1. Have a server with AutoModpack and a modpack
  2. Have a client only with AutoModpack
  3. Join
  4. Quit Minecraft
  5. Create new instance only with AutoModpack
  6. Join
  7. Fail to join because mods aren't present

Expected behavior

Not failing to join

Actual behavior

Failed to join

Relevant logs

The only logs worthy to be mentioned are these two lines from the server: [23:02:43] [Netty Epoll Server IO #2/INFO]: MyUsername has installed AutoModpack. [23:02:46] [Netty Epoll Server IO #2/INFO]: MyUsername has installed whole modpack The last message is definetly wrong, I had not installed the modpack.

Minecraft version & Mod Loader

1.19.3 fabric

Operating system

Windows 11

AutoModpack version

3.3.6

Other information

Also, /automodpack generate does not seem to help.

Check list

Skidamek commented 1 year ago

Are you sure, you are creating completely fresh instance? Server does not have any cache. Only way it could let you join with false positive that you have installed modpack is to client have same modpack-content.json in /automodpack/modpacks/<modpack>/ as server provides... I can't reproduce this by creating new instances using prism launcher.

IfgiU commented 1 year ago

So, I think I found the problem. The /automodpack/modpacks folder was empty, so the problem wasn't here. I'm also using Prism Launcher on the newest version, so the instances were clean. It turns out that when the hostIp in automodpack-server.json doesn't match the actual IP, the check for the modpack seems to get skipped. What I think was happening is that I installed the mod, it auto-set the value to the current IP, I tried stuff, the next day the IP was resetted so it no longer matched, so the error occured.

To reproduce, try setting HostIp to a wrong IP-Address on a server with AutoModpack and a Modpack and join only with AutoModpack.

Skidamek commented 1 year ago

Alright, that makes a lot of sense. Then it's not really a bug, however i will implement some more logic to it, instead of leting player join without modpack, we will kick them and send a proper message. Thanks!

IfgiU commented 1 year ago

But how exactly can I keep the hostIP up to date?

Skidamek commented 1 year ago

What do you mean up to date? Probably you would need to update it every time your ip changes.

Currently it works like that: At first config generation it just gets your server's ip from this api https://ip.seeip.org/json or that https://api.ipify.org/?format=json if case the first one does not work. I many cases thanks to that you just don't even need to worry about setting proper ip there. Then it doesn't change it, to let you configure that as you want to.

However if i understand correctly i think if you need, i can add config option to reset hostIp every server restart and get new one from api's above. If that would work for you?

IfgiU commented 1 year ago

Hi! Yeah, that would be really nice! I just don't want to login into the server and change the hostIp everytime the IP changes, so this option would be really cool!

Skidamek commented 11 months ago

I implemented it, it will be in final 3.4.0, if you would like to try it pre-released then go ahead! :) build-artifacts.zip

Skidamek commented 11 months ago

Implemented in 3.4.0