SvenWerlen / moulinette-core

FoundryVTT module which provides a set of tools for DMs for managing assets.
https://www.patreon.com/moulinette
MIT License
40 stars 10 forks source link

Non-host GMs can't use Moulinette for games hosted on The Forge #40

Closed rikmarais closed 2 years ago

rikmarais commented 2 years ago

Unless an S3 bucket is configured which specifies a base URL, Moulinette references assets by relative path. When hosted on The Forge, using the relative path will try to access the game host's asset library rather than the current user's. This means that non-host GMs can't reference their own Moulinette assets.

If running on The Forge and not using an S3 bucket, the path to the current user's assets library should be the base URL. Code like the following in moulinette-file-util.js getBaseURL could be used to get the base URL of the current user's assets library.

if (typeof ForgeVTT !== "undefined" && ForgeVTT.usingTheForge)  {
      const theForgeAssetsLibraryUserPath = ForgeVTT.ASSETS_LIBRARY_URL_PREFIX + (await ForgeAPI.getUserId() || "user");
      return theForgeAssetsLibraryUserPath ? theForgeAssetsLibraryUserPath + "/" : "";
}
SvenWerlen commented 2 years ago

Thank you for reporting this. I'll have to check this by myself to better understand how paths are defined on The Forge.

SvenWerlen commented 2 years ago

Implemented in v-4.5.1 (moulinette-core). It did fix the issue for non-host GMs. However, I'm not 100% sure of the impact for host GMs (who will also have their baseURL changed). I'll monitor any issue related to this.

SvenWerlen commented 2 years ago

Had to roll it back do to use of "await" in non-sync function. Requires more effort.

SvenWerlen commented 2 years ago

I have been able to do all the required changes to make that function asynchronous. The new modules are available for beta testing. See : https://www.patreon.com/posts/66471992

rikmarais commented 2 years ago

Great! Thank you for your hard work