From bde0ca039a964bb7d81eb9409bf1ae02e733999e Mon Sep 17 00:00:00 2001 From: Andrey Onishchenko Date: Mon, 5 Aug 2024 00:04:05 +0300 Subject: [PATCH] Dev tools support. Closes #86 --- README.md | 6 ++++++ patches/0004-Dev-Tools-from-config.patch | 14 ++++++++++++++ templates/default.conf | 3 ++- templates/yandex-music.sh | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 patches/0004-Dev-Tools-from-config.patch diff --git a/README.md b/README.md index 7365d8d..8c18fd0 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,12 @@ Tray mode is disabled by default. It allows program to be minimized to tray inst *** +### Dev tools + +Chromium developer/debug tools can be enabled by setting `DEV_TOOLS` option to `1`. + +*** + ## Manual Build ### Prerequisites diff --git a/patches/0004-Dev-Tools-from-config.patch b/patches/0004-Dev-Tools-from-config.patch new file mode 100644 index 0000000..300d14e --- /dev/null +++ b/patches/0004-Dev-Tools-from-config.patch @@ -0,0 +1,14 @@ +diff --git a/main/config.js b/main/config.js +--- a/main/config.js ++++ b/main/config.js +@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.applyCommonConfig = exports.config = void 0; + const package_json_1 = __importDefault(require("../package.json")); ++const devTools = process.env.DEV_TOOLS && process.env.DEV_TOOLS > 0; + exports.config = { +- enableDevTools: false, ++ enableDevTools: devTools, + enableWebSecurity: true, + enableAutoUpdate: true, + bypassCSP: false, diff --git a/templates/default.conf b/templates/default.conf index 012180e..b875b3a 100644 --- a/templates/default.conf +++ b/templates/default.conf @@ -1,3 +1,4 @@ ELECTRON_CUSTOM_BIN= ELECTRON_ARGS="--no-sandbox" -TRAY_ENABLED=0 \ No newline at end of file +TRAY_ENABLED=0 +DEV_TOOLS=0 \ No newline at end of file diff --git a/templates/yandex-music.sh b/templates/yandex-music.sh index 321263c..83f2b14 100644 --- a/templates/yandex-music.sh +++ b/templates/yandex-music.sh @@ -23,5 +23,6 @@ fi ELECTRON_BIN=${ELECTRON_CUSTOM_BIN:-%electron_path%} export TRAY_ENABLED=${TRAY_ENABLED:-0} +export DEV_TOOLS=${DEV_TOOLS:-0} exec "${ELECTRON_BIN}" "%asar_path%" $ELECTRON_ARGS $WAYLAND_FLAGS