This is the sh script - it's a simplified but functional script that
will update a single ngrok tunnel for the skill:


Code:
--------------------
    
  #!/bin/sh
  
  UUID="a84fb223c34002944701a9a70e5e82b65e01cda21b6e8914"
  URL="`wget -qO- http://localhost:4040/api/tunnels | grep -Po https://.+?\.io`";
  DATA=[{\"name\":\"false\",\"url\":\"${URL}\"}]
  RES="`wget -qO- 
"https://smartskills.tech/linking/updateNgrok.php?uuid=${UUID}&data=${DATA}"`";
  echo $RES
  
--------------------


The GET to smartskills.tech sends the uuid and a tunnel specification
for a single tunnel. When people link multiple LMS servers, there can be
multiple tunnels so the python and perl create a JSON array of values,
but from pCP when there is only one tunnel we can skip all the fancy
looping JSON creation and just hack a JSON string manually. It looks
like [{"name":"false","url":"https://abcdef123456.ngrok.io"}], which is
created here with the DATA= statement. The "name" is the tunnel name and
when there is only one tunnel a string value of "false" is expected.

The tunnel url is in the :4040 response as the "public_url" parameter.
My grep -Po just tries to grab that to a string using a regex. If you
can do that with your awk then this script should work. Make sure you
set the correct uuid constant in the file.


------------------------------------------------------------------------
philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920
View this thread: http://forums.slimdevices.com/showthread.php?t=111016

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to