update prompt version and lint

This commit is contained in:
Araxeus
2021-05-05 02:53:05 +03:00
parent 98c00f7a60
commit 5cee331abe
4 changed files with 35 additions and 34 deletions

View File

@ -335,10 +335,10 @@ function setProxy(item, win) {
}); });
} }
prompt(options, win) prompt(options, win)
.then(input => { .then(output => {
if (input !== null && input !== example) { if (output !== null && output !== example) {
config.set("options.proxy", input); config.set("options.proxy", output);
item.checked = input !== ""; item.checked = output !== "";
} else { //user pressed cancel } else { //user pressed cancel
item.checked = !item.checked; //reset checkbox item.checked = !item.checked; //reset checkbox
} }

View File

@ -68,7 +68,7 @@
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.9.0", "YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.9.0",
"async-mutex": "^0.3.1", "async-mutex": "^0.3.1",
"browser-id3-writer": "^4.4.0", "browser-id3-writer": "^4.4.0",
"custom-electron-prompt": "^1.0.4", "custom-electron-prompt": "^1.0.5",
"custom-electron-titlebar": "^3.2.6", "custom-electron-titlebar": "^3.2.6",
"discord-rpc": "^3.2.0", "discord-rpc": "^3.2.0",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",

View File

@ -37,25 +37,6 @@ const customTitlebarPath = path.join(app.getAppPath(), "plugins", "in-app-menu",
// Helper function for globalShortcuts prompt // Helper function for globalShortcuts prompt
const kb = (label_, value_, default_) => { return { value: value_, label: label_, default: default_ || undefined }; }; const kb = (label_, value_, default_) => { return { value: value_, label: label_, default: default_ || undefined }; };
function setupPromptOptions(options) {
// TODO Custom titlebar needs testing on macOS
if (is.macOS()) {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath
});
} else {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath,
// The following are used for custom titlebar
frame: false,
customScript: customTitlebarPath,
enableRemoteModule: true
});
}
}
function promptVolumeSteps(win, options) { function promptVolumeSteps(win, options) {
const promptOptions = { const promptOptions = {
title: "Volume Steps", title: "Volume Steps",
@ -67,12 +48,13 @@ function promptVolumeSteps(win, options) {
setupPromptOptions(promptOptions); setupPromptOptions(promptOptions);
prompt(promptOptions, win).then(input => { prompt(promptOptions, win)
if (input || input === 0) { // 0 is somehow valid .then(output => {
options.steps = input; if (output || output === 0) { // 0 is somehow valid
setOptions("precise-volume", options); options.steps = output;
} setOptions("precise-volume", options);
}).catch(console.error); }
}).catch(console.error);
} }
function promptGlobalShortcuts(win, options, item) { function promptGlobalShortcuts(win, options, item) {
@ -106,3 +88,22 @@ function promptGlobalShortcuts(win, options, item) {
}) })
.catch(console.error); .catch(console.error);
} }
function setupPromptOptions(options) {
// TODO Custom titlebar needs testing on macOS
if (is.macOS()) {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath
});
} else {
Object.assign(options, {
customStylesheet: "dark",
icon: iconPath,
// The following are used for custom titlebar
frame: false,
customScript: customTitlebarPath,
enableRemoteModule: true
});
}
}

View File

@ -2849,10 +2849,10 @@ cssstyle@^2.2.0:
dependencies: dependencies:
cssom "~0.3.6" cssom "~0.3.6"
custom-electron-prompt@^1.0.4: custom-electron-prompt@^1.0.5:
version "1.0.4" version "1.0.5"
resolved "https://registry.yarnpkg.com/custom-electron-prompt/-/custom-electron-prompt-1.0.4.tgz#b729cb10687b8fa9029e82d68652fd94e59b1918" resolved "https://registry.yarnpkg.com/custom-electron-prompt/-/custom-electron-prompt-1.0.5.tgz#2b72ac108f3038bab3757345f8faee3cd91b1f43"
integrity sha512-Yj73jce2Sx7+ngnqGvth0aBuD6vx/QLrkziLJ5Iznh+n3qRrWnO1Qz+dJCdThCvobO5VUAbTXbHebtLuKj+7qw== integrity sha512-BEAlGVf7obLmAwSO/rgnWvLQxtYaPEXSu79XySx0qRuR7WEYdQgJdBpycQF+3ivjv8oRe5f4pjxaxu657fs+mg==
custom-electron-titlebar@^3.2.6: custom-electron-titlebar@^3.2.6:
version "3.2.6" version "3.2.6"