Skip to content
Merged

7.2.9 #623

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
68774ae
📃 docs(CONTRIBUTING): 修正目录结构部分说明
andywang425 May 10, 2026
e484946
🔧 build: 更新依赖与相关配置
andywang425 May 10, 2026
0b4d844
📃 docs(CLAUDE.md): 精简文档
andywang425 May 10, 2026
c0d5285
📃 docs(CONTRIBUTING.md): 优化格式
andywang425 May 10, 2026
e2d66fa
🐞 fix: 修改【移除直播画面上方杂项】的CSS选择器
andywang425 May 12, 2026
8a976e1
📃 docs(CLAUDE.md): 精简文档,避免过度束缚模型
andywang425 May 12, 2026
8601895
✨ feat: 删除【移除排行榜】和【移除礼物栏下方推荐直播间】模块
andywang425 May 12, 2026
0252462
✨ feat(API): getActivatedMedalInfo
andywang425 May 17, 2026
1a63bf6
✨ feat: 适配新版粉丝团任务
andywang425 May 19, 2026
f65bae9
🐳 chore: UI相关优化
andywang425 May 20, 2026
5ceb331
🎈 perf: 粉丝勋章任务代码优化
andywang425 May 21, 2026
616a1e8
🐞 fix: isNowIn函数参数为跨天时间段时判断有误
andywang425 May 21, 2026
6316f2f
🐞 fix: 修复Default_FansMedals模块短时间内多次rerun会重复运行的bug
andywang425 May 21, 2026
6bde3d9
🐞 fix: 修复编辑名单弹窗表格bug
andywang425 May 21, 2026
b9f93df
✨ feat(MedalModule): 优化获取粉丝勋章任务信息的缓存和防风控逻辑
andywang425 May 21, 2026
6da8523
📃 docs: README
andywang425 May 21, 2026
6549543
🐳 chore(medalTasks): 增加日志,文本优化,减点赞API间隔
andywang425 May 22, 2026
0ea7a9b
🎈 perf: 避免粉丝团任务模块无效重复获取粉丝勋章
andywang425 May 22, 2026
1b7aadf
✨ feat: 领取年度大会员权益支持领取超级大会员专属权益
andywang425 May 22, 2026
0f226f1
📃 docs: 补充点亮熄灭勋章内置说明
andywang425 May 22, 2026
598149d
🎈 perf: 使用cookieStore重构Cookie工具类
andywang425 May 22, 2026
27cc8e8
📃 docs: 补CHANGELOG
andywang425 May 22, 2026
c2096b5
🐳 chore: 观看直播模块不再试图从url中提取分区信息(总是用API获取)
andywang425 May 23, 2026
7bc2666
🐞 fix: 修改弹幕发送结果判断条件
andywang425 May 23, 2026
44de610
🎈 perf: 粉丝勋章相关代码优化
andywang425 May 24, 2026
85af210
✨ feat: 优化弹幕补发机制,达到一定失败次数跳过当前勋章
andywang425 May 24, 2026
3f80a04
🐳 chore: 更新前准备
andywang425 May 24, 2026
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
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

end_of_line = lf
max_line_length = 100
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

## [Unreleased]

## [7.2.9] - 2026-5-24

### 新增

- 适配新版粉丝团任务,新增【点赞】和【发弹幕】任务
- 【领取年度大会员权益】支持领取超级大会员专属权益

### 修复

- 修复【移除直播画面上方杂项】失效的bug
- 修复跨天时间段判断错误导致部分任务在午夜附近表现异常的bug
- 修复弹幕发送结果判定不正确的bug

### 调整

- 粉丝团任务【点亮熄灭勋章】、【点赞】、【发弹幕】和【观看直播】均拥有自己的黑白名单,互不影响
- 【点亮熄灭勋章】和【发弹幕】分别拥有自己的弹幕配置
- 💻 Cookie 工具类使用 `cookieStore` 重构

### 删除

- 删除【移除排行榜】(排行榜现在包含在“直播画面上方杂项”中)和【移除礼物栏下方推荐直播间】(B站已下线该功能)模块

## [7.2.8] - 2026-5-9

### 修复
Expand Down
84 changes: 21 additions & 63 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,38 @@
# CLAUDE.md
# 项目概述

