Skip to content

Commit

Permalink
#125 DDL 来辣
Browse files Browse the repository at this point in the history
✨ 增加对群成员头衔的显示支持
✨ 优化好友列表动画
✨ 优化日志系统便于更好的调试
✨ 搜索消息功能,现在你可以在已加载的消息中搜索内容
🐛 修正遗留的消息记录有效性判断代码不适用于所有 bot 的问题 <- #129
🐛 修正了获取历史消息的一个小问题,由 3179848 损坏 <- #129
🐛 修正了历史消息加载返回为空的时候导致的 UI 卡死问题,由 619d6e4 损坏
🐛 修正戳一戳判定错误的问题
🐛 修正 Lagrange 分组名称的显示问题 <- #126
🐛 禁言通知未判断来源 <- #124
🎨 支持了映射表合并,便于更灵活的调整映射
🎨 对消息文本处理中的 at 进行显示优化
🎨 修正消息通知流程中的一处代码错误
🎨 修正代码构建器中的一处无用代码,优化一处代码实现
🎨 将多语言功能翻新为更常用的 POT/PO 格式
🎨 现在正式构建中将不会再出现 source map
💄 At 消息现在会隔开一段距离不混在一起
💄 遇到了一个 UI 错位的问题,尝试修复了一下但是不知道好没好(之后没遇到过)
💄 优化 At 信息悬浮窗样式
💄 优化好友列表分组显示样式
💄 优化更新日志弹窗
♿ 补充遗漏的翻译文本
♿ 好友列表现在也将按照拼音排序
♿ 调整 sw 和 electron 下 QQ 头像资源的缓存策略,防止显示过期头像
♿ 修正统计信息设置处的链接打开的方式
♿ 群成员列表现在改为按照拼音首字母排序
🔨 在开发者模式下现在会显示页面 fps
💚 修正由于 webpack 5 导致的 web 构建依赖缺失问题,由 61c6627 损坏
➕ 新增依赖:gettext-parser、util
  • Loading branch information
Stapxs authored Sep 30, 2024
2 parents ce5e58f + c87b7c8 commit bd26484
Show file tree
Hide file tree
Showing 61 changed files with 7,353 additions and 2,269 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src/assets/*
src/assets/*
public/sw.js
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stapxs-qq-lite",
"version": "2.8.6",
"version": "2.9.0",
"private": false,
"author": "Stapx Steve [林槐]",
"description": "一个兼容 OneBot 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。",
Expand All @@ -27,6 +27,7 @@
"detect-browser": "^5.3.0",
"electron-store": "^8.1.0",
"electron-window-state": "^5.0.3",
"gettext-parser": "^8.0.0",
"js-file-downloader": "^1.1.24",
"js-yaml-loader": "^1.2.2",
"jsonpath": "^1.1.1",
Expand All @@ -38,6 +39,7 @@
"semver-compare": "^1.0.0",
"spacingjs": "^1.0.7",
"ts-loader": "~8.2.0",
"util": "^0.12.5",
"uuidv4": "^6.2.13",
"v-viewer": "^3.0.11",
"viewerjs": "^1.11.6",
Expand All @@ -54,6 +56,7 @@
"@types/animejs": "^3.1.12",
"@types/css": "^0.0.33",
"@types/electron-devtools-installer": "^2.2.0",
"@types/gettext-parser": "^4.0.4",
"@types/jsonpath": "^0.2.3",
"@types/semver-compare": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.4.0",
Expand Down
2 changes: 2 additions & 0 deletions public/css/append-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
--color-bg-green: #3f544a;
--color-bg-red: #523a3c;
--color-bg-yellow: #504b3d;

--color-issue-close: #a47ff1;
}
2 changes: 2 additions & 0 deletions public/css/append-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
--color-bg-green: #d5e6de;
--color-bg-red: #f3d8da;
--color-bg-yellow: #fdf3d1;

--color-issue-close: #8059d9;
}
58 changes: 58 additions & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* 本文件由 Copilot 生成,sw 配置实在是太难写了 😭
*/

const CACHE_NAME = 'qlogo-cache-v1';
// const CACHE_DURATION = 1000;
const CACHE_DURATION = 3 * 24 * 60 * 60 * 1000;

self.addEventListener('install', (event) => {
// 跳过等待,立即激活
self.skipWaiting();
});

