mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat:update renderer
This commit is contained in:
parent
b5655a1a5f
commit
7381fb3e11
@ -1,4 +1,5 @@
|
||||
/// <reference path="../global.d.ts" />
|
||||
import { CheckVersion } from '../common/types';
|
||||
import {
|
||||
SettingButton,
|
||||
SettingItem,
|
||||
@ -35,6 +36,16 @@ async function onSettingWindowCreated(view: Element) {
|
||||
const doc = parser.parseFromString([
|
||||
'<div>',
|
||||
`<style>${StyleRaw}</style>`,
|
||||
`<setting-section>
|
||||
<setting-panel>
|
||||
<setting-list data-direction="column" class="new">
|
||||
<setting-item data-direction="row">
|
||||
<setting-text class="llonebot-update-title">正在检查LLOneBot版本中</setting-text>
|
||||
<setting-button data-type="secondary" class="llonebot-update-button">重新发现</setting-button>
|
||||
</setting-item>
|
||||
</setting-list>
|
||||
</setting-panel>
|
||||
<setting-section>`,
|
||||
SettingList([
|
||||
SettingItem('启用 HTTP 服务', null,
|
||||
SettingSwitch('ob11.enableHttp', config.ob11.enableHttp, { 'control-display-id': 'config-ob11-httpPort' }),
|
||||
@ -303,6 +314,16 @@ async function onSettingWindowCreated(view: Element) {
|
||||
doc.body.childNodes.forEach(node => {
|
||||
view.appendChild(node);
|
||||
});
|
||||
window.llonebot.checkVersion().then((ResultVersion: CheckVersion) => {
|
||||
if (ResultVersion.result) {
|
||||
view.querySelector(".llonebot-update-title").innerHTML = "当前已是最新版本 V" + ResultVersion.version;
|
||||
view.querySelector(".llonebot-update-button").innerHTML = "无需更新";
|
||||
} else {
|
||||
view.querySelector(".llonebot-update-title").innerHTML = "已监测到最新版本 V" + ResultVersion.version;
|
||||
view.querySelector(".llonebot-update-button").innerHTML = "点击更新";
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user