Skip to content

Commit

Permalink
make extensions work for released builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelmerro committed Mar 2, 2021
1 parent c3380e0 commit 52ada3d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/* eslint-disable no-console */
"use strict"

require("hazardous")
const {
app,
BrowserWindow,
Expand Down Expand Up @@ -944,13 +945,13 @@ const loadBlocklist = file => {

// Manage installed browser extensions
ipcMain.on("install-extension", (_, url, extension, extType) => {
fs.mkdirSync(path.join(datafolder, "extensions"), {"recursive": true})
const zipLoc = path.join(datafolder, `extensions/${extension}`)
const zipLoc = path.join(datafolder, "extensions", extension)
if (isDir(`${zipLoc}/`)) {
mainWindow.webContents.send("notify",
`Extension already installed: ${extension}`)
return
}
fs.mkdirSync(`${zipLoc}/`, {"recursive": true})
mainWindow.webContents.send("notify",
`Installing ${extType} extension: ${extension}`)
const request = net.request({url, "partition": "persist:main"})
Expand All @@ -967,7 +968,7 @@ ipcMain.on("install-extension", (_, url, extension, extType) => {
const file = Buffer.concat(data)
fs.writeFileSync(`${zipLoc}.${extType}`, file)
_7z.cmd([
"x", "-aoa", "-tzip", `${zipLoc}.${extType}`, `-o${zipLoc}`
"x", "-aoa", "-tzip", `${zipLoc}.${extType}`, `-o${zipLoc}/`
], () => {
rimraf(`${zipLoc}/_metadata/`)
sessionList.forEach(ses => {
Expand Down
3 changes: 3 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ files:
- "!ViebData"
- "!logo-wip-files"
- "!dist"
asarUnpack:
- "**/node_modules/7zip-bin/**/*"
- "**/node_modules/7zip-min/**/*"
fileAssociations:
- name: HyperText Markup File
ext: html
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"dependencies": {
"7zip-min": "^1.3.0",
"@cliqz/adblocker-electron": "^1.20.3",
"hazardous": "^0.3.0",
"is-svg": "^4.2.1",
"rimraf": "^3.0.2"
}
Expand Down

0 comments on commit 52ada3d

Please sign in to comment.