Carpathias / tgce-restyler-5e3

Restyler for DnD5e 3.0
Other
4 stars 0 forks source link

[BUG] Cannot load resources due to relative paths. #12

Open Gensokian opened 7 months ago

Gensokian commented 7 months ago

Trying to load any custom resource fails due to absolute pathing. image

Versions

Foundry Ver: V11.315 System Ver: DND5e 3.1.2 Module Ver: 2.0.04

My guess:

TGCE-Restyler does not seem to like the foundry config option "FOUNDRY_ROUTE_PREFIX". (This is to my knowledge NOT a core thing but rather something used from felddyvtts docker-instanced Foundry host.) My prefix for any url is /james/, which most modules which use absolute file paths don't like and just add their path to the base URL: image (This is an example, same thing happens for the selected custom images.)

Using the "relative" delemiter for the images with "./" tries to uses the path relative to the root of the server image

I think this might be part of the same issue: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/issues/276#issuecomment-1909534664

Carpathias commented 7 months ago

Thanks for bringing this to my attention. I will see what I can do to address this.

-carp

Carpathias commented 7 months ago

Thanks for that link you provided. After reading that and understanding what is going on I was able to duplicate the issue by setting a routePrefix in my local install by modifying the foundry options.json file.

I was also able to fix both the logo image path in the Restyler UI and the sheet image paths when set. Everything is now working for me using a path pattern similar to yours with a prefix.

I have a lot of changes to polish up for the next release, which might be a few weeks. In the interim, I could tell you what lines of code to modify. Its a single line in 2 files that needs edited. Or, I could package you up a 'beta' version with some of the new updates. Its mostly UI tweaks, like now is a tabbed menu, but I am working out the styling. Dark mode for the Restyler UI is still a work in progress. It works, it just isn't pretty in dark mode.

-carp

Gensokian commented 6 months ago

Yowaddup

Honestly, I'm fine with both. A beta would obviously be the most easy to get into, but I don't know how dependencies on your module like that. (I presume not many)

If you tell me which files/paths to edit, I would prefer that. (Thinking of people who don't know how to edit, the beta would be easier but no clue on that)

Thanks for the rapid response and have a lovely Sunday! Cheers

Carpathias commented 6 months ago

Let me know if these don’t work for you. Thanks 😊

Carpathias commented 6 months ago

Code Change 1

File: tgce-restyler-5e3.hbs Edit: On line 7 correct the file path by removing the prepending /.

    `<img class="tgce-logo" src="modules/tgce-restyler-5e3/data/TGCE_RestylerLogo.png">`

This will fix the logo in the Restyler UI.

Code Change 2

File: tgce-restyler.5e3.mjs Edit: On line 438 correct the file path by removing one set of ../

    const newPath = `"../../${path}"`

This will fix the sheet image replacement.

Carpathias commented 6 months ago

Just wanted to touch base. The real life has been crazy and I haven't had the time to even look at the module to do anything. But I will.........

Gensokian commented 6 months ago

Yowaddup! Haven't been too active either; but I hope your real troubles will resolve themselves. I did try your fixes and so far they work. Feel free to close this issue either directly or when the feature is implemented! image