feat: 版本机制; fix: fix: 绑定设备提示

This commit is contained in:
bietiaop 2024-08-20 13:29:19 +08:00
parent d34c1d8be1
commit 8425503797
16 changed files with 820 additions and 59 deletions

View file

@ -8,10 +8,13 @@ import * as alias from './alias.js';
import * as panel from './panel.js';
import * as version from './version.js';
export default {
assets,
guides,
config,
alias,
panel,
version,
};

49
apps/manage/version.js Normal file
View file

@ -0,0 +1,49 @@
import version from '../../lib/version.js';
import render from '../../lib/render.js';
import { ZZZUpdate } from '../../lib/update.js';
import { pluginName } from '../../lib/path.js';
export async function getChangeLog() {
const versionData = version.changelogs;
await render(this.e, 'help/version.html', {
versionData,
});
return false;
}
export async function getCommitLog() {
if (!ZZZUpdate) return false;
let updatePlugin = new ZZZUpdate();
updatePlugin.e = this.e;
updatePlugin.reply = this.reply;
if (updatePlugin.getPlugin(pluginName)) {
try {
const commitData = await updatePlugin.getZZZAllLog();
await render(this.e, 'help/commit.html', {
commitData,
});
} catch (error) {
this.reply(`[${pluginName}]获取更新日志失败\n${error.message}`);
}
}
return true;
}
export async function hasUpdate() {
if (!ZZZUpdate) return false;
let updatePlugin = new ZZZUpdate();
updatePlugin.e = this.e;
updatePlugin.reply = this.reply;
if (updatePlugin.getPlugin(pluginName)) {
const result = await updatePlugin.hasUpdate();
if (result.hasUpdate) {
await this.reply(`[${pluginName}]有${result.logs.length || 1}个更新`);
await render(this.e, 'help/commit.html', {
commitData: result.logs,
});
} else {
await this.reply(`[${pluginName}]已是最新`);
}
}
return true;
}