启用后,在主输入框输入「快捷命令服务」可以进入配置一个后台服务
通过本地监听{{
- $root.profile.quickFeatures.apiServer.port
+ $root.profile.apiServerPort
}}端口的形式,接收用户传送过来的参数,然后根据参数执行不同的操作
本功能的意义在于,将 utools
@@ -455,10 +455,7 @@ export default {
toggleFeature(type) {
this.$root.utools.whole.removeFeature(this.features[type].code) ||
this.$root.utools.whole.setFeature(_.cloneDeep(this.features[type]));
- if (
- type === "apiServer" &&
- !this.$root.profile.quickFeatures.apiServer.enable
- ) {
+ if (type === "apiServer" && !this.$root.profile.apiServerEnable) {
window.quickcommandHttpServer().stop();
this.$root.profile.quickFeatures.apiServer.serverStatus = false;
}
diff --git a/src/components/quickFeatures/ApiServer.vue b/src/components/quickFeatures/ApiServer.vue
index b70bc11..1a4c772 100644
--- a/src/components/quickFeatures/ApiServer.vue
+++ b/src/components/quickFeatures/ApiServer.vue
@@ -31,9 +31,7 @@
POSTGET
-
- http://127.0.0.1:{{ $root.profile.quickFeatures.apiServer.port }}
-
+ http://127.0.0.1:{{ $root.profile.apiServerPort }}
的参数,均会作为本脚本里的变量
@@ -101,9 +99,7 @@ export default {
)
.then(() => {
this.$root.profile.quickFeatures.apiServer.serverStatus = true;
- window
- .quickcommandHttpServer()
- .run(this.$root.profile.quickFeatures.apiServer.port);
+ window.quickcommandHttpServer().run(this.$root.profile.apiServerPort);
quickcommand.showMessageBox("启动服务成功!");
});
},
diff --git a/src/components/quickFeatures/FavFile.vue b/src/components/quickFeatures/FavFile.vue
index 107b665..d23acdc 100644
--- a/src/components/quickFeatures/FavFile.vue
+++ b/src/components/quickFeatures/FavFile.vue
@@ -21,7 +21,7 @@ export default {
program: "quickcommand",
cmd: `open(\"${file.path.replace(/\\/g, "\\\\")}\")`,
output: "ignore",
- tags: [this.$root.profile.quickFeatures.favFile.tag],
+ tags: [this.$root.profile.quickFileTag],
};
this.importCommand(command);
});
diff --git a/src/components/quickFeatures/FavUrl.vue b/src/components/quickFeatures/FavUrl.vue
index d189903..51ef660 100644
--- a/src/components/quickFeatures/FavUrl.vue
+++ b/src/components/quickFeatures/FavUrl.vue
@@ -47,7 +47,7 @@ export default {
program: "quickcommand",
cmd: `visit(\"${url}\")\n`,
output: "ignore",
- tags: [this.$root.profile.quickFeatures.favUrl.tag],
+ tags: [this.$root.profile.quickUrlTag],
};
try {
let res = await quickcommand.downloadFile(iconUrl, iconPath);
diff --git a/src/components/quickFeatures/PluginNickName.vue b/src/components/quickFeatures/PluginNickName.vue
index 69381d2..5508874 100644
--- a/src/components/quickFeatures/PluginNickName.vue
+++ b/src/components/quickFeatures/PluginNickName.vue
@@ -127,7 +127,7 @@ export default {
program: "quickcommand",
cmd: `utools.redirect("${this.feature.cmd}");utools.showMainWindow()`,
output: "ignore",
- tags: [this.$root.profile.quickFeatures.pluNickName.tag],
+ tags: [this.$root.profile.pluNickNameTag],
};
this.importCommand(command);
this.nickName = [];
diff --git a/src/js/options/defaultProfile.js b/src/js/options/defaultProfile.js
index d6ddb85..08af8ab 100644
--- a/src/js/options/defaultProfile.js
+++ b/src/js/options/defaultProfile.js
@@ -5,24 +5,12 @@ export default {
backgroundImg: null,
autofocusSearch: false,
denseTagBar: false,
- crontabs: {},
- quickFeatures: {
- favFile: {
- enable: false,
- tag: "文件"
- },
- favUrl: {
- enable: false,
- tag: "网址"
- },
- pluNickName: {
- enable: false,
- tag: "别名"
- },
- apiServer: {
- enable: false,
- port: 33442,
- serverStatus: false
- }
- }
-}
+ quickFileEnable: false,
+ quickFileTag: "文件",
+ quickUrlEnable: false,
+ quickUrlTag: "网址",
+ pluNickNameEnable: false,
+ pluNickNameTag: "别名",
+ apiServerEnable: false,
+ apiServerPort: 33442,
+}
\ No newline at end of file