本文件为 AI 助手在本仓库中工作时提供指引
BLTH(Bilibili Live Tasks Helper)是基于 Vue 3 + Vite + vite-plugin-monkey + Element Plus + TypeScript 的用户脚本,运行在 Bilibili 直播页面(`live.bilibili.com/直播间号`),实现自动完成每日任务、观看体验优化和页面元素清理

## 项目概述

BLTH(Bilibili Live Tasks Helper)是一个基于 Vue 3 + Vite 的浏览器用户脚本,运行在 Bilibili 直播页面(如 `live.bilibili.com/直播间号`),通过 Tampermonkey/Violentmonkey 实现直播相关每日任务、观看体验优化和页面元素清理。

## 常用命令
# 常用命令

```sh
npm run dev # 启动 Vite 开发服务器(watch 模式生成用户脚本)
npm run build # 类型检查 + 构建并压缩(并行)
npm run build-only # 仅构建,不做类型检查和压缩
npm run dev # 启动 Vite 开发服务器(watch模式生成用户脚本)
npm run build # type-check 与 build+minify 并行
npm run type-check # 仅 Vue TypeScript 类型检查
npm run lint # ESLint + Stylelint 自动修复
npm run format # 使用 Prettier 格式化 src/
npm run preview # 提供编译产物安装链接的本地预览页
```

本项目没有自动化测试。

## 架构

### 模块系统

所有功能以模块形式实现,继承自 [src/modules/BaseModule.ts](src/modules/BaseModule.ts)。由 `useModuleStore` 管理生命周期。

模块分类:

- `default/` — 默认模块,负责获取用户信息、Cookie、粉丝勋章等基础数据;多数业务模块依赖其结果,但部分体验优化模块会更早运行
- `dailyTasks/` — 每日任务(主站任务、直播任务、其他任务)
- `enhanceExperience/` — 体验优化
- `removeElement/` — 移除页面元素

模块通常通过各级 `index.ts` 桶文件导出;其中 `src/modules/index.ts` 只导出非默认模块。
无自动化测试。

### 新增模块流程
# 架构

1. 在 `src/modules/` 对应子目录下创建继承 `BaseModule` 的模块类
2. 在 `src/types/storage.d.ts` 的 `ModuleConfig` 中添加类型定义
3. 在 `src/library/storage/defaultValues.ts` 中添加默认配置
4. 如需调用新的 B 站 API,在 `src/library/bili-api/` 中补充实现,以及请求/响应类型定义
5. 完成模块类后,在对应的 `index.ts` 桶文件中导出
6. 在 `src/components/` 对应组件中添加 UI
7. 每日任务通常还需在 `useModuleStore` 中添加状态和重置逻辑
8. 如模块需要尽早执行、跨页面执行或限定 frame,检查并设置 `BaseModule` 的静态属性(如 `runAt`、`onFrame`、`runAfterDefault`、`runOnMultiplePages`)
- 所有功能模块继承 `src/modules/BaseModule.ts`,由 `useModuleStore` 管理生命周期
- `main.ts` 分两阶段加载模块:先加载早期模块,再在 `document-body` 后加载默认模块
- 脚本分为三类:Main,SubMain,Other。同时打开多个直播间页面时,`useCacheStore.checkCurrentScriptType()` 会选出唯一 Main,避免部分模块重复执行

### 状态管理(Pinia Stores)
# 分支

- `useBiliStore` — B 站用户数据(uid、硬币、勋章、动态视频等)
- `useCacheStore` — 脚本运行时状态,检测主/副脚本类型以防多标签页重复执行
- `useModuleStore` — 模块注册、生命周期、配置持久化、状态跟踪与重置
- `useUIStore` — 控制面板 UI 状态
- `usePlayerStore` — 直播播放器状态
- `master`:发布分支。合并来自 `dev` 的 PR 后触发 GitHub Actions 自动构建并创建 Release
- `dev`:开发分支。非发布 PR 的目标分支

### 存储
# 规范

通过 `GM_getValue`/`GM_setValue` 持久化 `ui`、`modules` 和 `cache` 数据([src/library/storage/](src/library/storage/))。

### 构建

[vite.config.ts](vite.config.ts) 使用 `vite-plugin-monkey` 生成 `.user.js` 用户脚本。外部依赖通过 CDN `@require` 引入而非打包。新增第三方库必须加到 `vite.config.ts` 的 `externalGlobals` 或 `externalResource` 中。

### 路径别名

`@/` 映射到 `src/`。

