显示 changelog

This commit is contained in:
fofolee 2022-05-16 01:44:27 +08:00
parent 432c25b1e2
commit ea53de2665
3 changed files with 43 additions and 40 deletions

View File

@ -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()

View File

@ -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);
},
},
});

View File

@ -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() {