zeel01 / MonsterBlocks

A Foundry VTT module to add NPC sheets that faithfully reproduce the appearance of D&D 5e monster statblocks.
29 stars 26 forks source link

'Show to Players' button when showing actor artwork from MonsterBlocks doesn't load the image #191

Open Datedsandwich opened 2 years ago

Datedsandwich commented 2 years ago

It's taken me a little bit to pin this down, but showing my players actor artwork hasn't been working for a while. It seems like this is only an issue if I try and do it from the MonsterBlocks sheet, if I use a different character sheet then this works fine.

There are no console errors, my players do get the pop-up but the image never loads.

It's not urgent as I have other ways to do it, but didn't see an issue for this. I don't have a lot of information about what's causing it so I understand this might be difficult to reproduce

jeremyregnerus commented 2 years ago

I do not have the current build on my machine, but I can confirm that this works correctly in #185 Quick toggle to sheet image. So hopefully once the merge requests start going through again, this will be resolved for you.

davelamorte commented 2 years ago

Hello, any news about this issue? I have some more information that might be helpful.

On the player's side, this is what the console says when I try to show them the iron golem avatar picture:

GET https://localhost:30006/assets/srd5e/img/bestiary/MM/Iron%20Golem.jpg 499 (Request has been forbidden by antivirus)

So basically, instead of giving them the link with the correct DNS/External IP, it's giving them a localhost link, which obviously cannot work for them since they don't have the server on at all.

I hope this helps fixing it... it's a feature that my group and I enjoy very very much! A quick way to show them what they are up against, priceless!

zeel01 commented 2 years ago

Ah, that's very interesting. No wonder it's impossible for me to reproduce - I can only test locally. I'm not sure why this would be happening, it should be a relative link and therefore not point to a specific domain but for some reason that must not be the case.

davelamorte commented 2 years ago

If I can help you anyhow just let me know. I could set up a server for you to try stuff up. I'm no good with Java otherwise I would have tried debugging it myself... But I'm pretty savvy when it comes to setting up servers.

davelamorte commented 2 years ago

Hello, I just wanted to say that the issue is still in there. It can be tested even locally, by simply opening a second browser to login as a player, and sharing the image to the players. Everything works fine, but the link has "localhost" instead of the correct IP/DNS address.

davelamorte commented 1 year ago

Hello! Still no news about this issue? It used to work perfectly before... I'm almost sure it should be something easy to replace for a coding expert. It needs to avoid linking the image to the players as the localhost's address and send out the public ip/dns instead... Please, this feature is so, so useful! Especially when using PNGs... as a workaround I need to always have a journal with the image ready, it's a mess!

davelamorte commented 1 year ago

Hello, I have a little news about this issue. I was wondering if there could be a work-around since it's a feature I actually want to use multiple times per session and I found one, which probably helps creating an easy fix for the module. The feature works as intended only if you (the GM) use a browser to connect to your Foundry server, using the public DNS which your players use. This way, when I share the image, the source link of the image actually has the public link and it works flawless. If instead I use the Foundry client (which is much better for me, because I have a special mouse setup that triggers when I use such application) or using a browser but with localhost instead of the public DNS, when I share the image the source link becomes "localhost" and doesn't work.

Basically, the sharing image sends the link of "my" image to the players, and not the public DNS link, as it should instead. Is there a way to fix it, forcing it to always share the public link rather than the local one?

brother-oak commented 1 year ago

I also hit this issue when using a "TV Player" on a TV screen in an IRL session. My laptop is running the Foundry server locally, and a second machine connected to the TV is running as a client connected to my server using its internal IP address. Everything runs fine, but I get the mentioned error when trying to "show to players" from the monster blocks character sheet. Note that if I show art to players using the token icon to display the art and then "show players" it all works ok. Obviously this has nothing to do with Monster Blocks, but does show that my system is correctly able to display pictures using my network setup, so the bug is something to do with how MB provides the URL to the client.

davelamorte commented 1 year ago

The issue is pretty simple, but unfortunately I'm not a coder so I couldn't fix it myself.

If you use Foundry's own server/client, the "internal" link is "localhost". What this plugin does, is to look for the link of the image that is showing on your client, and obviously that link is the internal one (localhost) rather than the external one, so anyone external to your computer cannot see anything.

I guess the author of the plugin never used Foundry's client, otherwise he would have noticed right away. The workaround is as simple as the issue: just don't use Foundry's client. If you use any browser to login as DM (with the correct external IP, not your internal one), everything works as it should.

In your specific case, since I guess your TV client is in the same network as your server, you could also try to force it to redirect all traffic from localhost to your server IP address (breaking up a number of other things though), but I'm pretty sure that simply using the external IP is easier, and it should work right away.

Unfortunately this isn't a feasible solution for me, because I need to use Foundry's client for other reasons, so this feature has been lost for me for more than a year now.