2020-03-25 18:31:28 +00:00
|
|
|
var ext_api = chrome || browser;
|
|
|
|
|
|
|
|
var manifestData = ext_api.runtime.getManifest();
|
2019-01-06 01:04:40 +00:00
|
|
|
var versionString = 'v' + manifestData.version;
|
2020-02-21 17:49:49 +00:00
|
|
|
document.getElementById('version').innerText = versionString;
|
2020-12-01 16:53:32 +00:00
|
|
|
var versionString_new = document.getElementById('version_new');
|
|
|
|
versionString_new.setAttribute('style', 'font-weight: bold;');
|
|
|
|
var anchorEl;
|
2020-02-21 17:49:49 +00:00
|
|
|
|
2021-02-07 07:41:41 +00:00
|
|
|
const proxyurl = ''; //"https://cors-anywhere.herokuapp.com/";
|
2020-11-20 18:12:01 +00:00
|
|
|
const manifest_new = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/manifest.json';
|
2020-11-25 18:39:46 +00:00
|
|
|
fetch(proxyurl + manifest_new, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" } })
|
2020-03-25 18:31:28 +00:00
|
|
|
.then(response => {
|
|
|
|
if (response.ok) {
|
|
|
|
response.json().then(json => {
|
2020-08-22 17:21:32 +00: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)) {
|
2020-12-01 16:53:32 +00:00
|
|
|
anchorEl = document.createElement('a');
|
2020-12-10 19:23:12 +00:00
|
|
|
anchorEl.innerText = 'New release v' + version_new;
|
2020-12-13 12:56:12 +00:00
|
|
|
if (manifestData.applications && manifestData.applications.gecko.id.includes('magnolia')) {
|
2020-11-22 14:25:28 +00:00
|
|
|
if (installType === 'development')
|
|
|
|
anchorEl.href = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean';
|
|
|
|
else
|
|
|
|
anchorEl.href = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases';
|
|
|
|
} else
|
2020-11-01 16:46:29 +00:00
|
|
|
anchorEl.href = 'https://addons.mozilla.org/en-US/firefox/addon/bypass-paywalls-clean';
|
2020-08-22 17:21:32 +00:00
|
|
|
anchorEl.target = '_blank';
|
|
|
|
versionString_new.appendChild(anchorEl);
|
2020-10-14 15:58:07 +00:00
|
|
|
if (manifestData.name.includes('(lp')) {
|
|
|
|
let par = document.createElement('p');
|
2020-12-01 16:53:32 +00:00
|
|
|
par.innerHTML = "Limited permissions version is no longer updated (check GitLab)";
|
2020-10-14 15:58:07 +00:00
|
|
|
versionString_new.appendChild(par);
|
|
|
|
}
|
2020-10-13 15:11:35 +00:00
|
|
|
if (!manifestData.name.includes('Clean')) {
|
|
|
|
let par = document.createElement('p');
|
2020-11-20 18:12:01 +00:00
|
|
|
par.innerHTML = "<strong>You've installed a fake version of BPC (check GitLab)</strong>";
|
2020-10-13 15:11:35 +00:00
|
|
|
versionString_new.appendChild(par);
|
|
|
|
}
|
2020-08-22 17:21:32 +00:00
|
|
|
}
|
|
|
|
});
|
2020-03-25 18:31:28 +00:00
|
|
|
})
|
2020-12-01 16:53:32 +00:00
|
|
|
} else {
|
|
|
|
anchorEl = document.createElement('a');
|
|
|
|
anchorEl.text = 'Check Twitter for latest update';
|
|
|
|
anchorEl.href = 'https://twitter.com/Magnolia1234B';
|
|
|
|
anchorEl.target = '_blank';
|
|
|
|
versionString_new.appendChild(anchorEl);
|
2020-03-25 18:31:28 +00:00
|
|
|
}
|
|
|
|
});
|