Skip to content

Commit

Permalink
fix ublock origin extension by using chromium zip instead of firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauve Signweaver committed May 18, 2023
1 parent c5002ea commit 4bf5aa2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/extensions/builtins.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"ublock": {
"version": "1.47.4",
"comment": "The chrome one has a weird subfolder so we're loading the raw firefox version instead",
"url": "https://github.com/gorhill/uBlock/releases/download/{version}/uBlock0_{version}.firefox.signed.xpi"
"url": "https://github.com/gorhill/uBlock/releases/download/{version}/uBlock0_{version}.chromium.zip",
"stripPrefix": "uBlock0.chromium/"
}
}
11 changes: 10 additions & 1 deletion app/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,16 @@ export class Extensions extends EventEmitter {
if (!isNew) return false
const zipLocation = path.join(this.builtinsLocation, `${name}.zip`)
const extensionLocation = path.join(this.storageLocation, name)
await decompress(zipLocation, extensionLocation)
const decompressOptions = {}
if (info.stripPrefix) {
decompressOptions.map = (file) => {
if (file.path.startsWith(info.stripPrefix)) {
file.path = file.path.slice(info.stripPrefix.length)
}
return file
}
}
await decompress(zipLocation, extensionLocation, decompressOptions)
return true
}

Expand Down
2 changes: 1 addition & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async function onready () {
])
// Call this again for Linux because we modified the context menu
appIcon.setContextMenu(contextMenu)
appIcon.on('click',() => {
appIcon.on('click', () => {
createWindow()
})

Expand Down

0 comments on commit 4bf5aa2

Please sign in to comment.