Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataURI not working where the syntax of the WML key conflicts with the DataURI syntax #4191

Open
gwledig opened this issue Jul 27, 2019 · 16 comments

Comments

@gwledig
Copy link

commented Jul 27, 2019

DATAURI is indicated to be useful for including artwork when the user hasn't downloaded a mod, e.g. for multiplayer sessions when players join, the DATAURI works currently in [option] image= but not elsewhere, e.g. in [unit] overlays= there is some discussion on the Wesnoth forums that this may be related to commas conflicting use where commas used in the DATAURI are being misinterpreted as overlay images for instance, this issue may be present in other image=paths such as [unit_type] and image_mod. It is interesting that it works in [option] image= presumably because this doesn't process commas like overlays. This does look like a bug at the moment, especially as it works for [option] or the DATAURI page may need clarifying, if it could be used this would be very helpful for multiplayer mods, thanks. Gwledig.m @AI0867

@Pentarctagon

This comment has been minimized.

Copy link
Member

commented Jul 27, 2019

@AI0867 btw

@gwledig

This comment has been minimized.

Copy link
Author

commented Jul 27, 2019

hmm do I add @AI0867 to the title of the post?

@gwledig gwledig changed the title DATAURI not working in locations such as overlays= and elsewhere... DATAURI not working in locations such as overlays= and elsewhere...@AI0867 Jul 27, 2019

@gfgtdf

This comment has been minimized.

Copy link
Contributor

commented Jul 27, 2019

This is somehow a design flaw but not that big of an issue I think since 1.14 will autoamticially download needed add-ons if it's configured correctly when entering a multiplayer game.

@Pentarctagon

This comment has been minimized.

Copy link
Member

commented Jul 28, 2019

The related forum thread as well, for future reference. This post in particular.

@gwledig

This comment has been minimized.

Copy link
Author

commented Jul 28, 2019

Well one idea I am testing is to just declare the addon as its own dependency in the PBL (e.g. dependencies="addonfoldername" so joining users then are forced to DL the mod right in MP lobby although I'm asking some views on this in the forum in case there are any views/problems about this...

@ProditorMagnus

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2019

That is done with require_scenario=yes instead.

@gwledig

This comment has been minimized.

Copy link
Author

commented Jul 28, 2019

ah so dependency stuff is not used for auto downloading.... thx

@gwledig

This comment has been minimized.

Copy link
Author

commented Jul 28, 2019

That seems to work great, obvioulsy each senario has to have this declared another useful one is the version number requirement e.g.

addon_min_version="3.9.8"

and it has to be placed within multiplayer...

this is great, but one suggestion, instead of booting the joiner to the MP game back into the lobby/game list, it would be good to automatically put the player in the game itself...

@soliton- soliton- changed the title DATAURI not working in locations such as overlays= and elsewhere...@AI0867 DataURI not working where the syntax of the WML key conflicts with the DataURI syntax Jul 29, 2019

@soliton- soliton- added Enhancement WML and removed Question labels Jul 29, 2019

@soliton-

This comment has been minimized.

Copy link
Member

commented Jul 29, 2019

AFAICT this is not an issue with DataURI but with certain WML keys supporting some syntax and no way to escape characters. If there is no way to use a comma without some syntax meaning in a WML key then naturally you cannot usefully put a data URI in it.

@AI0867 AI0867 self-assigned this Jul 29, 2019

@AI0867

This comment has been minimized.

Copy link
Member

commented Jul 29, 2019

Well, [unit]overlays already uses parenthetical_split to not split on commas in IPFs, so it looks like a flag to also ignore the commas in data URIs should be sufficient, or possibly yet another function that takes the same arguments but behaves slightly differently.

@gwledig

This comment has been minimized.

Copy link
Author

commented Jul 29, 2019

Ah is there some way to escape the commas in a single datauri path now? I've tried single quotes and a few other standard ways but no luck...

@AI0867

This comment has been minimized.

Copy link
Member

commented Jul 29, 2019

No, but I'm working on a new function to handle the comma-separating that is dataURI-aware.

@gwledig

This comment has been minimized.

Copy link
Author

commented Aug 3, 2019

perhaps it would be possible to allow defining DATAURI images so they can be used within image paths like a macro in case you want to re-use several times in an addon, to avoid having to include the long DATAURI string many times, potentially increasing size of addon unnecessarily e.g.

#define myimage1
[datauri string]
#enddef

image="{myimage1}"

not tried this but the above might even work for [option] image= where DATAURI works in that context now.

@ProditorMagnus

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2019

Macro does not reduce size of addon - it can decrease size of addon on your hard disk, but what is sent across network to people you play with is preprocessed WML. Though that WML is also compressed, which might reduce the harm of macros.

@CelticMinstrel

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

If it's using parenthetical split, then surrounding the entire URI in parentheses should suffice to escape the comma - image="(data:image/png;base64,...)". Does that work?

@gwledig

This comment has been minimized.

Copy link
Author

commented Aug 8, 2019

I think I tried that but will have another look...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.