Skip to content

Commit

Permalink
now specifies which ext failed to update (for non-CWS ext)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverDecaf committed Apr 29, 2020
1 parent 4b5e4b2 commit 3aa764b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
Binary file modified Chromium Web Store.crx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "NeverDecaf",
"manifest_version": 2,
"name": "Chromium Web Store",
"version": "0.9.0",
"version": "0.9.1",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqF/d41Q7agjkUzYq8ZGbQr8XW8mmEIMXOnR1uCTnYLL+Dm9Z+LO50xZukOISNy6zFxpI8ts/OGLsm+I2x9+UprUU4/EVdmxuwegFE6NBoEhHoRNYY0gbXZkaU8YY/XwzjVY/k18DDhl5NYPEnF6uq4Oyidg+xtd3W4+iGYczuOLER1Tp5y614zOTphcvFYhvUkCijQ6HT1TtRq/34SlFoRQqo4SFiLriK451xWIcfwiMLIekWrdoQa1v8dqIlMA3r6CKc0QykJpSYbiyormWiZ0hl2HLpkZ85mD9V0eDQ5RCtb6vkybK7INcq4yKQV4YkXhr9NpX9U4re4dlFQjEJQIDAQAB",
"description": "Allow installing/updating extensions from chrome web store on chromium based browsers. Click badge to check for updates.",
"permissions": [
Expand Down
11 changes: 6 additions & 5 deletions src/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ checkForUpdates(function (updateCheck, installed_versions, appid, updatever, is_
});
appcontainer.appendChild(li);
update_status.style.display = 'none';
}, function (is_webstore, ext_name) {
let faildiv = document.createElement('h1');
faildiv.setAttribute('class', 'updatefailure');
faildiv.innerHTML = ext_name + ' Update Failed';
appcontainer.appendChild(faildiv);
}, function () {
update_status.innerHTML = 'UPDATE CHECK FAILED';
update_status.setAttribute('id', 'updatefailure');
}, function () {
if (update_status.getAttribute('id') != 'updatefailure')
update_status.innerHTML = 'All extensions are up to date!';
update_status.innerHTML = 'All extensions are up to date!';
});
19 changes: 13 additions & 6 deletions src/scripts/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const chromeVersion = /Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1];
const webstoreUrl = 'clients2.google.com/service/update2/crx';

function checkForUpdates(update_callback = null, failure_callback = null, completed_callback = null) {
chrome.management.getAll(function (e) {
let default_options = {
Expand All @@ -19,15 +20,21 @@ function checkForUpdates(update_callback = null, failure_callback = null, comple
if (webstoreUrl == ex.updateUrl.replace(/^(?:https?:\/\/)?/i, "")) {
updateUrl += '&x=id%3D' + ex.id + '%26uc';
} else if (settings.check_external_apps) {
updateUrls.push(ex.updateUrl);
updateUrls.push({
'url': ex.updateUrl,
'name': ex.name
});
}
installed_versions[ex.id] = ex;
}
});
if (settings.check_store_apps)
updateUrls.push(updateUrl);
updateUrls.push({
'url': updateUrl,
'name': 'CWS Extensions'
});

function getNewXhr(is_webstore) {
function getNewXhr(is_webstore, ext_name) {
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {
Expand Down Expand Up @@ -60,7 +67,7 @@ function checkForUpdates(update_callback = null, failure_callback = null, comple
});
} else {
if (failure_callback)
failure_callback();
failure_callback(is_webstore, ext_name);
if (is_webstore)
chrome.browserAction.setBadgeText({
text: "?"
Expand All @@ -78,8 +85,8 @@ function checkForUpdates(update_callback = null, failure_callback = null, comple
if (pending_updates == 0 && completed_callback)
completed_callback();
updateUrls.forEach(function (uurl) {
xhr = getNewXhr(uurl == updateUrl);
xhr.open("GET", uurl, true);
xhr = getNewXhr(uurl.url == updateUrl, uurl.name);
xhr.open("GET", uurl.url, true);
xhr.send();
xhr.onloadend = function () {
pending_updates--;
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ a:hover {
color:red;
}

#updatefailure {
.updatefailure {
font-weight: bold;
background-color: red;
}
Expand Down
2 changes: 1 addition & 1 deletion updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='ocaahdebbfolfmndjeplogmgcagdmblk'>
<updatecheck codebase='https://github.com/NeverDecaf/chromium-web-store/releases/latest/download/Chromium.Web.Store.crx' version='0.9.0' />
<updatecheck codebase='https://github.com/NeverDecaf/chromium-web-store/releases/latest/download/Chromium.Web.Store.crx' version='0.9.1' />
</app>
</gupdate>

0 comments on commit 3aa764b

Please sign in to comment.