Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Problem] 'One Click' download changes how API works

I've developed the RoundMaster API, and it is now released via One-Click Install.  I've done extensive testing over the last 12 months by loading the JavaScript as a custom API into several games (run by myself and also by other DMs), and all seems to be working well.  Particularly (as its based on the old TrackerJacker code) the 'Stop', 'Play' & 'Pause' icons in the Turn Tracker window, next to the "Round #": However, now it has been merged & released through Roll20 GitHub, and set up to be downloaded from One-Click Install, when this is done, the 'Stop', 'Play' and 'Pause' icons show as 3 unknown characters, like this: I use the following code to create the Icons, thus eliminating any issues with individual characters in a string not being recognised - this code is identical on the master GitHub repository for RoundMaster: switch(flags.rw_state) { case RW_StateEnum.ACTIVE: graphic.set('tint_color','transparent');  indicator = String.fromCodePoint(9654)+' ';  // 9654 // log('Code for ACTIVE indicator ▶ is '+('▶ '.codePointAt(0))); break; case RW_StateEnum.PAUSED: graphic = findTrackerGraphic(); graphic.set('tint_color','#FFFFFF');  indicator = String.fromCodePoint(9613) + String.fromCodePoint(9613); // 9613 // log('Code for PAUSE indicator ▍▍ is '+('▍▍'.codePointAt(0))); break; case RW_StateEnum.STOPPED: graphic.set('tint_color','transparent');  indicator = String.fromCodePoint(9724)+' '; // 9724 // log('Code for STOPPED indicator ◼ is '+('◼ '.codePointAt(0))); break; default: indicator = tracker.custom.substring(0,tracker.custom.indexOf('Round')).trim(); break; } tracker.custom = indicator + 'Round ' + rounds; What is going wrong?  Is there any way to get the One-Click Install to not corrupt this aspect of the API?  Why does this code work differently for a custom API and for a One-Click Install version of exactly the same API code? Help!
1638882885

Edited 1638882936
timmaugh
Pro
API Scripter
The code goes through a sanitization when processed for the one-click install. I had a torii glyph as a signature in the API log if you have one of my scripts installed: I originally built it with unicode characters. They worked for manual installs, but got sanitized when it went through the one-click. I had to find safer characters to get it to display properly. I don't think there is any indication that this will change any time soon, unfortunately.
1638891008
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I had the same problem with the Reporter API. The only "solution" I found was to stick with low byte order characters.
1638962057
Ulti
Pro
Sheet Author
API Scripter
It also sanitizes away accented characters, so that perfectly valid javascript just does not work with one-click install, and I always have to use html entities in the messages. Really not nice.
1639131643

Edited 1639131690
Kurt J.
Pro
API Scripter
I ran into this with EncounterHelper. I ended up using HTML coding for the emoji/special characters I needed to use. I have a section near the top of my code that defines them and then I just use their names in my output strings: const buttonText = {   show: "S",   hide: "H", display: "📄",   remove: "⛔", rollinit: "🎲",   groupinit: "Group-Init",   resetbutton: "↩",   renamebutton: "🆔" }; I think this is what I used as a reference to find the codes: HTML Emoji Reference (w3schools.com)