Javascript not working since the last update [fixed in v1.695]

edited July 25 in Problems Now Fixed

Hi all, my javascript wich prevents VPN connections stopped working after v1.690 installed.

Suddenly a "spy" started sitting on 8019 khz USB from various proxy IP addresses for long hours.

my Kiwi running on http://fsdr.duckdns.org

The script is the following (thanks to "studentkra"!)

<script type="text/javascript">
setTimeout(function(){
	var time_limit = 120;
	function httpGet(theUrl)
	{
  var xmlHttp = new XMLHttpRequest();
  xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
  xmlHttp.send( null );
  return xmlHttp.responseText;
	}
ip_test = httpGet("http://ip-api.com/json/?fields=proxy");
if ((ip_test.indexOf("true")) > 0 && (ip_test.indexOf("proxy")) > 0 )  
  {
  alert("Sorry. VPN or proxi is not support. Set time limit " + time_limit + " seconds.");
    setTimeout(() => document.location.href = "http://kiwisdr.com/", time_limit * 1000);
  }
}, 5000);
</script>


Comments

  • I didn't know anyone was using this script)))

    I will look at what is causing the error and try to fix it.

  • edited July 16

    I think, the problem is at the updated frontend of the Kiwi, not with your script.

  • @LacekHUN , I looked at your KiwiSDR. I see an error in the formatting of the script. Special characters are inserted into the body of the script. Try deleting and re-adding the script on the admin page. Use Notepad or something like that to copy and paste text. I can't check it on my KiwiSDR yet. There was an attack on our servers and they had to be disabled.

  • It looks like the Kiwi SDR server now inserts special characters into the text in the "Additional HTML/Javascript for HTML" field. This violates the integrity of the javascript code. You can use a minimized script (this is one line of code without spaces). It's working. I checked it out. However, for https, you need to slightly change the request form.


  • @studentkra many many thanks, now working :)

    studentkra
  • Thanks for this. Fixed in the next release.

    I'm moving more and more configuration items to be stored using JSON format. But in the case of the "additional HTML" item there has to be a JSON-to-HTML conversion at runtime. And I didn't get that quite right for the case of JSON escaped tabs and newlines where it makes a difference for script tags.

  • It seems that in the code that the user receives, the tab sign is replaced with "/t". If you don't use tabs in javascript, then everything works.

Sign In or Register to comment.