mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
feat: 版本机制; fix: fix: 绑定设备提示
This commit is contained in:
parent
d34c1d8be1
commit
8425503797
16 changed files with 820 additions and 59 deletions
21
apps/help.js
21
apps/help.js
|
|
@ -189,6 +189,27 @@ const helpData = [
|
|||
needSK: false,
|
||||
commands: ['解绑设备'],
|
||||
},
|
||||
{
|
||||
title: '更新日志',
|
||||
desc: '查看插件的Commit日志',
|
||||
needCK: false,
|
||||
needSK: false,
|
||||
commands: ['[插件]更新日志'],
|
||||
},
|
||||
{
|
||||
title: '版本',
|
||||
desc: '查看插件版本日志',
|
||||
needCK: false,
|
||||
needSK: false,
|
||||
commands: ['[插件]版本'],
|
||||
},
|
||||
{
|
||||
title: '检查更新',
|
||||
desc: '检查插件是否更新',
|
||||
needCK: false,
|
||||
needSK: false,
|
||||
commands: ['[插件]检查更新'],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -60,6 +60,18 @@ export class Panel extends ZZZPlugin {
|
|||
reg: `${rulePrefix}删除(\\S+)(角色|面板)图(.+)$`,
|
||||
fnc: 'deleteCharacterImg',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}(插件)?版本$`,
|
||||
fnc: 'getChangeLog',
|
||||
},
|
||||
{
|
||||
reg: `^${rulePrefix}(插件)?更新日志$`,
|
||||
fnc: 'getCommitLog',
|
||||
},
|
||||
{
|
||||
reg: `^${rulePrefix}(插件)?检查更新$`,
|
||||
fnc: 'hasUpdate',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
|
@ -75,5 +87,8 @@ export class Panel extends ZZZPlugin {
|
|||
this.uploadCharacterImg = manage.panel.uploadCharacterImg;
|
||||
this.getCharacterImages = manage.panel.getCharacterImages;
|
||||
this.deleteCharacterImg = manage.panel.deleteCharacterImg;
|
||||
this.getChangeLog = manage.version.getChangeLog;
|
||||
this.getCommitLog = manage.version.getCommitLog;
|
||||
this.hasUpdate = manage.version.hasUpdate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
49
apps/manage/version.js
Normal 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;
|
||||
}
|
||||
|
|
@ -1,15 +1,8 @@
|
|||
import _ from 'lodash'
|
||||
import { rulePrefix } from '../lib/common.js'
|
||||
import { pluginName } from '../lib/path.js'
|
||||
import settings from '../lib/settings.js'
|
||||
|
||||
let Update = null
|
||||
try {
|
||||
Update = (await import("../../other/update.js").catch(e => null))?.update
|
||||
Update ||= (await import("../../system/apps/update.ts")).update
|
||||
} catch (e) {
|
||||
logger.error(`[${pluginName}]未获取到更新js ${logger.yellow("更新功能")} 将无法使用`)
|
||||
}
|
||||
import _ from 'lodash';
|
||||
import { rulePrefix } from '../lib/common.js';
|
||||
import { pluginName } from '../lib/path.js';
|
||||
import settings from '../lib/settings.js';
|
||||
import { ZZZUpdate } from '../lib/update.js';
|
||||
|
||||
export class update extends plugin {
|
||||
constructor() {
|
||||
|
|
@ -23,30 +16,15 @@ export class update extends plugin {
|
|||
reg: `^${rulePrefix}(插件)?(强制)?更新(插件)?$`,
|
||||
fnc: 'update',
|
||||
},
|
||||
{
|
||||
reg: `^${rulePrefix}(插件)?更新日志$`,
|
||||
fnc: 'update_log',
|
||||
}
|
||||
],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async update(e = this.e) {
|
||||
if (!e.isMaster) return
|
||||
e.msg = `#${e.msg.includes("强制") ? "强制" : ""}更新${pluginName}`
|
||||
const up = new Update(e)
|
||||
up.e = e
|
||||
return up.update()
|
||||
}
|
||||
|
||||
async update_log() {
|
||||
let Update_Plugin = new Update()
|
||||
Update_Plugin.e = this.e
|
||||
Update_Plugin.reply = this.reply
|
||||
|
||||
if (Update_Plugin.getPlugin(pluginName)) {
|
||||
this.e.reply(await Update_Plugin.getLog(pluginName))
|
||||
}
|
||||
return true
|
||||
if (!e.isMaster || !ZZZUpdate) return false;
|
||||
e.msg = `#${e.msg.includes('强制') ? '强制' : ''}更新${pluginName}`;
|
||||
const up = new ZZZUpdate(e);
|
||||
up.e = e;
|
||||
return up.update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export class Panel extends ZZZPlugin {
|
|||
'1. 使用抓包软件抓取米游社APP的请求',
|
||||
'2. 在请求头内找到【x-rpc-device_id】和【x-rpc-device_fp】',
|
||||
'3. 自行构造如下格式的信息:',
|
||||
' {device_id: "x-rpc-device_id的内容", device_fp: "x-rpc-device_fp的内容"}',
|
||||
' {"device_id": "x-rpc-device_id的内容", "device_fp": "x-rpc-device_fp的内容"}',
|
||||
'4. 给机器人发送"%绑定设备"指令',
|
||||
'5. 机器人会提示发送设备信息',
|
||||
'6. 粘贴自行构造的信息发送',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue