ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Option to shorten the display URL of RequestOpenUnsafeURL (https://www.esoui.com/forums/showthread.php?t=9547)

Keldor 01/16/21 08:05 AM

Option to shorten the display URL of RequestOpenUnsafeURL
 
Hello everybody,

I'm currently building an add-on that exports the character's skills and action bars and generates a link for the ESO-Skillfactory.

I use the LUA function RequestOpenUnsafeURL() for the generated URL.
In principle, everything works as planned, but the URL can become very long under certain circumstances (with many skills).

In the game it looks like this:


As you can see the base64 part including the active skills of the character using the whole screen size :D
Do any of you know a way to abbreviate the displayed URL so that the player still sees the entire confirm dialog? Maybe this is also a topic that ZOS_DanBatson can take a look at :)

Keldor

sirinsidiator 01/16/21 08:49 AM

Don't think that's what ZOS had in mind when they added this function. :D
Shortening the URL is unlikely to happen, since they want the user to be able to inspect what is being opened. Maybe they can change the dialog to add a scrollbar though.

You could also look into making your format more efficient so the links become shorter. Is Base64 encoding really needed for example? It will make your url longer than it needs to be when you don't use binary data.

Keldor 01/16/21 09:02 AM

You are absolutely right, but even without Base64 the URL is only slightly shorter :D


sirinsidiator 01/16/21 09:04 AM

you could take a look at the base62 encoding I use in LibHistoire for integer values. makes long integer values much shorter.

Keldor 01/16/21 09:42 AM

I think the best option would be for ZOS to include a textarea for the URL in the dialog :D

So you don't have to worry about a much longer URL when new skills are added to the game ;)

sirinsidiator 01/16/21 09:57 AM

That certainly wouldn't be a bad solution, but you'd still have to be worried, since webservers are limited in how long a url can be and you cannot send post requests from ingame.

Keldor 01/16/21 10:38 AM

I agree, the URL should not be longer than 2000 characters, luckily I'm still a bit away from that ;) I have published a first version for testing (https://www.esoui.com/downloads/info...ildExport.html).

I will collect ideas how to get the URL shorter. It would be great if someone from ZOS sees the problem with the dialog.

sirinsidiator 01/16/21 10:52 AM

One idea that comes to mind would be the use of a lookup table for skills instead of the original ids. The skills that players can unlock are only a very small subset of the available skills in game and that way you get much smaller numbers like 1, 2, 3. If you group together consecutive numbers as e.g. "1-5" you can save even more. You could then also optimize and assign common combinations so they will get a long sequence in your lookup table. In case of new skills that are not supported yet, you can just send the original id.

Keldor 01/16/21 11:30 AM

That is also a good idea. I have my internal Auto Increment IDs in the database, which start at 1 for the skills.

Keldor 01/16/21 03:05 PM

Thanks for the idea with the internal Ids, sirinsidiator :D The URL is now quite short. Not perfect but shorter than before ;)


Baertram 01/16/21 04:36 PM

Another idea, if this will work:
Use an URL shortener to shorten your starting url
https://www.eso-skillfactory.com/de/...-import/?data=
to something like https://short.url/12345

Depending on the shortened url it might be saving a bit space as well.
But the downside would be that users couldn't see the direct url that opens. But to be true I guess most wouldn't care ;)

Keldor 01/16/21 04:52 PM

I already had the idea :D I have now saved a few characters in the URL path by replacing /build-planer/addon-import/ with /import/ ;)

sirinsidiator 01/17/21 02:55 AM

Depending on how your webserver is configured, you may also just drop the www and shorten it to https://eso-skillfactory.com/import/. And if it's worth the ~65€ to you, registering an new domain like esoskf.io just for the imports could shave off another few characters. :D

Keldor 01/17/21 07:08 AM

That's actually another idea, though I'm quite happy with the current status of the URL :D

Thanks for your many suggestions here in the thread ;)

andy.s 01/18/21 02:31 AM

Use hexadecimal numbers, so e.g. 119 becomes 77 :D

Keldor 01/19/21 06:44 AM

Thanks for the idea with the hexadecimal numbers. But I think that I don't need the conversion currently, because the numbers are already quite small, since I use my own database ids. :D


All times are GMT -6. The time now is 01:19 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI