diff --git a/code/game_status.js b/code/game_status.js index fdeac3d8..b28ba0c0 100644 --- a/code/game_status.js +++ b/code/game_status.js @@ -12,15 +12,14 @@ window.updateGameScore = function(data) { } // hacky - but here is as good as any for a location - // the niantic servers have attempted to obfuscate the client/server protocol, by munging the request parameters - // detecting which munge set should be used is tricky - even the stock site gets it wrong sometimes - // to detect the problem and try a different set is easiest in a place where there's only a single request of that type - // sent at once, and it has no extra parameters. this method matches those requirements + // tne niantic servers include a 'version' parameter with the requests. this is changed for any site update they + // roll out, even when the protocol has no changes at all. (and sometimes when there's no other client javascript + // changes of any kind!) if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) { - if (data.error == 'missing version') { + if (data.error == 'out of date') { dialog({ title: 'Reload IITC', - html: '

IITC is using an outdated munge set. This can happen when Niantic update the standard intel site.

' + html: '

IITC is using an outdated version code. This will happen when Niantic update the standard intel site.

' +'

You need to reload the page to get the updated changes.

' +'

If you have just reloaded the page, then an old version of the standard site script is cached somewhere.' +'In this case, try clearing your cache, or waiting 15-30 minutes for the stale data to expire.

', diff --git a/plugins/bad-version-code-fix.user.js b/plugins/bad-version-code-fix.user.js new file mode 100644 index 00000000..38526204 --- /dev/null +++ b/plugins/bad-version-code-fix.user.js @@ -0,0 +1,25 @@ +// ==UserScript== +// @id iitc-plugin-fix-bad-version-code@jonatkins +// @name IITC plugin: Fix bad version codes +// @category Tweaks +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Sometimes Niantic deployments break, causing an old version of the gen_dashboard.js to be served. This has an out-of-date version code. This plugin overrides known bad codes with the one that should be current. +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// @grant none +// ==/UserScript== + + +// NOTE: non-standard plugin - designed to work with both IITC *and* the standard intel site + +// do NOT use as a template for other IITC plugins + +var fixUrl = (window.location.protocol!=='https:'?'http://iitc.jonatkins.com':'https://secure.jonatkins.com/iitc')+'/bad-version-code-fix.js'; +var script = document.createElement('script'); +script.setAttribute('src', fixUrl); +(document.body || document.head || document.documentElement).appendChild(script); diff --git a/website/bad-version-code-fix.js b/website/bad-version-code-fix.js new file mode 100644 index 00000000..70345a54 --- /dev/null +++ b/website/bad-version-code-fix.js @@ -0,0 +1,21 @@ +// this script can be loaded by an IITC plugin, to fix known bad version codes when Niantic have a bad deployment + +(function(){ + + var fixes = { + // 2014-08-02 - broken for 24h+ + '81ad679ab5bc219ef3bcf7ca9b760e917cf0c558': 'afdb91368730a906bae38b2837cc411f880350fa', + + }; + + + var fixed = fixes[nemesis.dashboard.config.CURRENT_VERSION]; + + if (fixed) { + console.warn('VersionCodeFixer: bad nemesis.dashboard.config.CURRENT_VERSION: is '+nemesis.dashboard.config.CURRENT_VERSION+', should be '+fixed); + nemesis.dashboard.config.CURRENT_VERSION = fixed; + } else { + console.log('VersionCodeFixer: no known fixes needed'); + } + +})();