mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
将用户配置分为通用和本机
This commit is contained in:
@@ -339,10 +339,7 @@ export default {
|
||||
},
|
||||
importDefaultCommands() {
|
||||
for (var code of Object.keys(defaultCommands)) {
|
||||
this.$root.utools.putDB(
|
||||
defaultCommands[code],
|
||||
this.$root.utools.DBPRE.QC + code
|
||||
);
|
||||
this.$root.utools.putDB(defaultCommands[code], "qc_" + code);
|
||||
}
|
||||
Object.assign(this.allQuickCommands, defaultCommands);
|
||||
},
|
||||
@@ -365,7 +362,7 @@ export default {
|
||||
getAllQuickCommands() {
|
||||
let allQcs = {};
|
||||
this.$root.utools
|
||||
.getDocs(this.$root.utools.DBPRE.QC)
|
||||
.getDocs("qc_")
|
||||
.forEach((x) => (allQcs[x.data.features.code] = x.data));
|
||||
return allQcs;
|
||||
},
|
||||
@@ -413,7 +410,7 @@ export default {
|
||||
removeCommand(code) {
|
||||
utools.copyText(JSON.stringify(this.allQuickCommands[code], null, 4));
|
||||
delete this.allQuickCommands[code];
|
||||
this.$root.utools.delDB(this.$root.utools.DBPRE.QC + code);
|
||||
this.$root.utools.delDB("qc_" + code);
|
||||
this.disableCommand(code);
|
||||
if (!this.allQuickCommandTags.includes(this.currentTag))
|
||||
this.currentTag = "默认";
|
||||
@@ -463,10 +460,7 @@ export default {
|
||||
dataToPushed = parsedData.qc;
|
||||
}
|
||||
for (var code of Object.keys(dataToPushed)) {
|
||||
this.$root.utools.putDB(
|
||||
dataToPushed[code],
|
||||
this.$root.utools.DBPRE.QC + code
|
||||
);
|
||||
this.$root.utools.putDB(dataToPushed[code], "qc_" + code);
|
||||
}
|
||||
Object.assign(this.allQuickCommands, dataToPushed);
|
||||
quickcommand.showMessageBox("导入成功!");
|
||||
@@ -524,7 +518,7 @@ export default {
|
||||
return quickcommand.showMessageBox("取消操作", "info");
|
||||
this.exportAllCommands(false);
|
||||
this.$root.utools
|
||||
.getDocs(this.$root.utools.DBPRE.QC)
|
||||
.getDocs("qc_")
|
||||
.map((x) => x._id)
|
||||
.forEach((y) => this.$root.utools.delDB(y));
|
||||
this.importDefaultCommands();
|
||||
|
@@ -192,10 +192,7 @@ export default {
|
||||
this.installedCodes.push(code);
|
||||
let pushData = _.cloneDeep(command);
|
||||
pushData.fromShare = true;
|
||||
this.$root.utools.putDB(
|
||||
_.cloneDeep(pushData),
|
||||
this.$root.utools.DBPRE.QC + code
|
||||
);
|
||||
this.$root.utools.putDB(_.cloneDeep(pushData), "qc_" + code);
|
||||
// 通过模拟访问页面来统计下载量
|
||||
utools.ubrowser
|
||||
.goto(`https://www.yuque.com/${this.releaseRepo}/${code}`)
|
||||
@@ -242,7 +239,7 @@ export default {
|
||||
checkCommands() {
|
||||
let installed = [];
|
||||
let needUpdate = [];
|
||||
this.$root.utools.getDocs(this.$root.utools.DBPRE.QC).forEach((item) => {
|
||||
this.$root.utools.getDocs("qc_").forEach((item) => {
|
||||
if (!item.data.fromShare) return;
|
||||
let code = item._id.slice(3);
|
||||
let remote = this.remoteCommands.filter((cmd) => cmd.slug === code)[0];
|
||||
|
@@ -24,10 +24,7 @@ export default {
|
||||
methods: {
|
||||
importCommand(command) {
|
||||
command = _.cloneDeep(command);
|
||||
this.$root.utools.putDB(
|
||||
command,
|
||||
this.$root.utools.DBPRE.QC + command.features.code
|
||||
);
|
||||
this.$root.utools.putDB(command, "qc_" + command.features.code);
|
||||
this.$root.utools.whole.setFeature(command.features);
|
||||
},
|
||||
getUid() {
|
||||
|
Reference in New Issue
Block a user