Would you please...
![]() ![]() |
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>");
...
|
![]() ![]() |
PM issued. |
![]() ![]() |
Amtsleiter wrote:This didn't translate to my native language very well in the translator but with some greatly appreciated help from... Haruspex9 wrote: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. :) |
![]() ![]() |
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. |
![]() ![]() |
First of all thanks for your reply :)
Thanks for your further explaination so far, Ill try my best to fix the code :)
|
![]() ![]() |
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) :)
|
![]() ![]() |
Haruspex9 wrote: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: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. |
![]() ![]() |
Thats why I personally dont like german comments or variables in codes...
|
![]() ![]() |
Haruspex9 wrote: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. |


