Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一月遗漏累积更新 #181

Merged
merged 10 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2022-2024 Stapx Steve, and other contributors.
Copyright 2022-2025 Stapx Steve, and other contributors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 基础配置
appId: cn.stapxs.qqweb
productName: Stapxs QQ Lite
copyright: Copyright © 2022-2024 Stapx Steve [林槐]
copyright: Copyright © 2022-2025 Stapx Steve [林槐]
directories:
buildResources: build,
output: dist_electron
Expand All @@ -24,7 +24,7 @@ win:
# - { target: portable, arch: arm64 }
executableName: Stapxs QQ Lite
icon: build/icon-client-others.png
legalTrademarks: Copyright © 2022-2024 Stapx Steve [林槐]
legalTrademarks: Copyright © 2022-2025 Stapx Steve [林槐]
publisherName: stapxs

# macOS 配置
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "3.0.3",
"private": false,
"author": "Stapx Steve [林槐]",
"description": "一个兼容 OneBot 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。",
"description": "一个兼容 OneBot 协议的非官方 QQ 全平台客户端实现",
"homepage": "http://github.com/Stapxs/Stapxs-QQ-Lite-2.0",
"license": "Apache-2.0",
"main": "./out/main/index.js",
Expand Down Expand Up @@ -32,6 +32,7 @@
"electron-window-state": "^5.0.3",
"log4js": "^6.9.1",
"rollup-plugin-node-polyfills": "^0.2.1",
"vconsole": "^3.15.1",
"ws": "^8.18.0"
},
"devDependencies": {
Expand Down
59 changes: 56 additions & 3 deletions src/renderer/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="dev" class="dev-bar">
{{ 'Stapxs QQ Lite Development Mode' }}
{{ 'Stapxs QQ Lite Development Mode On ' + runtimeData.tags.platform }}
{{ ' / fps: ' + fps.value }}
</div>
<div v-if="runtimeData.sysConfig.opt_no_window" class="top-bar" name="appbar">
Expand Down Expand Up @@ -124,7 +124,7 @@
<div v-if="tags.page == 'Friends'">
<Friends :list="runtimeData.userList" @load-history="loadHistory" @user-click="changeChat" />
</div>
<div class="opt-main-tab">
<div class="opt-main-tab" style="opacity: 0">
<Options :show="tags.page == 'Options'" :class="tags.page == 'Options' ? 'active' : ''"
:config="runtimeData.sysConfig" />
</div>
Expand Down Expand Up @@ -234,6 +234,7 @@ import Options from '@renderer/pages/Options.vue'
import Friends from '@renderer/pages/Friends.vue'
import Messages from '@renderer/pages/Messages.vue'
import Chat from '@renderer/pages/Chat.vue'
import { getDeviceType } from './function/utils/systemUtil'

export default defineComponent({
name: 'App',
Expand Down Expand Up @@ -301,10 +302,12 @@ export default defineComponent({
runtimeData.tags.release =
await runtimeData.plantform.reader.invoke('sys:getRelease')
}
if (runtimeData.tags.isCapacitor) {
else if (runtimeData.tags.isCapacitor) {
runtimeData.tags.platform = window.Capacitor.getPlatform()
runtimeData.plantform.capacitor = window.Capacitor
runtimeData.plantform.pulgins = window.Capacitor.Plugins
} else {
runtimeData.tags.platform = 'web'
}
app.config.globalProperties.$viewer = this.viewerBody
// 初始化波浪动画
Expand Down Expand Up @@ -395,6 +398,43 @@ export default defineComponent({
}
// =============================================================
// 初始化完成
// 创建 popstate
if(runtimeData.tags.platform == 'web' && getDeviceType() === 'Android' || getDeviceType() === 'iOS') {
window.addEventListener('popstate', () => {
if(!loginInfo.status || runtimeData.tags.openSideBar) {
// 离开提醒
const popInfo = {
title: this.$t('提醒'),
html: `<span>${this.$t('离开 Stapxs QQ Lite?')}</span>`,
button: [
{
text: this.$t('取消'),
fun: () => {
runtimeData.popBoxList.shift()
history.pushState('ssqqweb', '', location.href)
},
},
{
text: this.$t('离开'),
master: true,
fun: () => {
runtimeData.popBoxList.shift()
history.back()
},
},
],
}
runtimeData.popBoxList.push(popInfo)
} else {
// 内部的页面返回处理,此处使用 watch backTimes 监听
runtimeData.watch.backTimes += 1
history.pushState('ssqqweb', '', location.href)
}
});
if (history.state != 'ssqqweb') {
history.pushState('ssqqweb', '', location.href)
}
}
// UM:加载 Umami 统计功能
if (!Option.get('close_ga') && !this.dev) {
// 给页面添加一个来源域名方便在 electron 中获取
Expand All @@ -405,6 +445,9 @@ export default defineComponent({
if (runtimeData.tags.isElectron) {
config.hostName = 'electron.stapxs.cn'
}
if(runtimeData.tags.isCapacitor) {
config.hostName = 'capacitor.stapxs.cn'
}
Umami.initialize(config)
} else if (this.dev) {
logger.debug('由于运行在调试模式下,分析组件并未初始化 ……')
Expand Down Expand Up @@ -483,9 +526,19 @@ export default defineComponent({
this.tags.showChat = show
this.tags.page = view
// 附加操作
const optTab = document.getElementsByClassName('opt-main-tab')[0] as HTMLDivElement
switch (view) {
case 'Options': {
Connector.send('get_version_info', {}, 'getVersionInfo')
if (optTab) {
optTab.style.opacity = '1'
}
break
}
case 'Home': {
if (optTab) {
optTab.style.opacity = '0'
}
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/assets/css/append/append_vibrancy.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body {
background: rgba(var(--color-card-rgb), 0.6);
}
.friend-list > div:first-child {
margin: 15px 15px 15px 0;
margin: 15px 15px 0 0;
}
.friend-list > div:first-child label {
background: rgba(var(--color-card-2-rgb), 0.7) !important;
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/src/assets/css/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ textarea:focus {
outline: none;
}

.vc-switch {
background: var(--color-main) !important;
display: none !important;
}

.mac-controller {
-webkit-app-region: drag;
z-index: 100;
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/src/assets/l10n/zh-CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -989,3 +989,12 @@ msgstr ""

msgid "别划了别划了被看见了啦"
msgstr ""

msgid "[有人@你]"
msgstr ""

msgid "[@全体]"
msgstr ""

msgid "[特別关心]"
msgstr ""
4 changes: 2 additions & 2 deletions src/renderer/src/components/FacePan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
const target = e.target as HTMLDivElement
// 如果滚到了底部
if (
target.scrollHeight - target.scrollTop ===
target.clientHeight
target.scrollHeight - target.scrollTop <
target.clientHeight + 0.5
) {
if (runtimeData.stickerCache) {
if (
Expand Down
5 changes: 0 additions & 5 deletions src/renderer/src/components/MsgBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@
class="msg-face"
:src="getFace(item.id)"
:title="item.text">
<span
v-else-if="item.id == 394"
class="msg-face-long"><span
v-for="i in 15"
:key="data.message_id + '-l-' + i">🐲</span></span>
<font-awesome-icon
v-else
:class="'msg-face-svg' + (isMe ? ' me' : '')"
Expand Down
44 changes: 28 additions & 16 deletions src/renderer/src/function/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,35 @@ export class Logger {
}
}

if (!hidden && from) {
// eslint-disable-next-line no-console
console.log(
`%c${typeStr}%c${from}%c\n${args}`,
`background:#${this.logTypeInfo[type][0]};color:#${this.logTypeInfo[type][1]};border-radius:7px 0 0 7px;padding:2px 4px 2px 7px;margin-bottom:7px;`,
'background:#e3e8ec;color:#000;padding:2px 7px 4px 4px;border-radius:0 7px 7px 0;margin-bottom:7px;',
'',
data
)
// 如果存在 vconsole 就不打印带 css 样式的日志(它不支持)
const vConsole = document.getElementById('__vconsole')
if (vConsole) {
if (!hidden && from) {
// eslint-disable-next-line no-console
console.log(`${typeStr} | ${from}\n${args}`, data)
} else {
// eslint-disable-next-line no-console
console.log(`${typeStr} | ${args}`, data)
}
} else {
// eslint-disable-next-line no-console
console.log(
`%c${typeStr}%c ${args}`,
`background:#${this.logTypeInfo[type][0]};color:#${this.logTypeInfo[type][1]};border-radius:7px;padding:2px 4px 2px 7px;margin-bottom:7px;`,
'',
data
)
if (!hidden && from) {
// eslint-disable-next-line no-console
console.log(
`%c${typeStr}%c${from}%c\n${args}`,
`background:#${this.logTypeInfo[type][0]};color:#${this.logTypeInfo[type][1]};border-radius:7px 0 0 7px;padding:2px 4px 2px 7px;margin-bottom:7px;`,
'background:#e3e8ec;color:#000;padding:2px 7px 4px 4px;border-radius:0 7px 7px 0;margin-bottom:7px;',
'',
data
)
} else {
// eslint-disable-next-line no-console
console.log(
`%c${typeStr}%c ${args}`,
`background:#${this.logTypeInfo[type][0]};color:#${this.logTypeInfo[type][1]};border-radius:7px;padding:2px 4px 2px 7px;margin-bottom:7px;`,
'',
data
)
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/src/function/elements/information.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export interface RunTimeDataElem {
plantform: {
reader?: IpcRenderer | null,
capacitor?: any,
pulgins?: any
pulgins?: any,
vConsole?: any,
},
tags: {
firstLoad: boolean
Expand All @@ -50,6 +51,7 @@ export interface RunTimeDataElem {
heartbeatTime?: number
oldHeartbeatTime?: number
lastHeartbeatTime?: number
backTimes: number
}
messageList: any[]
mergeMessageList?: any[] | undefined
Expand Down
13 changes: 9 additions & 4 deletions src/renderer/src/function/msg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,9 @@ function saveUser(msg: { [key: string]: any }, type: string) {
if (list != undefined) {
const groupNames = {} as { [key: number]: string }
list.forEach((item, index) => {
if(item.group_name == null || item.group_name == undefined) {
item.group_name = ''
}
// 为所有项目追加拼音名称
let py_name = ''
if (item.group_id) {
Expand Down Expand Up @@ -1725,8 +1728,8 @@ function newMsg(_: string, data: any) {
Object.assign(showUser, formatted)

if(data.atme) showUser.highlight = $t('[有人@你]')
if(data.atall) showUser.highlight = $t('[@全體]')
if(isImportant) showUser.highlight = $t('[特別關心]')
if(data.atall) showUser.highlight = $t('[@全体]')
if(isImportant) showUser.highlight = $t('[特別关心]')

runtimeData.onMsgList.push(showUser)
}
Expand Down Expand Up @@ -1796,7 +1799,7 @@ const baseRuntime = {
tags: {
firstLoad: false,
canLoadHistory: true,
openSideBar: false,
openSideBar: true,
viewer: { index: 0 },
msgType: BotMsgType.Array,
isElectron: false,
Expand All @@ -1807,7 +1810,9 @@ const baseRuntime = {
classes: [],
darkMode: false,
},
watch: {},
watch: {
backTimes: 0,
},
chatInfo: {
show: { type: '', id: 0, name: '', avatar: '' },
info: {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/src/function/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ function changeColorMode(mode: string) {
const StatusBar = runtimeData.plantform.capacitor.Plugins.StatusBar
StatusBar.setStyle({ style: mode.toUpperCase() })
}
// Capacitor: VConsole 颜色
if(runtimeData.plantform.vConsole) {
runtimeData.plantform.vConsole.setOption('theme', mode)
}
}

/**
Expand Down
13 changes: 11 additions & 2 deletions src/renderer/src/function/utils/msgUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ export function sendMsgRaw(
// 将消息构建为完整消息体先显示出去
const msgUUID = uuid()
if (preShow) {
const preShowMsg = JSON.parse(JSON.stringify(msg));
preShowMsg.forEach((item: any) => {
// 对 base64 图片做特殊处理
if (item.type == 'image') {
const b64Str = (item.file as string).substring(9)
item.url = 'data:image/png;base64,' + b64Str
}
})
const showMsg = {
revoke: true,
fake_msg: true,
Expand All @@ -429,9 +437,10 @@ export function sendMsgRaw(
user_id: runtimeData.loginInfo.uin,
nickname: runtimeData.loginInfo.nickname,
},
message: msg,
raw_message: app.config.globalProperties.$t('发送中'),
message: preShowMsg,
} as { [key: string]: any }
showMsg.raw_message = getMsgRawTxt(showMsg)

if (showMsg.message_type == 'group') {
showMsg.group_id = runtimeData.chatInfo.show.id
} else {
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/src/pages/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,12 @@
this.chatMoveEnd()
})
}
// Web:系统返回操作
this.$watch(() => runtimeData.watch.backTimes, () => {
// PS:这儿复用了触屏操作的逻辑……所以看起来怪怪的
this.tags.chatTouch.openSuccess = true
this.chatMoveEnd()
})
},
methods: {
/**
Expand Down Expand Up @@ -2785,6 +2791,7 @@
}
}, 500)
} else {
runtimeData.chatInfo.show.id = 0
runtimeData.tags.openSideBar = true
new Logger().add(LogType.UI, '右滑打开侧边栏触发完成')
}
Expand Down
Loading