diff --git a/package-lock.json b/package-lock.json index 207c5ed2a..bae632013 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,12 +27,9 @@ "multiaddr": "10.0.1", "multiaddr-to-uri": "8.0.0", "portfinder": "^1.0.28", - "sudo-prompt": "^9.2.1", "untildify": "^4.0.0", "v8-compile-cache": "^2.3.0", - "which": "^2.0.2", - "winston": "^3.7.2", - "yargs": "^17.4.0" + "winston": "^3.7.2" }, "devDependencies": { "@playwright/test": "^1.20.2", @@ -2425,6 +2422,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -2439,6 +2437,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -2449,7 +2448,8 @@ "node_modules/ansi-styles/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/any-signal": { "version": "2.1.2", @@ -3431,6 +3431,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -3441,6 +3442,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -3449,6 +3451,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, @@ -4372,7 +4375,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/enabled": { "version": "2.0.0", @@ -4497,6 +4501,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -5672,6 +5677,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -7339,6 +7345,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -10794,6 +10801,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -11576,6 +11584,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -11589,6 +11598,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -11597,6 +11607,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -11722,11 +11733,6 @@ "node": ">=0.10.0" } }, - "node_modules/sudo-prompt": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/sudo-prompt/-/sudo-prompt-9.2.1.tgz", - "integrity": "sha512-Mu7R0g4ig9TUuGSxJavny5Rv0egCEtpZRNMrZaYS1vxkiIxGiGUwoezU3LazIQ+KE04hTrTfNPgxU5gzi7F5Pw==" - }, "node_modules/sumchecker": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", @@ -12780,6 +12786,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -12796,6 +12803,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -12804,6 +12812,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, @@ -12925,6 +12934,7 @@ "version": "17.4.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.0.tgz", "integrity": "sha512-WJudfrk81yWFSOkZYpAZx4Nt7V4xp7S/uJkX0CnxovMCt1wCE8LNftPpNuF9X/u9gN5nsD7ycYtRcDf2pL3UiA==", + "dev": true, "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -12942,6 +12952,7 @@ "version": "21.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz", "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==", + "dev": true, "engines": { "node": ">=12" } @@ -12950,6 +12961,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, "engines": { "node": ">=10" } @@ -14879,6 +14891,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" }, @@ -14887,6 +14900,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -14894,7 +14908,8 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true } } }, @@ -15649,6 +15664,7 @@ "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -15658,12 +15674,14 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -16415,7 +16433,8 @@ "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "enabled": { "version": "2.0.0", @@ -16518,7 +16537,8 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true }, "escape-goat": { "version": "2.1.1", @@ -17406,7 +17426,8 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true }, "get-intrinsic": { "version": "1.1.1", @@ -18663,7 +18684,8 @@ "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true }, "is-generator-function": { "version": "1.0.10", @@ -21320,7 +21342,8 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true }, "require-from-string": { "version": "2.0.2", @@ -21914,6 +21937,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -21923,12 +21947,14 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "requires": { "ansi-regex": "^5.0.1" } @@ -22020,11 +22046,6 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, - "sudo-prompt": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/sudo-prompt/-/sudo-prompt-9.2.1.tgz", - "integrity": "sha512-Mu7R0g4ig9TUuGSxJavny5Rv0egCEtpZRNMrZaYS1vxkiIxGiGUwoezU3LazIQ+KE04hTrTfNPgxU5gzi7F5Pw==" - }, "sumchecker": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", @@ -22874,6 +22895,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -22883,12 +22905,14 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -22982,6 +23006,7 @@ "version": "17.4.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.0.tgz", "integrity": "sha512-WJudfrk81yWFSOkZYpAZx4Nt7V4xp7S/uJkX0CnxovMCt1wCE8LNftPpNuF9X/u9gN5nsD7ycYtRcDf2pL3UiA==", + "dev": true, "requires": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -22995,14 +23020,16 @@ "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true } } }, "yargs-parser": { "version": "21.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==" + "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==", + "dev": true }, "yauzl": { "version": "2.10.0", diff --git a/package.json b/package.json index 0c02e79a2..7c76dd1a9 100644 --- a/package.json +++ b/package.json @@ -88,12 +88,9 @@ "multiaddr": "10.0.1", "multiaddr-to-uri": "8.0.0", "portfinder": "^1.0.28", - "sudo-prompt": "^9.2.1", "untildify": "^4.0.0", "v8-compile-cache": "^2.3.0", - "which": "^2.0.2", - "winston": "^3.7.2", - "yargs": "^17.4.0" + "winston": "^3.7.2" }, "standard": { "ignore": [ diff --git a/src/index.js b/src/index.js index e60fa1c1a..6bf778818 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,6 @@ const { criticalErrorDialog } = require('./dialogs') const logger = require('./common/logger') const setupProtocolHandlers = require('./protocol-handlers') const setupI18n = require('./i18n') -const setupNpmOnIpfs = require('./npm-on-ipfs') const setupDaemon = require('./daemon') const setupWebUI = require('./webui') const setupAutoLaunch = require('./auto-launch') @@ -29,7 +28,6 @@ const setupAppMenu = require('./app-menu') const setupArgvFilesHandler = require('./argv-files-handler') const setupAutoUpdater = require('./auto-updater') const setupTray = require('./tray') -const setupIpfsOnPath = require('./ipfs-on-path') const setupAnalytics = require('./analytics') const setupSecondInstance = require('./second-instance') @@ -93,10 +91,7 @@ async function run () { setupNamesysPubsub(ctx), setupSecondInstance(ctx), // Setup global shortcuts - setupTakeScreenshot(ctx), - // Setup PATH-related features - setupNpmOnIpfs(ctx), - setupIpfsOnPath(ctx) + setupTakeScreenshot(ctx) ]) const submitAppReady = () => { logger.addAnalyticsEvent({ withAnalytics: 'APP_READY', dur: getSecondsSinceAppStart() }) diff --git a/src/ipfs-on-path/index.js b/src/ipfs-on-path/index.js deleted file mode 100644 index 401cfe1fa..000000000 --- a/src/ipfs-on-path/index.js +++ /dev/null @@ -1,79 +0,0 @@ -const { join } = require('path') -const i18n = require('i18next') -const { app, shell } = require('electron') -const { execFile } = require('child_process') -const execOrSudo = require('../utils/exec-or-sudo') -const logger = require('../common/logger') -const store = require('../common/store') -const { IS_WIN } = require('../common/consts') -const { showDialog } = require('../dialogs') -const { unlinkSync } = require('fs') - -const CONFIG_KEY = 'ipfsOnPath' - -// Deprecated in February 2021 https://github.com/ipfs/ipfs-desktop/pull/1768 -// Once this bit of code is removed, also remove ../utils/exec-or-sudo. -module.exports = async function () { - if (store.get(CONFIG_KEY, null) === true) { - try { - await uninstall('uninstall') - } catch (err) { - // Weird, but not worth bothering. - logger.error(`[ipfs on path] ${err.toString()}`) - } - - try { - unlinkSync(join(app.getPath('home'), './.ipfs-desktop/IPFS_PATH').replace('app.asar', 'app.asar.unpacked')) - unlinkSync(join(app.getPath('home'), './.ipfs-desktop/IPFS_EXEC').replace('app.asar', 'app.asar.unpacked')) - } catch (err) { - // Weird, but not worth bothering. - logger.error(`[ipfs on path] ${err.toString()}`) - } - - logger.info('[ipfs on path] uninstalled') - - const opt = showDialog({ - title: 'Command Line Tools Uninstalled', - message: 'Command Line Tools via IPFS Desktop have been deprecated in February 2021. They have now been uninstalled. Please refer to https://docs.ipfs.io/install/command-line/ if you need to use ipfs from the command line.', - buttons: [ - i18n.t('openCliDocumentation'), - i18n.t('close') - ] - }) - - if (opt === 0) { - shell.openExternal('https://docs.ipfs.io/install/command-line/') - } - } - - store.delete(CONFIG_KEY) -} - -async function uninstallWindows () { - return new Promise((resolve, reject) => { - execFile('powershell.exe', [ - '-nop', '-exec', 'bypass', - '-win', 'hidden', '-File', - join(__dirname, 'scripts/uninstall.ps1').replace('app.asar', 'app.asar.unpacked') - ], {}, err => { - if (err) { - return reject(err) - } - - resolve() - }) - }) -} - -async function uninstall () { - if (IS_WIN) { - return uninstallWindows() - } - - return execOrSudo({ - script: join(__dirname, './scripts/uninstall.js'), - scope: 'ipfs on path', - trySudo: true, - failSilently: true - }) -} diff --git a/src/ipfs-on-path/scripts/uninstall.js b/src/ipfs-on-path/scripts/uninstall.js deleted file mode 100644 index ff15773f6..000000000 --- a/src/ipfs-on-path/scripts/uninstall.js +++ /dev/null @@ -1,15 +0,0 @@ -const { argv } = require('yargs') -const fs = require('fs-extra') -const { join } = require('path') - -function revert (userData, bin, dst) { - const backup = join(userData, bin + '.bak') - - try { - fs.unlinkSync(backup) - } catch (_) { - // Failed to remove the backup. Suprising, but not worth bothering the user about. - } -} - -revert(argv.data, 'ipfs', '/usr/local/bin/ipfs') diff --git a/src/ipfs-on-path/scripts/uninstall.ps1 b/src/ipfs-on-path/scripts/uninstall.ps1 deleted file mode 100644 index 5904cd497..000000000 --- a/src/ipfs-on-path/scripts/uninstall.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -$path = [System.Environment]::GetEnvironmentVariable('PATH', 'User') -$path = ($path.Split(';') | Where-Object { $_ -ne "$PSScriptRoot\bin-win" }) -join ';' -[Environment]::SetEnvironmentVariable('PATH', $path, 'User') diff --git a/src/npm-on-ipfs/index.js b/src/npm-on-ipfs/index.js deleted file mode 100644 index b154e2a07..000000000 --- a/src/npm-on-ipfs/index.js +++ /dev/null @@ -1,48 +0,0 @@ -const which = require('which') -const util = require('util') -const i18n = require('i18next') -const logger = require('../common/logger') -const store = require('../common/store') -const { showDialog } = require('../dialogs') -const { IS_WIN } = require('../common/consts') -const childProcess = require('child_process') - -const execFile = util.promisify(childProcess.execFile) -const npmBin = IS_WIN ? 'npm.cmd' : 'npm' - -const CONFIG_KEY = 'experiments.npmOnIpfs' - -// Deprecated in February 2021. Remove soon. -module.exports = function (ctx) { - if (store.get(CONFIG_KEY, null) === true) { - logger.info('[npm on ipfs] deprecated, removing') - store.delete(CONFIG_KEY) - uninstall() - - showDialog({ - title: 'NPM on IPFS Uninstalled', - message: 'NPM on IPFS via IPFS Desktop has been deprecated since February 2021. It was now fully removed. As an alternative, you can use https://github.com/foragepm/forage.', - buttons: [i18n.t('close')] - }) - } -} - -module.exports.CONFIG_KEY = CONFIG_KEY - -function isPkgInstalled () { - return !!which.sync('ipfs-npm', { nothrow: true }) -} - -async function uninstall () { - if (isPkgInstalled() === false) { - return - } - - try { - await execFile(npmBin, ['uninstall', '-g', 'ipfs-npm']) - logger.info('[npm on ipfs] ipfs-npm: uninstalled globally') - return true - } catch (err) { - logger.error(`[npm on ipfs] ipfs-npm failed to uninstall: ${err.toString()}`, err) - } -} diff --git a/src/utils/exec-or-sudo.js b/src/utils/exec-or-sudo.js deleted file mode 100644 index 415c02f4f..000000000 --- a/src/utils/exec-or-sudo.js +++ /dev/null @@ -1,77 +0,0 @@ -const i18n = require('i18next') -const util = require('util') -const sudo = require('sudo-prompt') -const { dialog, app } = require('electron') -const childProcess = require('child_process') -const { recoverableErrorDialog } = require('../dialogs') -const logger = require('../common/logger') - -const execFile = util.promisify(childProcess.execFile) - -const env = { - noSudo: { - ELECTRON_RUN_AS_NODE: 1 - }, - sudo: 'env ELECTRON_RUN_AS_NODE=1' -} - -const getResult = (err, stdout, stderr, scope, failSilently, errorOptions) => { - if (stdout) { - logger.info(`[${scope}] sudo: stdout: ${stdout.toString().trim()}`) - } - - if (stderr) { - logger.info(`[${scope}] sudo: stderr: ${stderr.toString().trim()}`) - } - - if (!err) { - return true - } - - const str = err.toString() - logger.error(`[${scope}] error: ${str}`) - - if (process.env.NODE_ENV !== 'test' && !failSilently) { - if (str.includes('No polkit authentication agent found')) { - dialog.showErrorBox(i18n.t('polkitDialog.title'), i18n.t('polkitDialog.message')) - } else if (str.includes('User did not grant permission')) { - dialog.showErrorBox(i18n.t('noPermissionDialog.title'), i18n.t('noPermissionDialog.message')) - } else { - recoverableErrorDialog(err, errorOptions) - } - } - - return false -} - -module.exports = async function ({ script, scope, failSilently, trySudo = true, errorOptions }) { - const dataArg = `--data="${app.getPath('userData')}"` - let err = null - - // First try executing with regular permissions. - try { - const { stdout } = await execFile(process.execPath, [script, dataArg], { env: env.noSudo }) - logger.info(`[${scope}] stdout: ${stdout.toString().trim()}`) - return true - } catch ({ stderr }) { - const msg = stderr.toString().trim() - err = new Error(msg) - logger.info(`[${scope}] no-sudo: stderr: ${msg}`) - } - - if (!trySudo) { - if (!failSilently) { - recoverableErrorDialog(err, errorOptions) - } - - return false - } - - // Otherwise, try to elevate the user. - const command = `${env.sudo} "${process.execPath}" "${script}" ${dataArg}` - return new Promise(resolve => { - sudo.exec(command, { name: 'IPFS Desktop' }, (err, stdout, stderr) => { - resolve(getResult(err, stdout, stderr, scope, failSilently, errorOptions)) - }) - }) -}