A full-featured download manager.
fix: github action mac build notarize
Dr_rOotc20d9b65eede
diff --git a/.eslintrc.js b/.eslintrc.jsindex 1dfa6e0d..9b6fe08d 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -16,7 +16,7 @@ module.exports = {__static: true},rules: {- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',+ 'no-console': 'off','no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off','indent': ['error', 2],'vue/script-indent': ['error', 2, {diff --git a/build/afterPackHook.js b/build/afterPackHook.jsnew file mode 100644index 00000000..f04f45fd--- /dev/null+++ b/build/afterPackHook.js@@ -0,0 +1,95 @@+// Forked from https://github.com/samuelmeuli/mini-diary/blob/master/scripts/after-pack.js++/**+ * Source: https://github.com/patrikx3/redis-ui/blob/master/src/build/after-pack.js+ *+ * Copyright (c) 2019 Patrik Laszlo / P3X / Corifeus and contributors.+ *+ * MIT License+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to deal+ * in the Software without restriction, including without limitation the rights+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ * copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in all+ * copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ * SOFTWARE.+ */++// TODO: Remove script once https://github.com/electron/electron/issues/17972 is solved by+// `electron-builder`++const fs = require('fs')+const { spawn } = require('child_process')+const { chdir } = require('process')++const pkg = require('../package.json')+const binName = `${pkg.name}`.toLowerCase()++const exec = async function exec (cmd, args = []) {+ const child = spawn(cmd, args, { shell: true })+ redirectOutputFor(child)+ await waitFor(child)+}++const redirectOutputFor = child => {+ const printStdout = data => {+ process.stdout.write(data.toString())+ }+ const printStderr = data => {+ process.stderr.write(data.toString())+ }+ child.stdout.on('data', printStdout)+ child.stderr.on('data', printStderr)++ child.once('close', () => {+ child.stdout.off('data', printStdout)+ child.stderr.off('data', printStderr)+ })+}++const waitFor = async function (child) {+ return new Promise(resolve => {+ child.once('close', () => resolve())+ })+}++const linuxTargets = [+ 'AppImage',+ 'deb',+ 'pacman',+ 'rpm',+ 'snap'+]++module.exports = async function (context) {+ console.warn('after build; disable sandbox')+ const isLinux = context.targets.find(+ target => linuxTargets.includes(target)+ )+ if (!isLinux) {+ return+ }+ const originalDir = process.cwd()+ const dirname = context.appOutDir+ chdir(dirname)++ await exec('mv', [binName, binName + '.bin'])+ const wrapperScript = `#!/bin/bash+ "\${BASH_SOURCE%/*}"/${binName}.bin "$@" --no-sandbox+ `+ fs.writeFileSync(binName, wrapperScript)+ await exec('chmod', ['+x', binName])++ chdir(originalDir)+}diff --git a/build/afterSignHook.js b/build/afterSignHook.jsindex 346e9328..725473dd 100644--- a/build/afterSignHook.js+++ b/build/afterSignHook.js@@ -8,7 +8,7 @@ exports.default = async function (context) {return}- const skipNotarize = process.env.SKIP_NOTARIZE;+ const skipNotarize = process.env.SKIP_NOTARIZEif (skipNotarize === 'yes') {console.log('skipping notarize')returndiff --git a/package-lock.json b/package-lock.jsonindex 233840c1..4798c219 100644--- a/package-lock.json+++ b/package-lock.json@@ -1175,6 +1175,12 @@"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz","integrity": "sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA=="},+ "@types/normalize-package-data": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz",+ "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==",+ "dev": true+ },"@types/q": {"version": "1.5.2","resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz",@@ -4745,6 +4751,126 @@}}},+ "electron-builder-notarize": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/electron-builder-notarize/-/electron-builder-notarize-1.1.2.tgz",+ "integrity": "sha512-IiuG+Wwky4EwekhJ9T5t9m00sFL9EGUrkyr4wqivXxrvtWIGAh2WCUwO6e47l3W8nE/4ng0v+VNJhZEIlCu1xg==",+ "dev": true,+ "requires": {+ "electron-notarize": "^0.2.0",+ "read-pkg-up": "^7.0.0"+ },+ "dependencies": {+ "debug": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",+ "dev": true,+ "requires": {+ "ms": "^2.1.1"+ }+ },+ "electron-notarize": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-0.2.1.tgz",+ "integrity": "sha512-oZ6/NhKeXmEKNROiFmRNfytqu3cxqC95sjooG7kBXQVEUSQkZnbiAhxVh5jXngL881G197pbwpeVPJyM7Ikmxw==",+ "dev": true,+ "requires": {+ "debug": "^4.1.1",+ "fs-extra": "^8.1.0"+ }+ },+ "find-up": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",+ "dev": true,+ "requires": {+ "locate-path": "^5.0.0",+ "path-exists": "^4.0.0"+ }+ },+ "locate-path": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",+ "dev": true,+ "requires": {+ "p-locate": "^4.1.0"+ }+ },+ "ms": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",+ "dev": true+ },+ "p-locate": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",+ "dev": true,+ "requires": {+ "p-limit": "^2.2.0"+ }+ },+ "parse-json": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",+ "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",+ "dev": true,+ "requires": {+ "@babel/code-frame": "^7.0.0",+ "error-ex": "^1.3.1",+ "json-parse-better-errors": "^1.0.1",+ "lines-and-columns": "^1.1.6"+ }+ },+ "path-exists": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",+ "dev": true+ },+ "read-pkg": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",+ "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",+ "dev": true,+ "requires": {+ "@types/normalize-package-data": "^2.4.0",+ "normalize-package-data": "^2.5.0",+ "parse-json": "^5.0.0",+ "type-fest": "^0.6.0"+ },+ "dependencies": {+ "type-fest": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",+ "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",+ "dev": true+ }+ }+ },+ "read-pkg-up": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz",+ "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==",+ "dev": true,+ "requires": {+ "find-up": "^4.1.0",+ "read-pkg": "^5.2.0",+ "type-fest": "^0.8.1"+ }+ },+ "type-fest": {+ "version": "0.8.1",+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",+ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",+ "dev": true+ }+ }+ },"electron-debug": {"version": "3.0.1","resolved": "https://registry.npmjs.org/electron-debug/-/electron-debug-3.0.1.tgz",@@ -9229,6 +9355,12 @@"immediate": "~3.0.5"}},+ "lines-and-columns": {+ "version": "1.1.6",+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",+ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",+ "dev": true+ },"load-json-file": {"version": "2.0.0","resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",diff --git a/package.json b/package.jsonindex 55c7e407..5d19c93e 100644--- a/package.json+++ b/package.json@@ -33,7 +33,8 @@"build": {"productName": "Motrix","appId": "net.agalwood.Motrix",- "afterSign": "./build/afterSignHook.js",+ "afterPack": "./build/afterPackHook.js",+ "afterSign": "electron-builder-notarize","fileAssociations": [{"ext": "torrent",@@ -96,6 +97,7 @@],"type": "distribution","darkModeSupport": true,+ "hardenedRuntime": true,"extraResources": {"from": "./extra/darwin/","to": "./",@@ -144,9 +146,11 @@"linux": {"category": "Network","target": [+ "AppImage","deb",- "snap",- "AppImage"+ "pacman",+ "rpm",+ "snap"],"extraResources": {"from": "./extra/linux/",@@ -214,6 +218,7 @@"devtron": "^1.4.0","electron": "^8.2.3","electron-builder": "^22.5.1",+ "electron-builder-notarize": "^1.1.2","electron-devtools-installer": "^3.0.0","electron-notarize": "^0.3.0","electron-osx-sign": "^0.4.15",