Skip to content

Commit

Permalink
bump version to 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverDecaf committed Dec 9, 2021
1 parent 0803947 commit 6698b75
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 192 deletions.
Binary file modified Chromium Web Store.crx
Binary file not shown.
2 changes: 1 addition & 1 deletion en_nolocale/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"author": "NeverDecaf", "manifest_version": 2, "name": "Chromium Web Store", "description": "Enables installation and semi-automatic updating for extensions from the Chrome Web Store (or elsewhere) on Chromium based browsers.", "version": "1.4.2", "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqF/d41Q7agjkUzYq8ZGbQr8XW8mmEIMXOnR1uCTnYLL+Dm9Z+LO50xZukOISNy6zFxpI8ts/OGLsm+I2x9+UprUU4/EVdmxuwegFE6NBoEhHoRNYY0gbXZkaU8YY/XwzjVY/k18DDhl5NYPEnF6uq4Oyidg+xtd3W4+iGYczuOLER1Tp5y614zOTphcvFYhvUkCijQ6HT1TtRq/34SlFoRQqo4SFiLriK451xWIcfwiMLIekWrdoQa1v8dqIlMA3r6CKc0QykJpSYbiyormWiZ0hl2HLpkZ85mD9V0eDQ5RCtb6vkybK7INcq4yKQV4YkXhr9NpX9U4re4dlFQjEJQIDAQAB", "permissions": ["management", "https://clients2.google.com/service/*", "storage", "alarms", "contextMenus", "downloads"], "optional_permissions": ["https://*/", "http://*/"], "browser_action": {"default_icon": {"16": "assets/icon/icon_16.png", "24": "assets/icon/icon_24.png"}, "default_title": "Chromium Web Store", "default_popup": "popup.html"}, "content_scripts": [{"matches": ["https://chrome.google.com/webstore/*", "https://addons.opera.com/*extensions/details/*", "https://microsoftedge.microsoft.com/addons/detail/*"], "js": ["scripts/inject.js"], "run_at": "document_end"}], "background": {"scripts": ["scripts/util.js", "scripts/background.js"], "persistent": false}, "update_url": "https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates_en_nolocale.xml", "icons": {"16": "assets/icon/icon_16.png", "24": "assets/icon/icon_24.png", "32": "assets/icon/icon_32.png", "48": "assets/icon/icon_48.png", "64": "assets/icon/icon_64.png", "128": "assets/icon/icon_128.png"}, "homepage_url": "https://github.com/NeverDecaf/chromium-web-store", "options_ui": {"page": "options.html", "chrome_style": true}, "storage": {"managed_schema": "managed_storage.json"}}
{"author": "NeverDecaf", "manifest_version": 2, "name": "Chromium Web Store", "description": "Enables installation and semi-automatic updating for extensions from the Chrome Web Store (or elsewhere) on Chromium based browsers.", "version": "1.4.3", "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqF/d41Q7agjkUzYq8ZGbQr8XW8mmEIMXOnR1uCTnYLL+Dm9Z+LO50xZukOISNy6zFxpI8ts/OGLsm+I2x9+UprUU4/EVdmxuwegFE6NBoEhHoRNYY0gbXZkaU8YY/XwzjVY/k18DDhl5NYPEnF6uq4Oyidg+xtd3W4+iGYczuOLER1Tp5y614zOTphcvFYhvUkCijQ6HT1TtRq/34SlFoRQqo4SFiLriK451xWIcfwiMLIekWrdoQa1v8dqIlMA3r6CKc0QykJpSYbiyormWiZ0hl2HLpkZ85mD9V0eDQ5RCtb6vkybK7INcq4yKQV4YkXhr9NpX9U4re4dlFQjEJQIDAQAB", "permissions": ["management", "https://clients2.google.com/service/*", "storage", "alarms", "contextMenus", "downloads"], "optional_permissions": ["https://*/", "http://*/"], "browser_action": {"default_icon": {"16": "assets/icon/icon_16.png", "24": "assets/icon/icon_24.png"}, "default_title": "Chromium Web Store", "default_popup": "popup.html"}, "content_scripts": [{"matches": ["https://chrome.google.com/webstore/*", "https://addons.opera.com/*extensions/details/*", "https://microsoftedge.microsoft.com/addons/*"], "js": ["scripts/inject.js"], "run_at": "document_end"}], "background": {"scripts": ["scripts/util.js", "scripts/background.js"], "persistent": false}, "update_url": "https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates_en_nolocale.xml", "icons": {"16": "assets/icon/icon_16.png", "24": "assets/icon/icon_24.png", "32": "assets/icon/icon_32.png", "48": "assets/icon/icon_48.png", "64": "assets/icon/icon_64.png", "128": "assets/icon/icon_128.png"}, "homepage_url": "https://github.com/NeverDecaf/chromium-web-store", "options_ui": {"page": "options.html", "chrome_style": true}, "storage": {"managed_schema": "managed_storage.json"}}
2 changes: 1 addition & 1 deletion en_nolocale/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function handleContextClick(info, tab) {
chrome.tabs.sendMessage(tab.id, {
action: "install"
});
else if (info.menuItemId == 'cws')
else if (info.menuItemId == 'cws')
chrome.tabs.create({
url: 'https://chrome.google.com/webstore/'
});
Expand Down
151 changes: 77 additions & 74 deletions en_nolocale/scripts/inject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const is_cws = /chrome.google.com\/webstore\//i
const is_cws = /chrome.google.com\/webstore/i
const is_ows = /addons.opera.com\/.*extensions/i
const is_ews = /microsoftedge\.microsoft\.com\/addons\/detail\//i
const is_ews = /microsoftedge\.microsoft\.com\/addons\//i
const is_ews_addon_page = /microsoftedge\.microsoft\.com\/addons\/detail\//i
const cws_re = /.*detail\/[^\/]*\/([a-z]{32})/i
const ows_re = /.*details\/([^\/?#]+)/i
const ews_re = /.*addons\/.+?\/([a-z]{32})/i
Expand All @@ -12,16 +13,16 @@ function getExtensionId(url) {
}

function buildExtensionUrl(extensionId) {
if (is_cws.test(window.location.href)) {
var chromeVersion = /Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1];
return 'https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=' + chromeVersion + '&x=id%3D' + extensionId + '%26installsource%3Dondemand%26uc';
}
if (is_ows.test(window.location.href)) {
return 'https://addons.opera.com/extensions/download/' + extensionId + '/'
}
if (is_ews.test(window.location.href)) {
return 'https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&x=id%3D' + extensionId + '%26installsource%3Dondemand%26uc'
}
if (is_cws.test(window.location.href)) {
var chromeVersion = /Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1];
return 'https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=' + chromeVersion + '&x=id%3D' + extensionId + '%26installsource%3Dondemand%26uc';
}
if (is_ows.test(window.location.href)) {
return 'https://addons.opera.com/extensions/download/' + extensionId + '/'
}
if (is_ews.test(window.location.href)) {
return 'https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&x=id%3D' + extensionId + '%26installsource%3Dondemand%26uc'
}
}

function createButton(newParent) {
Expand Down Expand Up @@ -53,7 +54,7 @@ function createButton(newParent) {
});
newParent.innerHTML = "";
newParent.appendChild(button_div);
dlBtn = button_div
dlBtn = button_div
}
var modifyButtonObserver = new MutationObserver(function (mutations, observer) {
mutations.forEach(function (mutation) {
Expand All @@ -75,77 +76,79 @@ attachMainObserver = new MutationObserver(function (mutations, observer) {
observer.disconnect();
});
if (is_ews.test(window.location.href)) {
new MutationObserver(function (mutations, observer) {
new MutationObserver(function (mutations, observer) {
mutations.forEach(function (mutation) {
let btn = mutation.target.querySelector('button[disabled]')
if (btn) {
btn.classList.remove(btn.className.split(' ').sort().reverse()[0])
btn.removeAttribute('disabled')
btn.addEventListener('click',() => {
// normal methods fail because microsoft's official web store redirects you from HTTPS to an insecure HTTP url.
// instead use chrome.tabs to open the url in a new tab.
chrome.runtime.sendMessage({
newTabUrl: buildExtensionUrl(getExtensionId(window.location.href))
});
})
observer.disconnect();
}
if (is_ews_addon_page.test(window.location.href)) {
let btn = mutation.target.querySelector('button[disabled]')
if (btn) {
btn.classList.remove(btn.className.split(' ').sort().reverse()[0])
btn.removeAttribute('disabled')
btn.addEventListener('click',() => {
// normal methods fail because microsoft's official web store redirects you from HTTPS to an insecure HTTP url.
// instead use chrome.tabs to open the url in a new tab.
chrome.runtime.sendMessage({
newTabUrl: buildExtensionUrl(getExtensionId(window.location.href))
});
})
}
}
});
}).observe(document.body, {
childList: true,
subtree: true
});
}).observe(document.body, {
childList: true
});
}
if (is_cws.test(window.location.href)) {
attachMainObserver.observe(document.body, {
childList: true
});
attachMainObserver.observe(document.body, {
childList: true
});
}
if (is_ows.test(window.location.href)) {
let installDiv = document.body.querySelector('.sidebar .get-opera')
let sidebar = installDiv.parentElement
let wrapper = document.createElement('div')
wrapper.classList.add('wrapper-install')
dlBtn = document.createElement('a')
dlBtn.classList.add('btn-install')
dlBtn.classList.add('btn-with-plus')
dlBtn.innerHTML = "Add to Chromium"
sidebar.replaceChild(wrapper, installDiv)
wrapper.appendChild(dlBtn)
let url = buildExtensionUrl(getExtensionId(window.location.href))
function fetchExt() {
let filename = 'ext.crx'
fetch(url)
.then( r => {
r.headers.forEach(h => {
let v = /filename=([^ ]+)/.exec(h)
if (v) {
filename = v[1]
return
}
})
return r.blob()
})
.then( blob => {
// set mime type to prevent automatic install; reference: https://stackoverflow.com/questions/57834691/how-to-serve-crx-file-in-a-way-that-is-not-automatically-installed
blob = blob.slice(0, blob.size, "application/zip")
const blobURL = window.URL.createObjectURL(blob);
dlBtn.href = blobURL;
dlBtn.download = filename
dlBtn.click()
})
}
dlBtn.addEventListener('click', fetchExt, {once:true})
let installDiv = document.body.querySelector('.sidebar .get-opera')
let sidebar = installDiv.parentElement
let wrapper = document.createElement('div')
wrapper.classList.add('wrapper-install')
dlBtn = document.createElement('a')
dlBtn.classList.add('btn-install')
dlBtn.classList.add('btn-with-plus')
dlBtn.innerHTML = "Add to Chromium"
sidebar.replaceChild(wrapper, installDiv)
wrapper.appendChild(dlBtn)
let url = buildExtensionUrl(getExtensionId(window.location.href))
function fetchExt() {
let filename = 'ext.crx'
fetch(url)
.then( r => {
r.headers.forEach(h => {
let v = /filename=([^ ]+)/.exec(h)
if (v) {
filename = v[1]
return
}
})
return r.blob()
})
.then( blob => {
// set mime type to prevent automatic install; reference: https://stackoverflow.com/questions/57834691/how-to-serve-crx-file-in-a-way-that-is-not-automatically-installed
blob = blob.slice(0, blob.size, "application/zip")
const blobURL = window.URL.createObjectURL(blob);
dlBtn.href = blobURL;
dlBtn.download = filename
dlBtn.click()
})
}
dlBtn.addEventListener('click', fetchExt, {once:true})
}
window.onload = () => {
chrome.runtime.onMessage.addListener(request => {
if (request.action === "install") {
console.log('opening extension URL:',buildExtensionUrl(getExtensionId(window.location.href)))
if (is_ows.test(window.location.href)) {
dlBtn.click()
}
else if (is_cws.test(window.location.href) || is_ews.test(window.location.href)) {
window.open(buildExtensionUrl(getExtensionId(window.location.href)));
}
console.log('opening extension URL:',buildExtensionUrl(getExtensionId(window.location.href)))
if (is_ows.test(window.location.href)) {
dlBtn.click()
}
else if (is_cws.test(window.location.href) || is_ews.test(window.location.href)) {
window.open(buildExtensionUrl(getExtensionId(window.location.href)));
}
}
});
};
28 changes: 14 additions & 14 deletions en_nolocale/scripts/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function load_options() {
input = document.createElement('input');
input.setAttribute('type', 'checkbox');
input.setAttribute('id', ex.id);
if (Array.from(store_extensions.keys()).some(x => x.test(ex.updateUrl) && store_extensions.get(x).ignore)) {
input.checked = true
input.disabled = true
}
if (Array.from(store_extensions.keys()).some(x => x.test(ex.updateUrl) && store_extensions.get(x).ignore)) {
input.checked = true
input.disabled = true
}
img.setAttribute('alt', ex.name);
if (ex.icons)
img.setAttribute('src', 'chrome://extension-icon/' + ex.id + '/' + ex.icons[0].size + '/0');
Expand All @@ -36,14 +36,14 @@ function load_options() {
default_options[ex.id] = false;
});
document.getElementById('import_export_list').value = e.map(ex => {
for (const [re, updaterOptions] of store_extensions) {
if (re.test(ex.updateUrl)) {
if (!updaterOptions.ignore)
return ex.name+'|'+ex.id
else
return ex.name
}
}
for (const [re, updaterOptions] of store_extensions) {
if (re.test(ex.updateUrl)) {
if (!updaterOptions.ignore)
return ex.name+'|'+ex.id
else
return ex.name
}
}
return ex.name+'|'+ex.id+'|'+ex.updateUrl
}).join('\r\n');
document.getElementById('import_all_button').onclick = () => {
Expand Down Expand Up @@ -71,8 +71,8 @@ function load_options() {
for (const [setting, value] of Object.entries(items)) {
let node = document.getElementById(setting);
if (node.type == 'checkbox') {
if (!node.checked)
node.checked = value;
if (!node.checked)
node.checked = value;
node.addEventListener("change", e => {
const checked = e.target.checked;
chrome.storage.sync.set({
Expand Down
Loading

0 comments on commit 6698b75

Please sign in to comment.