diff --git a/plugin/preload.js b/plugin/preload.js index 9c1d14b..cda48c2 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -212,22 +212,22 @@ if (process.platform !== 'linux') quickcommand.runInTerminal = function(cmdline, } let getCommandToLaunchTerminal = (cmdline, dir) => { - let cd = '' - if (utools.isWindows()) { - let appPath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/') - // 直接 existsSync wt.exe 无效 - if (fs.existsSync(appPath) && fs.readdirSync(appPath).includes('wt.exe')) { - cmdline = cmdline.replace(/"/g, `\\"`) - if (dir) cd = `-d "${dir.replace(/\\/g, '/')}"` - command = `${appPath}wt.exe ${cd} cmd /k "${cmdline}"` + let cd = '' + if (utools.isWindows()) { + let appPath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/') + // 直接 existsSync wt.exe 无效 + if (fs.existsSync(appPath) && fs.readdirSync(appPath).includes('wt.exe')) { + cmdline = cmdline.replace(/"/g, `\\"`) + if (dir) cd = `-d "${dir.replace(/\\/g, '/')}"` + command = `${appPath}wt.exe ${cd} cmd /k "${cmdline}"` + } else { + cmdline = cmdline.replace(/"/g, `^"`) + if (dir) cd = `cd /d "${dir.replace(/\\/g, '/')}" &&` + command = `${cd} start "" cmd /k "${cmdline}"` + } } else { - cmdline = cmdline.replace(/"/g, `^"`) - if (dir) cd = `cd /d "${dir.replace(/\\/g, '/')}" &&` - command = `${cd} start "" cmd /k "${cmdline}"` - } - } else { - cmdline = cmdline.replace(/"/g, `\\"`) - if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&` + cmdline = cmdline.replace(/"/g, `\\"`) + if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&` if (fs.existsSync('/Applications/iTerm.app')) { command = `osascript -e 'tell application "iTerm" create window with default profile @@ -476,12 +476,11 @@ let getSandboxFuns = () => { var sandbox = { fetch: fetch.bind(window), utools: getuToolsLite(), - quickcommand: _.cloneDeep(quickcommand), electron, axios, Audio, _, - // 兼容老版本 + // 兼容老版本 fs, path, os, @@ -503,17 +502,17 @@ let liteErr = e => { utools.isDev() && (window.godMode = code => eval(code)) // vm 模块将无法在渲染进程中使用,改用 ses 来执行代码 -window.evalCodeInSandbox = (code, userVars = {}) => { - let sandboxWithUV = Object.assign(userVars, getSandboxFuns()) +window.evalCodeInSandbox = (code, addVars = {}) => { + let sandboxWithAD = Object.assign(addVars, getSandboxFuns()) try { - return new Compartment(sandboxWithUV).evaluate(code); + return new Compartment(sandboxWithAD).evaluate(code); } catch (error) { throw liteErr(error) } } let isWatchingError = false -window.runCodeInSandbox = (code, callback, userVars = {}) => { +window.runCodeInSandbox = (code, callback, addVars = {}) => { let sandbox = getSandboxFuns() sandbox.console = { log: (...stdout) => { @@ -524,9 +523,9 @@ window.runCodeInSandbox = (code, callback, userVars = {}) => { callback(null, parseStdout(stderr)) } } - let sandboxWithUV = Object.assign(userVars, sandbox) + let sandboxWithAD = Object.assign(addVars, sandbox) try { - new Compartment(sandboxWithUV).evaluate(code) + new Compartment(sandboxWithAD).evaluate(code) } catch (e) { console.log('Error: ', e) callback(null, liteErr(e)) @@ -629,7 +628,7 @@ window.quickcommandHttpServer = () => { // 错误返回 500 if (stderr) return httpResponse(res, 500, stderr) return httpResponse(res, 200, stdout) - }, userVars) + }, Object.assign(userVars, _.cloneDeep(quickcommand))) } httpServer = http.createServer() httpServer.on('request', (req, res) => { diff --git a/quasar.config.js b/quasar.config.js index bda48b9..ca7070f 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -117,7 +117,7 @@ module.exports = configure(function(ctx) { // directives: [], // Quasar plugins - plugins: ['Dialog', 'Notify'] + plugins: ['Notify'] }, // animations: 'all', // --- includes all animations @@ -258,4 +258,4 @@ module.exports = configure(function(ctx) { } } -}); \ No newline at end of file +}); diff --git a/src/App.vue b/src/App.vue index d20e878..12c22da 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,6 +2,7 @@ + diff --git a/src/components/quickFeatures/FavFile.vue b/src/components/quickFeatures/FavFile.vue index 60eada1..107b665 100644 --- a/src/components/quickFeatures/FavFile.vue +++ b/src/components/quickFeatures/FavFile.vue @@ -2,7 +2,7 @@ export default { mounted() { utools.setExpendHeight(0); - quickcommand.enterData.payload.forEach((file) => { + this.$root.payload.forEach((file) => { let uid = this.getUid(); let fileInfo = window.getFileInfo({ type: "file", diff --git a/src/components/quickFeatures/FavUrl.vue b/src/components/quickFeatures/FavUrl.vue index 3d1ffb3..d189903 100644 --- a/src/components/quickFeatures/FavUrl.vue +++ b/src/components/quickFeatures/FavUrl.vue @@ -24,7 +24,7 @@ export default { ); url = choise.text + "://" + url; } - let title = quickcommand.enterData.payload.title + let title = this.$root.payload.title .replace(/和另外 \d+ 个页面.*/, "") .replace(/[-|—] .*?[Edge|Firefox|Chrome].*/, "") .trim(); diff --git a/src/components/quickcommandUI/ButtonBox.vue b/src/components/quickcommandUI/ButtonBox.vue index 1fad269..e20c357 100644 --- a/src/components/quickcommandUI/ButtonBox.vue +++ b/src/components/quickcommandUI/ButtonBox.vue @@ -1,21 +1,20 @@ diff --git a/src/components/quickcommandUI/InputBox.vue b/src/components/quickcommandUI/InputBox.vue index 02624d7..d203286 100644 --- a/src/components/quickcommandUI/InputBox.vue +++ b/src/components/quickcommandUI/InputBox.vue @@ -1,63 +1,41 @@ diff --git a/src/components/quickcommandUI/SelectList.vue b/src/components/quickcommandUI/SelectList.vue index 6b051e9..4826394 100644 --- a/src/components/quickcommandUI/SelectList.vue +++ b/src/components/quickcommandUI/SelectList.vue @@ -1,66 +1,54 @@ + + diff --git a/src/components/quickcommandUI/TextArea.vue b/src/components/quickcommandUI/TextArea.vue index 664f239..52375c2 100644 --- a/src/components/quickcommandUI/TextArea.vue +++ b/src/components/quickcommandUI/TextArea.vue @@ -1,65 +1,43 @@