mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
optimise
This commit is contained in:
parent
4bee2ba062
commit
85df3794e8
@ -1,6 +1,6 @@
|
||||
# LLOneBot
|
||||
|
||||
LiteLoaderQQNT 插件,实现 OneBot 11 协议进行 QQ 机器人开发
|
||||
LiteLoaderQQNT 插件,实现 OneBot 11 协议,帮助进行 QQ 机器人开发
|
||||
|
||||
> [!CAUTION]\
|
||||
> **请不要在 QQ 官方群聊和任何影响力较大的简中互联网平台(包括但不限于:B站,微博,知乎,抖音等)发布和讨论*任何*与本插件存在相关性的信息**
|
||||
|
@ -1,6 +1,6 @@
|
||||
import cp from 'vite-plugin-cp'
|
||||
import './scripts/gen-version'
|
||||
import path from 'node:path'
|
||||
import './scripts/gen-manifest'
|
||||
|
||||
const external = [
|
||||
'silk-wasm',
|
||||
@ -32,6 +32,7 @@ let config = {
|
||||
external,
|
||||
input: 'src/main/main.ts',
|
||||
},
|
||||
minify: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"manifest_version": 4,
|
||||
"type": "extension",
|
||||
"name": "LLOneBot v3.27.4",
|
||||
"name": "LLOneBot",
|
||||
"slug": "LLOneBot",
|
||||
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发",
|
||||
"description": "实现 OneBot 11 协议,帮助进行 QQ 机器人开发",
|
||||
"version": "3.27.4",
|
||||
"icon": "./icon.webp",
|
||||
"authors": [
|
||||
|
@ -33,7 +33,6 @@
|
||||
"@types/ws": "^8.5.12",
|
||||
"electron": "^29.0.1",
|
||||
"electron-vite": "^2.3.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.4",
|
||||
"vite": "^5.3.5",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
|
38
scripts/gen-manifest.ts
Normal file
38
scripts/gen-manifest.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { version } from '../src/version'
|
||||
import { writeFileSync } from 'node:fs'
|
||||
|
||||
const manifest = {
|
||||
manifest_version: 4,
|
||||
type: 'extension',
|
||||
name: 'LLOneBot',
|
||||
slug: 'LLOneBot',
|
||||
description: '实现 OneBot 11 协议,帮助进行 QQ 机器人开发',
|
||||
version,
|
||||
icon: './icon.webp',
|
||||
authors: [
|
||||
{
|
||||
name: 'linyuchen',
|
||||
link: 'https://github.com/linyuchen'
|
||||
}
|
||||
],
|
||||
repository: {
|
||||
repo: 'linyuchen/LiteLoaderQQNT-OneBotApi',
|
||||
branch: 'main',
|
||||
release: {
|
||||
tag: 'latest',
|
||||
name: 'LLOneBot.zip'
|
||||
}
|
||||
},
|
||||
platform: [
|
||||
'win32',
|
||||
'linux',
|
||||
'darwin'
|
||||
],
|
||||
injects: {
|
||||
renderer: './renderer/index.js',
|
||||
main: './main/main.cjs',
|
||||
preload: './preload/preload.cjs'
|
||||
}
|
||||
}
|
||||
|
||||
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2))
|
@ -1,22 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { version } from '../src/version'
|
||||
|
||||
const manifestPath = path.join(__dirname, '../manifest.json')
|
||||
|
||||
function readManifest(): any {
|
||||
if (fs.existsSync(manifestPath)) {
|
||||
return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'))
|
||||
}
|
||||
}
|
||||
|
||||
function writeManifest(manifest: any) {
|
||||
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2))
|
||||
}
|
||||
|
||||
const manifest = readManifest()
|
||||
if (version !== manifest.version) {
|
||||
manifest.version = version
|
||||
manifest.name = `LLOneBot v${version}`
|
||||
writeManifest(manifest)
|
||||
}
|
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
@ -3,6 +3,6 @@ import { type LLOneBot } from './preload'
|
||||
declare global {
|
||||
interface Window {
|
||||
llonebot: LLOneBot
|
||||
LiteLoader: any
|
||||
LiteLoader: Record<string, any>
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import { SettingButton, SettingItem, SettingList, SettingSwitch, SettingSelect }
|
||||
// @ts-ignore
|
||||
import StyleRaw from './style.css?raw'
|
||||
import { iconSvg } from './icon'
|
||||
import { version } from '../version'
|
||||
|
||||
// 打开设置界面时触发
|
||||
|
||||
@ -53,8 +54,8 @@ async function onSettingWindowCreated(view: Element) {
|
||||
'<div>',
|
||||
`<style>${StyleRaw}</style>`,
|
||||
`<setting-section id="llonebot-error">
|
||||
<setting-panel><pre><code></code></pre></setting-panel>
|
||||
</setting-section>`,
|
||||
<setting-panel><pre><code></code></pre></setting-panel>
|
||||
</setting-section>`,
|
||||
SettingList([
|
||||
SettingItem(
|
||||
'<span id="llonebot-update-title">正在检查 LLOneBot 更新</span>',
|
||||
@ -399,7 +400,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
const buttonDom = view.querySelector<HTMLButtonElement>('#llonebot-update-button')!
|
||||
|
||||
if (ResultVersion.version === '') {
|
||||
titleDom.innerHTML = '检查更新失败'
|
||||
titleDom.innerHTML = `当前版本为 v${version},检查更新失败`
|
||||
buttonDom.innerHTML = '点击重试'
|
||||
|
||||
buttonDom.addEventListener('click', async () => {
|
||||
@ -412,7 +413,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
titleDom.innerHTML = '当前已是最新版本 v' + ResultVersion.version
|
||||
buttonDom.innerHTML = '无需更新'
|
||||
} else {
|
||||
titleDom.innerHTML = '已检测到最新版本 v' + ResultVersion.version
|
||||
titleDom.innerHTML = `当前版本为 v${version},最新版本为 v${ResultVersion.version}`
|
||||
buttonDom.innerHTML = '点击更新'
|
||||
buttonDom.dataset.type = 'primary'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user