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)
.then(input => {
if (input !== null && input !== example) {
config.set("options.proxy", input);
item.checked = input !== "";
.then(output => {
if (output !== null && output !== example) {
config.set("options.proxy", output);
item.checked = output !== "";
} else { //user pressed cancel
item.checked = !item.checked; //reset checkbox
}

View File

@ -68,7 +68,7 @@
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.9.0",
"async-mutex": "^0.3.1",
"browser-id3-writer": "^4.4.0",
"custom-electron-prompt": "^1.0.4",
"custom-electron-prompt": "^1.0.5",
"custom-electron-titlebar": "^3.2.6",
"discord-rpc": "^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
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) {
const promptOptions = {
title: "Volume Steps",
@ -67,12 +48,13 @@ function promptVolumeSteps(win, options) {
setupPromptOptions(promptOptions);
prompt(promptOptions, win).then(input => {
if (input || input === 0) { // 0 is somehow valid
options.steps = input;
setOptions("precise-volume", options);
}
}).catch(console.error);
prompt(promptOptions, win)
.then(output => {
if (output || output === 0) { // 0 is somehow valid
options.steps = output;
setOptions("precise-volume", options);
}
}).catch(console.error);
}
function promptGlobalShortcuts(win, options, item) {
@ -106,3 +88,22 @@ function promptGlobalShortcuts(win, options, item) {
})
.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:
cssom "~0.3.6"
custom-electron-prompt@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/custom-electron-prompt/-/custom-electron-prompt-1.0.4.tgz#b729cb10687b8fa9029e82d68652fd94e59b1918"
integrity sha512-Yj73jce2Sx7+ngnqGvth0aBuD6vx/QLrkziLJ5Iznh+n3qRrWnO1Qz+dJCdThCvobO5VUAbTXbHebtLuKj+7qw==
custom-electron-prompt@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/custom-electron-prompt/-/custom-electron-prompt-1.0.5.tgz#2b72ac108f3038bab3757345f8faee3cd91b1f43"
integrity sha512-BEAlGVf7obLmAwSO/rgnWvLQxtYaPEXSu79XySx0qRuR7WEYdQgJdBpycQF+3ivjv8oRe5f4pjxaxu657fs+mg==
custom-electron-titlebar@^3.2.6:
version "3.2.6"