Skip to content

Commit

Permalink
[nl]LLOneBot 配置文件补充
Browse files Browse the repository at this point in the history
✨ LLOneBot 配置文件补充
✨ 优化了更新提示的逻辑
💚 [build-electron]
  • Loading branch information
Stapxs committed Apr 28, 2024
1 parent 0b17948 commit de98ac3
Show file tree
Hide file tree
Showing 11 changed files with 346 additions and 285 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stapxs-qq-lite",
"version": "2.7.1",
"version": "2.7.2",
"private": false,
"author": "Stapx Steve [林槐]",
"description": "一个兼容 OneBot 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。",
Expand Down
258 changes: 19 additions & 239 deletions src/App.vue

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/assets/l10n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"chat_fun_menu_jin_sender": "{time},由 {name} 设置",
"update_history": "更新记录",
"btn_know": "知道了",
"btn_see": "查看",
"btn_see": "查看",
"chat_fun_at_find_emp": "没有找到匹配的群成员",
"l10n_author_title": "作者:",
"option_fun_taill": "小尾巴",
Expand Down Expand Up @@ -306,6 +306,8 @@
"loading": "加载中",
"chat_msg_sending": "发送中",
"powered_by": "驱动自",
"new_update": "新版本",
"btn_download_update": "下载更新…",

"menu_about": "关于",
"menu_update": "检查更新…",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/pathMap/LLOneBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: LLOneBot
redirect: NapCat.Onebot
55 changes: 55 additions & 0 deletions src/components/UpdatePan.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div class="update-info">
<span>{{ from == 'web' ? $t('update_history') : $t('new_update') }}</span>
<a>{{ version }}</a>
<div class="title">
<img :src="user.avatar">
<a :href="user.url">{{ user.name }}</a>
<span> {{ Intl.DateTimeFormat(getTrueLang(), { year: 'numeric', month: 'short', day: 'numeric' })
.format(new Date(user.date)) }} </span>
</div>
<div class="info"><span>{{ info.title }}</span>
<div>
<div v-for="(str, index) in info.content" :key="'changelog-' + index">
<span>{{ str }}</span>
</div>
</div>
</div>
</div>
</template>


<script lang="ts">
import { defineComponent } from 'vue'
import { getTrueLang, gitmojiToEmoji } from '@/function/utils/systemUtil'
export default defineComponent({
name: 'UpdatePan',
props: ['version', 'user', 'message', 'from'],
data() {
return {
getTrueLang,
info: {
title: '' as string,
content: [] as string[]
}
}
},
mounted() {
const updateInfo = this.message.split('\n')
this.info.title = updateInfo[0]
for (let i = 1; i < updateInfo.length; i++) {
let text = updateInfo[i]
if (text.startsWith(':')) {
const end = text.substring(1).indexOf(':')
const name = text.substring(0, end + 2)
const emj = gitmojiToEmoji(name)
if (emj != undefined) {
text = text.replace(name, emj)
}
}
this.info.content.push(text)
}
}
})
</script>
6 changes: 3 additions & 3 deletions src/function/electron/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ export function regIpcListener() {
store.store = arg
})
// 获取设置
ipcMain.on('opt:getAll', (event, arg) => {
ipcMain.on('opt:getAll', (event) => {
event.returnValue = store.store
})
ipcMain.on('opt:get', (event, arg) => {
event.returnValue = store.get(arg)
})
// 重置设置
ipcMain.on('opt:clearAll', (event, arg) => {
ipcMain.on('opt:clearAll', (event) => {
store.clear()
event.returnValue = true
})
Expand Down Expand Up @@ -92,7 +92,7 @@ export function regIpcListener() {
}
}
})
item.on('done', (event, state) => {
item.on('done', (event) => {
win?.setProgressBar(-1)
const sender = (event as any).sender
if(sender)
Expand Down
18 changes: 12 additions & 6 deletions src/function/msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import qed from '@/assets/qed.txt'

import app from '@/main'
import Option, { run } from './option'
import Option from './option'
import xss from 'xss'
import pinyin from 'pinyin'

import Umami from '@bitprojects/umami-logger-typescript'

import { buildMsgList, getMsgData, parseMsgList, getMsgRawTxt } from '@/function/utils/msgUtil'
import { htmlDecodeByRegExp, randomNum } from '@/function/utils/systemUtil'
import { getViewTime, htmlDecodeByRegExp, randomNum } from '@/function/utils/systemUtil'
import { reloadUsers, downloadFile, updateMenu } from '@/function/utils/appUtil'
import { reactive, nextTick, markRaw, defineAsyncComponent } from 'vue'
import { PopInfo, PopType, Logger, LogType } from './base'
Expand Down Expand Up @@ -127,10 +127,14 @@ function saveBotInfo(msg: { [key: string]: any }) {
try {
// eslint-disable-next-line
msgPath = require(`@/assets/pathMap/${data.app_name}.yaml`)
logger.debug('加载映射表:' + msgPath.name)
if(msgPath.redirect) {
msgPath = require(`@/assets/pathMap/${msgPath.redirect}.yaml`)
logger.debug('加载映射表(重定向):' + msgPath.name)
}
runtimeData.jsonMap = msgPath
logger.debug('加载 JSON 映射表:' + msgPath._name)
} catch (ex) {
logger.debug('加载 JSON 映射表失败:' + ex)
logger.debug('加载映射表失败:' + ex)
}
}
// 继续获取后续内容
Expand Down Expand Up @@ -266,12 +270,14 @@ function updateTopMag(msg: any, echoList: string[]) {
list = parseMsgList(list, msgPath.message_list.type, msgPath.message_value)
const raw = getMsgRawTxt(list[0].message)
const sender = list[0].sender
const time = list[0].time
// 更新置顶列表
runtimeData.onMsgList.forEach((item) => {
if (item.user_id == id) {
item.raw_msg = raw
} else if(item.group_id == id) {
item.raw_msg = sender.nickname + ': ' + raw
item.time = getViewTime(Number(time))
}
})
}
Expand Down Expand Up @@ -354,7 +360,7 @@ function saveMsg(msg: any, append = undefined as undefined | string) {
} else {
user.raw_msg = getMsgRawTxt(lastMsg.message)
}
user.time = lastMsg.time
user.time = getViewTime(Number(lastMsg.time))
}
}

Expand Down Expand Up @@ -774,7 +780,7 @@ function newMsg(data: any) {
} else {
runtimeData.onMsgList[index].raw_msg = getMsgRawTxt(data.message)
}
runtimeData.onMsgList[index].time = Number(data.time) * 1000
runtimeData.onMsgList[index].time = getViewTime(Number(data.time))
return true
}
return false
Expand Down
Loading

0 comments on commit de98ac3

Please sign in to comment.