self.addEventListener('activate', (event) => {
// 清理旧缓存
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(
cacheNames.map((cacheName) => {
if (cacheName !== CACHE_NAME) {
return caches.delete(cacheName);
}
})
);
})
);
});

self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url);

// sw.js 本身的请求不缓存
if (url.pathname === '/sw.js') {
return;
}

if (url.hostname === 'q1.qlogo.cn') {
// 对于 QQ 头像的请求,缓存三天
event.respondWith(
caches.open(CACHE_NAME).then((cache) => {
return cache.match(event.request).then((response) => {
if (response) {
return response;
}

return fetch(event.request).then((response) => {
const responseClone = response.clone();
cache.put(event.request, responseClone);
return response;
});
});
})
);
} else {
// 对于其他请求,采用默认的网络优先策略
event.respondWith(fetch(event.request));
}
});
62 changes: 46 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<template>
<div v-if="dev" class="dev-bar">
{{ 'Stapxs QQ Lite Development Mode' }}
{{ ' / fps: ' + fps.value }}
</div>
<div class="top-bar" name="appbar" v-if="runtimeData.sysConfig.opt_no_window">
<div class="bar-button" @click="barMainClick()"></div>
<div class="space"></div>
Expand Down Expand Up @@ -31,38 +35,37 @@
</li>
</ul>
<div :style="get('fs_adaptation') > 0 ? `height: calc(100% - ${75 + Number(get('fs_adaptation'))}px);` : ''">
<div :name="$t('home_title')" v-if="tags.page == 'Home'">
<div :name="$t('主页')" v-if="tags.page == 'Home'">
<div class="home-body">
<div class="login-pan-card ss-card">
<font-awesome-icon :icon="['fas', 'circle-nodes']" />
<p>{{ $t('home_card_title') }}</p>
<p>{{ $t('连接到 OneBot') }}</p>
<form @submit.prevent @submit="connect">
<label>
<font-awesome-icon :icon="['fas', 'link']" />
<input v-model="loginInfo.address" :placeholder="$t('home_card_address')"
<input v-model="loginInfo.address" :placeholder="$t('连接地址')"
class="ss-input" id="sev_address" autocomplete="off">
</label>
<label>
<font-awesome-icon :icon="['fas', 'lock']" />
<input v-model="loginInfo.token" :placeholder="$t('home_card_key')" class="ss-input"
<input v-model="loginInfo.token" :placeholder="$t('连接密钥')" class="ss-input"
type="password" id="access_token" autocomplete="off">
</label>
<div style="display: flex;">
<label class="default">
<input id="in_" type="checkbox" name="save_password" @click="savePassword" v-model="tags.savePassword">
<a>{{ $t('home_card_save_pwd') }}</a>
<a>{{ $t('记住密码') }}</a>
</label>
<div style="flex: 1;"></div>
<label class="default" style="justify-content: flex-end;">
<input type="checkbox" name="auto_connect" @click="saveAutoConnect" v-model="runtimeData.sysConfig.auto_connect">
<a>{{ $t('home_card_auto_con') }}</a>
<a>{{ $t('自动连接') }}</a>
</label>
</div>
<button @mousemove="afd" id="connect_btn" class="ss-button" type="submit">{{ $t('home_card_connect')
}}</button>
<button @mousemove="afd" id="connect_btn" class="ss-button" type="submit">{{ $t('连接')}}</button>
</form>
<a href="https://github.com/Stapxs/Stapxs-QQ-Lite-2.0#%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8"
target="_blank" style="margin-bottom: -20px;">{{ $t('home_card_how_to_connect') }}</a>
target="_blank" style="margin-bottom: -20px;">{{ $t('如何连接') }}</a>
<div class="wave-pan" style="margin-left: -30px;">
<svg id="login-wave" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 170 70"
Expand Down Expand Up @@ -233,7 +236,12 @@ export default defineComponent({
savePassword: false
},
viewerOpt: { inline: false, button: false, title: false, navbar: false, toolbar: { prev: true, rotateLeft: true, reset: true, rotateRight: true, next: true } },
viewerBody: undefined as HTMLDivElement | undefined
viewerBody: undefined as HTMLDivElement | undefined,
fps: {
last: Date.now(),
ticks: 0,
value: 0
}
}
},
methods: {
Expand Down Expand Up @@ -299,6 +307,24 @@ export default defineComponent({
}
},
/**
* 刷新页面 fps 数据
* @param timestamp 时间戳
*/
rafLoop() {
this.fps.ticks += 1
//每30帧统计一次帧率
if (this.fps.ticks >= 30) {
const now = Date.now()
const diff = now - this.fps.last
const fps = Math.round(1000 / (diff / this.fps.ticks))
this.fps.last = now
this.fps.ticks = 0
this.fps.value = fps
}
requestAnimationFrame(this.rafLoop)
},
/**
* 切换聊天对象状态
* @param data 切换信息
Expand Down Expand Up @@ -374,11 +400,11 @@ export default defineComponent({
Option.save('save_password', true)
// 创建提示弹窗
const popInfo = {
title: this.$t('popbox_tip'),
html: `<span>${this.$t('auto_connect_tip')}</span>`,
title: this.$t('提醒'),
html: `<span>${this.$t('连接密钥将以明文存储在浏览器 Cookie 中,请确保设备安全以防止密钥泄漏。')}</span>`,
button: [
{
text: app.config.globalProperties.$t('btn_know'),
text: app.config.globalProperties.$t('知道了'),
master: true,
fun: () => { runtimeData.popBoxList.shift() }
}
Expand Down Expand Up @@ -464,6 +490,8 @@ export default defineComponent({
document.title = 'Stapxs QQ Lite (Dev)'
// 布局检查工具
Spacing.start()
// FPS 检查
this.rafLoop()
}
// 加载设置项
runtimeData.sysConfig = Option.load()
Expand All @@ -477,6 +505,10 @@ export default defineComponent({
if(app) app.classList.add('withBar')
}
Option.runAS('opt_auto_gtk', Option.get('opt_auto_gtk'))
// 基础初始化完成
logger.debug('欢迎使用 Stapxs QQ Lite!')
logger.debug('当前启动模式为: ' + process.env.NODE_ENV)
// 加载额外样式
App.loadAppendStyle()
// 加载密码保存和自动连接
Expand All @@ -490,8 +522,6 @@ export default defineComponent({
}
// =========================================================================
// 初始化完成
logger.debug(this.$t('log_welcome'))
logger.debug(this.$t('log_runtime') + ': ' + process.env.NODE_ENV)
// UM:加载 Umami 统计功能
if (!Option.get('close_ga') && process.env.NODE_ENV == 'production') {
// 给页面添加一个来源域名方便在 electron 中获取
Expand All @@ -504,7 +534,7 @@ export default defineComponent({
}
Umami.initialize(config)
} else if (process.env.NODE_ENV == 'development') {
logger.debug(this.$t('log_GA_auto_closed'))
logger.debug('由于运行在调试模式下,分析组件并未加载 ……')
}
App.checkUpdate() // 检查更新
App.checkOpenTimes() // 检查打开次数
Expand Down
30 changes: 26 additions & 4 deletions src/assets/css/append/append_new.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,23 @@
}

.mumber-info > div:first-child {
padding: 10px;
padding: 15px;
}
.mumber-info > div:first-child > div {
margin-left: 15px;
}
.mumber-info > div:first-child > div > div > a {
font-size: 0.8rem;
}
.mumber-info > div:first-child img {
height: 45px;
width: 45px;
height: 35px;
width: 35px;
}
.mumber-info > div:first-child > div > span {
font-size: 0.75rem;
}
.mumber-info > div:first-child > div > div > div > span {
font-size: 0.6rem;
}

.chat-pan {
Expand Down Expand Up @@ -161,11 +173,14 @@
height: 15px;
margin: 7px;
}

.search-tag.show {
margin: 10px 20px 10px 20px !important;
}
.replay-tag.show {
margin: 10px 20px 0 20px;
margin-top: 10px;
}

.face-pan {
border: 1px solid var(--color-card-2);
}
Expand Down Expand Up @@ -219,6 +234,9 @@
height: 30px;
width: 30px;
}
.message-body > span {
font-size: 0.6rem;
}
.message-body > a {
font-size: 0.8rem;

Expand Down Expand Up @@ -703,6 +721,10 @@
font-size: 0.75rem;
}

.update-info > div.info {
font-size: 0.8rem;
}

@media (max-width: 700px) {
.main-body > ul {
background: var(--color-card-2) !important;
Expand Down
Loading

0 comments on commit bd26484

Please sign in to comment.