Would you please...

in
Subscribe to Would you please... 9 posts, 2 voices



Marti Scriptwright
FirefoxX11

Would you please use this scripts specific meta.js routine along with @version for update checks instead of the below code?

This will speed things up for everyone. Thanks

...
var CHECKFORUPDATES=true;
// unter welchem URL finde ich Infos über das Script?
var UPDATEURL="http://userscripts.org/scripts/show/79822";
// unter welchem URL finde ich das Script als Installation?
var INSTALLURL="http://userscripts.org/scripts/source/79822.user.js";
...
  GM_xmlhttpRequest
  ( { method: 'GET', 
      url: UPDATEURL, 
      onload: function(r) 
      { if (r.status==200)
        { XML = r.responseText;
          DoUpdateCheck(XML);
...
function DoUpdateCheck(XML)
{ var ThisVersion = GM_getValue("Version","version");
  var OnlineVersion = ParseXMLforVersion(XML);
...
function ParseXMLforVersion(XML)
{ // aus XML den Versionsstand herausziehen:
  var H = XML;
  var Pos = H.indexOf("<div id='summary'>");
  if (Pos<0) return "OnlineVersion";
  H = H.substr(Pos,H.length);
  
  Pos = H.indexOf("<b>Version:</b>");
...

 
Marti Scriptwright
FirefoxX11

PM issued.

 
Marti Scriptwright
FirefoxX11

Amtsleiter wrote:
Wer bist du und warum willst du mir was vorschreiben?
This didn't translate to my native language very well in the translator but with some greatly appreciated help from...

Haruspex9 wrote:
For me the linked “specific meta.js routine” is just a scriptheader with more additional information, which do seem not necessary to us.
It is necessary to reduce the bandwidth traffic on USO. Currently when this script update checks it is scraping the script homepage which in effect causes 404 Not Found, 502 Bad Gateway, 503 Service Unavailable and perhaps some that I have not seen. This makes browsing the site here on USO very difficult. The current stats on the server is 100+ hits per second and downloading the script homepage via an AJAX call is triggering the Rate and Limiting Wall for everyone. This script isn't the only script doing this but I can only do so many notification requests at one time especially when it takes 15 times just to post a reply here. :)

 
Marti Scriptwright
FirefoxX11

I'm also unable to post the code modifications here due to the Rate and Limiting Wall today... but I'll paste in the rest of my explanation hopefully...

Currently this script treats the retrieved document as an XML document which is correct in this case however doing this causes a Distributed Denial of Service (DDoS) attack on USO and it's Users.

With the specific meta.js routine it eases up the server load and User bandwidth load but there will need to be a change in how the retrieved file is handled. Instead of XML it should treat it at least as a "plain-text" file that can be parsed via a regular expression to retrieve the @version value and compare that to the scripts persistent storage value of @version with GM_getValue.

I appreciate the translation help and I hope that we can come to a mutual understanding of what is requested here before this script gets unlisted and inaccessible. The meta.js routine is designed specifically for updating purposes here on USO to prevent DDoS attacks.

Ideally this update check should not occur all the time and should have a timed interval of checks not to exceed once every 15 minutes. Most updaters that do not have the DDoS attack check at minimum of 1 hour and a maximum interval of 1 day or so. You can read up on these at this guide and also search for other topics of the same name here on USO by me for additional details but this is primarily the gist of it.

 
Haruspex9 Scriptwright
FirefoxWindows

First of all thanks for your reply :)
But I think you missunderstood me. I wasnt at all saying, that changing the code doesnt seem necessary to us! What I was trying to say is, the header you linked didnt seem necessary to be replacing our header in the code. I understand your issues with our code very well, I just didnt get how to help them ;)

Thanks for your further explaination so far, Ill try my best to fix the code :)
Our code isnt meant to check every second for updates. Atm we are checking every 6 hours for updates, when we are uploading less updates its going to go back to one check per day.

 
Haruspex9 Scriptwright
FirefoxWindows

My local version of the script is now changed. It will be online with the next update (we cant update atm because of other changes we have to test first) :)
I would like to contact you then to make sure its what you thought of :)

 
Marti Scriptwright
FirefoxX11

Haruspex9 wrote:
Our code isnt meant to check every second for updates. Atm we are checking every 6 hours for updates
I'm not quite seeing this in the code here... from what it looks like the interval is every page load now. :\

Would you tell me what line you have the check on? There is quite a bit of abstraction in the code which makes it a little unclear to me. This code makes it look like it is doing it every page load but I might be missing another test elsewhere:

...
function updateTest()
{ // prüfen, ob heute bereits ein Update-Check stattgefunden hat:
  var LastUpdate = GM_getValue("LastUpdate","0");
  var heute = NowDateString();
  mylog("heute = " + heute + "\nLastUpdate = " + LastUpdate);
  
  // wenn ja, nicht noch einmal prüfen
  if (LastUpdate >= heute ) return;

  // heute nicht nochmal prüfen
  GM_setValue("LastUpdate",heute);  // This sets the last update to "today" with no interval increment.
...
Haruspex9 wrote:
I would like to contact you then to make sure its what you thought of :)
Posting the script update to USO will be fine... I'm watching this topic. :) It is now using the specific meta.js routine but the interval is still in question. Thanks.

 
Haruspex9 Scriptwright
FirefoxWindows

Thats why I personally dont like german comments or variables in codes...
heute and LastUpdate are dates (yyyymmdd). In the lines you quoted theyre compared. If 'heute' (=today) is before LastUpdate, there wont be an update.
That causes one updatecheck per day.

if (LastUpdate >= heute ) return;
Last Update is the date of the last Updatedatecheck, heute is the date of today.

 
Marti Scriptwright
FirefoxX11

Haruspex9 wrote:
heute and LastUpdate are dates (yyyymmdd).
Ahh okay... that makes more sense to me today even though it's a bit unusual with a small chance of overlap depending on clock and usage patterns. Thanks for taking a moment to explain and thank you for your assistance. :) Hopefully others can take some of this discussion into their scripts as well.