mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-09 02:22:53 +08:00
显示 changelog
This commit is contained in:
parent
432c25b1e2
commit
ea53de2665
@ -454,7 +454,10 @@ window.showUb = {
|
||||
},
|
||||
docs: function(path = '') {
|
||||
runUbrowser(docsRepoUrl + '/pt589p' + path)
|
||||
}
|
||||
},
|
||||
changelog: function(path = '') {
|
||||
runUbrowser(docsRepoUrl + '/ucnd2o' + path)
|
||||
},
|
||||
}
|
||||
|
||||
window.clipboardReadText = () => electron.clipboard.readText()
|
||||
|
53
src/App.vue
53
src/App.vue
@ -37,13 +37,8 @@ export default defineComponent({
|
||||
init() {
|
||||
window.utools = window.getuToolsLite();
|
||||
if (!this.checkVer()) return;
|
||||
this.showChangeLog();
|
||||
this.startUp();
|
||||
this.utools.whole.onPluginEnter((enter) => {
|
||||
this.enterPlugin(enter);
|
||||
});
|
||||
this.utools.whole.onPluginOut(() => {
|
||||
this.outPlugin();
|
||||
});
|
||||
},
|
||||
checkVer() {
|
||||
const requiredVersion = "2.6.1";
|
||||
@ -59,9 +54,18 @@ export default defineComponent({
|
||||
return true;
|
||||
},
|
||||
startUp() {
|
||||
// 处理旧版本数据
|
||||
this.v2DataHandler();
|
||||
// 读取用户配置
|
||||
this.loadProfile();
|
||||
// 默认主题色
|
||||
this.setCssVar("primary", this.profile.primaryColor);
|
||||
this.startUpOnce();
|
||||
this.utools.whole.onPluginEnter((enter) => {
|
||||
this.enterPlugin(enter);
|
||||
});
|
||||
this.utools.whole.onPluginOut(() => {
|
||||
this.outPlugin();
|
||||
});
|
||||
},
|
||||
loadProfile() {
|
||||
let commonProfile = this.utools.getDB("cfg_profile");
|
||||
let nativeProfile = this.utools.getDB(
|
||||
"cfg_" + utools.getNativeId() + "_profile"
|
||||
@ -71,9 +75,13 @@ export default defineComponent({
|
||||
_.cloneDeep(this.nativeProfile),
|
||||
nativeProfile
|
||||
);
|
||||
// 默认主题色
|
||||
this.setCssVar("primary", this.profile.primaryColor);
|
||||
this.startUpOnce();
|
||||
},
|
||||
saveProfile() {
|
||||
this.utools.putDB(_.cloneDeep(this.profile), "cfg_profile");
|
||||
this.utools.putDB(
|
||||
_.cloneDeep(this.nativeProfile),
|
||||
"cfg_" + utools.getNativeId() + "_profile"
|
||||
);
|
||||
},
|
||||
// 插件全生命周期只运行一次,主要针对多开的情况
|
||||
startUpOnce() {
|
||||
@ -99,11 +107,7 @@ export default defineComponent({
|
||||
outPlugin() {
|
||||
this.$refs.view.$refs?.commandEditor?.saveCodeHistory();
|
||||
this.$router.push("/");
|
||||
this.utools.putDB(_.cloneDeep(this.profile), "cfg_profile");
|
||||
this.utools.putDB(
|
||||
_.cloneDeep(this.nativeProfile),
|
||||
"cfg_" + utools.getNativeId() + "_profile"
|
||||
);
|
||||
this.saveProfile();
|
||||
},
|
||||
runCronTask(featureCode, cronExp) {
|
||||
this.cronJobs[featureCode] = Cron(cronExp, () => {
|
||||
@ -149,13 +153,14 @@ export default defineComponent({
|
||||
second: dateString.getSeconds(),
|
||||
};
|
||||
},
|
||||
v2DataHandler() {
|
||||
let v2DataHandled = this.utools.getStorage("st_v2DataHandled");
|
||||
if (v2DataHandled) return;
|
||||
showChangeLog() {
|
||||
if (this.utools.getStorage("st_v300Inited")) return;
|
||||
window.showUb.changelog();
|
||||
// 处理统计数据
|
||||
let statisticsData = this.utools.getDB("cfg_statisticsData");
|
||||
_.forIn(statisticsData, (data, year) => {
|
||||
statisticsData[year] = data.map((x) => {
|
||||
if (!x.command) return x;
|
||||
let code =
|
||||
x.command.code === "options" ? "configuration" : x.command.code;
|
||||
return {
|
||||
@ -165,9 +170,11 @@ export default defineComponent({
|
||||
});
|
||||
});
|
||||
this.utools.putDB(statisticsData, "cfg_statisticsData");
|
||||
// 处理历史代码
|
||||
// ...
|
||||
this.utools.setStorage("st_v2DataHandled", true);
|
||||
// 删掉数据库内的默认命令
|
||||
this.utools
|
||||
.getDocs("qc_default")
|
||||
.forEach((x) => this.utools.delDB(x._id));
|
||||
this.utools.setStorage("st_v300Inited", true);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -289,10 +289,7 @@ export default {
|
||||
// 所有命令对应的标签
|
||||
allQuickCommandTags() {
|
||||
let allTags = _.union(
|
||||
..._.concat(
|
||||
"默认",
|
||||
Object.values(this.allQuickCommands).map((x) => x.tags)
|
||||
)
|
||||
...Object.values(this.allQuickCommands).map((x) => x.tags)
|
||||
).concat(["未分类", "来自分享"]);
|
||||
if (this.commandSearchKeyword?.length > 1) allTags.push("搜索结果");
|
||||
return allTags;
|
||||
@ -326,7 +323,10 @@ export default {
|
||||
setTimeout(this.getAllQuickCommands, 0);
|
||||
},
|
||||
importDefaultCommands() {
|
||||
Object.assign(this.allQuickCommands, defaultCommands);
|
||||
this.allQuickCommands = Object.assign(
|
||||
_.cloneDeep(defaultCommands),
|
||||
this.allQuickCommands
|
||||
);
|
||||
},
|
||||
// 获取所有已启用的命令的 features 以及面板名称
|
||||
getActivatedFeatures() {
|
||||
@ -505,13 +505,11 @@ export default {
|
||||
.getDocs("qc_")
|
||||
.map((x) => x._id)
|
||||
.forEach((y) => this.$root.utools.delDB(y));
|
||||
this.importDefaultCommands();
|
||||
this.resetQuickFeatures();
|
||||
this.clearAllFeatures();
|
||||
Object.keys(this.allQuickCommands).forEach((featureCode) => {
|
||||
if (!featureCode.includes("default_"))
|
||||
delete this.allQuickCommands[featureCode];
|
||||
delete this.allQuickCommands[featureCode];
|
||||
});
|
||||
this.importDefaultCommands();
|
||||
this.currentTag = "默认";
|
||||
quickcommand.showMessageBox(
|
||||
"清空完毕,为防止误操作,已将所有命令复制到剪贴板,可通过导入命令恢复"
|
||||
@ -521,15 +519,10 @@ export default {
|
||||
// 删除所有 features
|
||||
clearAllFeatures() {
|
||||
for (var feature of utools.getFeatures()) {
|
||||
if (feature.code.slice(0, 8) === "feature_") continue;
|
||||
this.$root.utools.whole.removeFeature(feature.code);
|
||||
}
|
||||
},
|
||||
resetQuickFeatures() {
|
||||
Object.assign(
|
||||
this.$root.profile.quickFeatures,
|
||||
_.cloneDeep(defaultProfile.quickFeatures)
|
||||
);
|
||||
window.quickcommandHttpServer().stop();
|
||||
this.activatedQuickCommandFeatureCodes = [];
|
||||
},
|
||||
// 搜索
|
||||
updateSearch() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user