Durtur / Dungeoneer

A virtual tabletop designed for 5e D&D, includes a map tool with dynamic lighting, initiative tracker, combat tracker and homebrew management.
GNU Affero General Public License v3.0
169 stars 16 forks source link

[Feature] Allow usage of Gifs as tokens #95

Closed alcros33 closed 1 year ago

alcros33 commented 1 year ago

Description As of right now the app converts automatically any image selected as token to webp. This can be changed by manually copying the gif image to the maptool_tokens folder and renaming it to match the ID allowing the usage of gifs in the app itself. However, when the server sends images to the client it first converts it to svg or webp only making it so the clients cannot see the animation.

Proposed solution Remove the manual conversion to webp and svg added in the toBase64 in the server.util.js file. And add a request parameter for the format in the server notification of the token-image (Probably in the onBackgroundChanged function in the map.admin.js). Also add a format parameter in the case for "token-image" at the setState function in the `client.js` file.

Durtur commented 1 year ago

Sounds correct, but I think the webp conversion should be kept since it reduces the payload size by alot. The toBase64 method could support svg or gif. Any other format should just be changed to webp. If the dataAccess.commitTokenSave method is tweaked so it saves gif as actual gifs instead of webp that should be enough to support gifs.

You're welcome to create PR if you'd like otherwise I can probably take a look at this during the weekend.

alcros33 commented 1 year ago

maybe I can give it a shot, but how exactly do I host the client part? The one hosted at https://www.ogreforge.me/Dungeoneer/client given that the run_server.py seems to be empty

Durtur commented 1 year ago

It's just a static site under the /docs folder so any hosting option would do, probably the easiest being python http.server (https://pythonbasics.org/webserver/)