## 分支策略

- `master`:发布分支;合并来自 `dev` 的 PR 后由 GitHub Actions 构建并创建 Release
- `dev`:开发分支,所有 PR 以 `dev` 为目标
- `src/library/bili-api/` 中的 API 必须有详细的请求/响应类型定义
- 路径别名 `@/` 映射到 `src/`
- Commit message 使用约定式提交格式

## 代码规范
# 易踩坑点

- Vue 3 Composition API + `<script setup>` 语法
- TypeScript strict 模式;`any` 允许使用但应尽量避免
- CSS 类名遵循 BEM 命名(Stylelint 强制)
- 未使用的变量以 `_` 前缀命名
- `src/library/bili-api/` 中的 API 必须编写详细的请求/响应类型定义
- Commit message 使用约定式提交格式
- 新增第三方库须在 `vite.config.ts` 的 `externalGlobals` / `externalResource` 中通过 `@require` / `@resource` 引入,不打包进脚本
- 调试 `runAt: 'document-start'` 等早期模块时 dev 模式注入太晚,请用 `npm run build` 的产物测试
22 changes: 10 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ npm run dev
```
BLTH
├─.vscode
├─dist 仅存在于master分支,存放Github Actions编译得到的用户脚本
├─node_modules
├─notes 用来记录些东西,提交时会被忽略
├─dist npm run build 得到的用户脚本
├─scripts 一些npm scripts,通过 npm run ... 调用
└─src
├─assets 资源文件
Expand All @@ -87,7 +85,7 @@ BLTH

假设现在B站给主站每日任务新添加了一个任务:给视频点赞。

首先打开 modules 文件夹,你会发现已经有了 dailyTasks/mainSiteTasks 这个文件夹,那么你只需在这个文件夹下新建一个 ts 文件即可。内容大概如下:
首先打开 `src/modules` 文件夹,你会发现已经有了 `dailyTasks/mainSiteTasks` 这个文件夹,那么你只需在这个文件夹下新建一个 ts 文件即可。内容大概如下:

```ts
import BaseModule from '@/modules/BaseModule'
Expand All @@ -100,21 +98,21 @@ class LikeTask extends BaseModule {
export default LikeTask
```

可以参考已经写好的模块,尤其是 dailyTasks/mainSiteTasks 中的那几个,注释写得很详细
具体写法可以参考已经写好的模块

你写的这个模块肯定会有相关的配置项(至少得有一个开启/关闭的选项吧),打开 types/storage.d.ts,加上该模块配置信息的类型声明。
你写的这个模块肯定会有相关的配置项(至少得有一个开启/关闭的选项吧),打开 `src/types/storage.d.ts`,加上该模块配置信息的类型声明。

接着打开 library/storage/defaultValue.ts,加上该模块配置信息的默认值。
接着打开 `src/library/storage/defaultValue.ts`,加上该模块配置信息的默认值。

点赞涉及到对B站API的请求。在 library/bili-api 中找找看有没有给视频点赞的API,如果没有得自己添加。参考已有的API即可。
点赞涉及到对B站API的请求。在 `src/library/bili-api` 中找找看有没有给视频点赞的API,如果没有得自己添加。参考已有的API即可。

点赞的视频从哪来?如果仔细阅读代码你会发现 useBiliStore 的 dynamicVideos 里已经存储了许多动态视频,你可以直接用。如果有特殊需求,自己获取视频当然也是可以的。
点赞的视频从哪来?如果仔细阅读代码你会发现 `src/stores/useBiliStore``dynamicVideos` 里已经存储了许多动态视频,你可以直接用。如果有特殊需求,自己获取视频当然也是可以的。

完成模块的编写后,在 dailyTasks/mainSiteTasks/index.ts 中添加新模块的导出。
完成模块的编写后,在 `src/modules/dailyTasks/mainSiteTasks/index.ts` 中添加新模块的导出。

因为脚本已经有了主站任务界面 components/MainSiteTasks.vue,所以你只需要在该组件中加上新功能的 UI 即可。
因为脚本已经有了主站任务界面 `src/components/MainSiteTasks.vue`,所以你只需要在该组件中加上新功能的 UI 即可。

为了更好的用户体验,建议加上帮助信息(Info组件)、模块状态和模块再运行功能(TaskStatus组件)。参考已有的模块即可。
为了更好的用户体验,建议加上帮助信息(`Info` 组件)、模块状态和模块再运行功能(`TaskStatus` 组件)。参考已有的模块即可。

## 代码风格

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
- 一个旋转的加载中图标:该任务正在执行中。
- 没有图标:该功能不显示任务状态、功能未开启或该任务正在等待即将到来的下一次运行。
- 打开某一项功能后,如果你希望它立刻执行,需要刷新页面。
但是刷新页面会打断目前正在执行的任务,下次运行时能否根据上次的进度继续执行取决于功能模块的具体实现(目前大部分都不行)。
但是刷新页面会打断目前正在执行的任务,下次运行时能否根据上次的进度继续执行取决于功能模块的具体实现(目前仅观看直播模块支持)。
建议首次使用时仔细阅读各项功能的说明,然后一次完成所有功能的设置。
- 打开多个直播间页面时,每日任务中的功能仅会在第一个直播间页面生效以防止任务被重复执行。体验优化、移除元素中的功能总是会生效。
- 每日任务中大部分任务的任务周期是从每天半夜00:05到下一个半夜00:05,即只要过了每天的00:05就会自动执行下一轮。有个别任务的周期是每天早上08:05到下一个早上08:05
- 每日任务中大部分任务的任务周期是每天半夜00:05到下一个半夜00:05,即只要过了每天的00:05就会自动执行下一轮。
- 控制台日志:如果想查看控制台日志,请打开浏览器的开发者工具(快捷键`ctrl+shift+i`或`F12`)并切换到控制台(`Console`)。开头为`BLTH`的日志即为脚本日志。
部分日志可能只有高级用户才看得懂,大家各取所需看自己想看的即可。善用过滤(`Filter`)和搜索(快捷键`ctrl+f`)功能。

# 兼容性

[BLTH](https://github.com/andywang425/BLTH)在设计上希望与[Bilibili Evolved](https://github.com/the1812/Bilibili-Evolved)和[bilibili 直播净化](https://greasyfork.org/zh-CN/scripts/21416-bilibili%E7%9B%B4%E6%92%AD%E5%87%80%E5%8C%96)兼容,即三个脚本能同时正常运行。

如果你发现存在兼容性问题可以[新建一个空白issue](https://github.com/andywang425/BLTH/issues/new)来反馈。
如果你发现存在兼容性问题可以[创建一个issue](https://github.com/andywang425/BLTH/issues/new?template=bug_report.yaml)来反馈。

# 反馈

如果想反馈 Bug 或者提出建议,请点击[new issue](https://github.com/andywang425/BLTH/issues/new/choose)然后选择对应的 issue 模板。
如果想反馈 Bug 或者提出建议,请在[Issues](https://github.com/andywang425/BLTH/issues)页面点击[New issue](https://github.com/andywang425/BLTH/issues/new/choose)然后选择对应的 issue 模板。

为了方便管理issue,请在 GreasyFork 安装脚本的用户尽量到 Github 反馈。

Expand Down Expand Up @@ -108,8 +108,8 @@
- [Github](https://github.com/lzghzr/TampermonkeyJS/blob/master/BiLiveNoVIP/BiLiveNoVIP.user.js)
- [GreasyFork](https://greasyfork.org/zh-CN/scripts/21416-bilibili%E7%9B%B4%E6%92%AD%E5%87%80%E5%8C%96)

## 新 B 站粉丝牌助手
## 新 B 站粉丝牌助手(持续更新版)

作者:[一心向晚](https://github.com/XiaoMiku01)
作者:[飞小RAN](https://github.com/xiaofeiTM233) (原作者:[一心向晚](https://github.com/XiaoMiku01)

- [Github](https://github.com/XiaoMiku01/fansMedalHelper)
- [Github](https://github.com/xiaofeiTM233/fansMedalHelper)([原仓库](https://github.com/XiaoMiku01/fansMedalHelper)已归档)
4 changes: 2 additions & 2 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { globalIgnores } from 'eslint/config'
import { includeIgnoreFile } from '@eslint/compat'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import skipFormatting from 'eslint-config-prettier/flat'
import path from 'node:path'

// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
Expand All @@ -15,7 +15,7 @@ const gitignorePath = path.resolve(import.meta.dirname, '.gitignore')
export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
files: ['**/*.{vue,ts,mts,tsx}'],
},

globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
Expand Down
Loading
Loading