fix version code error check dialog in game_score.js
add plugin, and matching external js file for the website, to fix known bad version codes
This commit is contained in:
parent
bc6d0cac84
commit
bf586282e6
@ -12,15 +12,14 @@ window.updateGameScore = function(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hacky - but here is as good as any for a location
|
// 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
|
// tne niantic servers include a 'version' parameter with the requests. this is changed for any site update they
|
||||||
// detecting which munge set should be used is tricky - even the stock site gets it wrong sometimes
|
// roll out, even when the protocol has no changes at all. (and sometimes when there's no other client javascript
|
||||||
// to detect the problem and try a different set is easiest in a place where there's only a single request of that type
|
// changes of any kind!)
|
||||||
// sent at once, and it has no extra parameters. this method matches those requirements
|
|
||||||
if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) {
|
if (data.error || (data.indexOf && data.indexOf('"error"') != -1)) {
|
||||||
if (data.error == 'missing version') {
|
if (data.error == 'out of date') {
|
||||||
dialog({
|
dialog({
|
||||||
title: 'Reload IITC',
|
title: 'Reload IITC',
|
||||||
html: '<p>IITC is using an outdated munge set. This can happen when Niantic update the standard intel site.</p>'
|
html: '<p>IITC is using an outdated version code. This will happen when Niantic update the standard intel site.</p>'
|
||||||
+'<p>You need to reload the page to get the updated changes.</p>'
|
+'<p>You need to reload the page to get the updated changes.</p>'
|
||||||
+'<p>If you have just reloaded the page, then an old version of the standard site script is cached somewhere.'
|
+'<p>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.</p>',
|
+'In this case, try clearing your cache, or waiting 15-30 minutes for the stale data to expire.</p>',
|
||||||
|
25
plugins/bad-version-code-fix.user.js
Normal file
25
plugins/bad-version-code-fix.user.js
Normal file
@ -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);
|
21
website/bad-version-code-fix.js
Normal file
21
website/bad-version-code-fix.js
Normal file
@ -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');
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
Loading…
x
Reference in New Issue
Block a user