2020-03-25 19:27:07 +01:00
|
|
|
var ext_api = chrome || browser;
|
|
|
|
|
|
|
|
var manifestData = ext_api.runtime.getManifest();
|
2019-01-05 16:56:06 -08:00
|
|
|
var versionString = 'v' + manifestData.version;
|
2020-02-21 18:31:48 +01:00
|
|
|
document.getElementById('version').innerText = versionString;
|
|
|
|
|
2020-11-20 19:08:11 +01:00
|
|
|
const proxyurl = "https://cors-anywhere.herokuapp.com/";
|
|
|
|
const manifest_new = 'https://gitlab.com/magnolia1234/bypass-paywalls-chrome-clean/-/raw/master/manifest.json';
|
|
|
|
fetch(proxyurl + manifest_new)
|
2020-03-25 19:27:07 +01:00
|
|
|
.then(response => {
|
|
|
|
if (response.ok) {
|
|
|
|
response.json().then(json => {
|
2020-08-22 19:20:00 +02:00
|
|
|
ext_api.management.getSelf(function (result) {
|
|
|
|
var installType = result.installType;
|
|
|
|
var version_len = (installType === 'development') ? 7 : 5;
|
|
|
|
var version_new = json['version'];
|
|
|
|
if (version_new.substring(0, version_len) > manifestData.version.substring(0, version_len)) {
|
|
|
|
var versionString_new = document.getElementById('version_new');
|
2020-11-12 09:22:58 +01:00
|
|
|
versionString_new.setAttribute('style', 'font-weight: bold;');
|
2020-11-17 17:38:59 +01:00
|
|
|
versionString_new.appendChild(document.createTextNode('* '));
|
2020-08-22 19:20:00 +02:00
|
|
|
var anchorEl = document.createElement('a');
|
|
|
|
anchorEl.text = 'New release v' + version_new;
|
2020-11-20 19:08:11 +01:00
|
|
|
anchorEl.href = 'https://gitlab.com/magnolia1234/bypass-paywalls-chrome-clean/-/releases';
|
2020-08-22 19:20:00 +02:00
|
|
|
anchorEl.target = '_blank';
|
|
|
|
versionString_new.appendChild(anchorEl);
|
2020-11-12 09:22:58 +01:00
|
|
|
versionString_new.appendChild(document.createTextNode(' *'));
|
2020-10-13 17:10:56 +02:00
|
|
|
if (!manifestData.name.includes('Clean')) {
|
|
|
|
let par = document.createElement('p');
|
2020-11-20 19:08:11 +01:00
|
|
|
par.innerHTML = "<strong>You've installed a fake version of BPC (check GitLab)</strong>";
|
2020-10-13 17:10:56 +02:00
|
|
|
versionString_new.appendChild(par);
|
|
|
|
}
|
2020-08-22 19:20:00 +02:00
|
|
|
}
|
|
|
|
});
|
2020-03-25 19:27:07 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|