ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Addon Folder Path ingame (https://www.esoui.com/forums/showthread.php?t=9218)

remosito 06/16/20 01:08 AM

Addon Folder Path ingame
 
Edit: Have a workaround to needing the path...

Howdie all,

is there a way to get my hands on the full Addon folder path?

Not just the user:/Addons/xyz I get from GetAddOnRootDirectoryPath(index)

But "C:\Users\winusername\Documents\Elder Scrolls Online\live\AddOns"

any help very much appreciated

remosito

remosito 06/16/20 01:39 AM

Might be the path won't do me any good...

just found out that RequestOpenUnsafeURL() seems to not open URLs of the type "file:///path"

Any way to circumvent that?

Alternatively:

- Any way to create a json post request with lua that will run?
- Anybody would by chance know a free place to host a http get request parameter to json send message wrapper html page?

crude version:
Lua Code:
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>Display Leads - Location Updater</title>
  7.   </head>
  8.   <body onload="sendMessage()">
  9.     Your Location Data update has been sent. <br>Many thanks!
  10.    
  11.   </body>
  12.  
  13.   <script>
  14.  
  15.     const queryString = window.location.search;
  16.     console.log(queryString);
  17.     const urlParams = new URLSearchParams(queryString);
  18.     var pa = urlParams.get('a')
  19.    
  20.     function sendMessage() {
  21.       var request = new XMLHttpRequest();
  22.       request.open("POST", "https://discord.com/api/webhooks/722214307370238005/_8RkXXwvQQ_LDsDD40_s-UR_X0sPdabmgkQ6ovMmQ8mYd9LzZbTGoIzuZeHkb-kay4VL");
  23.  
  24.       request.setRequestHeader('Content-type', 'application/json');
  25.  
  26.       var params = {
  27.         username: "rdlupdates",
  28.         avatar_url: "",
  29.         content: pa
  30.       }
  31.  
  32.       request.send(JSON.stringify(params));
  33.     }
  34.   </script>
  35. </html>

remosito 06/16/20 02:06 AM

github pages
 
Tried github pages to host my "http get request to json post send wrapper" page and it works :-)

Can send Location data updates to a discord channel.


Leaving thread for google to pick up.

Baertram 06/16/20 03:05 AM

RequestOpenUnsafeURL() only supports http and https so far as I know.
We had asked to support other links like teamSpeak3, discord etc. as well.

Curious how this works:
You save some data to the SavedVariables of an addon and let an external source (script, executable) parse the SV file + send it as http request then?
As SV will only be updated at reloadui/logout normally: Do you use the "priority update of small data to the SavedVariables" that Zos introduced?

Edit:
Oh I understood it now :) You use the http link of the github website and RequestOpenUnsafeURL() with the location data as URL ?a=<parameter>

remosito 06/16/20 03:53 AM

Quote:

Originally Posted by Baertram (Post 41542)
RequestOpenUnsafeURL() only supports http and https so far as I know.
We had asked to support other links like teamSpeak3, discord etc. as well.

Curious how this works:
You save some data to the SavedVariables of an addon and let an external source (script, executable) parse the SV file + send it as http request then?
As SV will only be updated at reloadui/logout normally: Do you use the "priority update of small data to the SavedVariables" that Zos introduced?

Edit:
Oh I understood it now :) You use the http link of the github website and RequestOpenUnsafeURL() with the location data as URL ?a=<parameter>

Exactly :-)

The github website then forwards the "a" parameter as a json post to my discord channel webhook.
Which just posts it as a new message there.

Quite the wild hack but seems to work...


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

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