This commit is contained in:
idranme
2024-08-04 22:07:55 +08:00
parent 4bee2ba062
commit 85df3794e8
8 changed files with 49 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
# LLOneBot
LiteLoaderQQNT 插件,实现 OneBot 11 协议进行 QQ 机器人开发
LiteLoaderQQNT 插件,实现 OneBot 11 协议,帮助进行 QQ 机器人开发
> [!CAUTION]\
> **请不要在 QQ 官方群聊和任何影响力较大的简中互联网平台(包括但不限于:B站微博知乎抖音等发布和讨论*任何*与本插件存在相关性的信息**

View File

@@ -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: {

View File

@@ -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": [

View File

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

View File

@@ -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
View File

@@ -3,6 +3,6 @@ import { type LLOneBot } from './preload'
declare global {
interface Window {
llonebot: LLOneBot
LiteLoader: any
LiteLoader: Record<string, any>
}
}

View File

@@ -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'