From 82248e0cbf248d2706242511dc57a74902d1bba5 Mon Sep 17 00:00:00 2001 From: the1812 Date: Tue, 25 Feb 2025 23:03:21 +0800 Subject: [PATCH 01/40] Update docs --- doc/features/features.json | 8 -------- doc/features/features.md | 9 --------- 2 files changed, 17 deletions(-) diff --git a/doc/features/features.json b/doc/features/features.json index 02fb9781f..a2a2c170d 100644 --- a/doc/features/features.json +++ b/doc/features/features.json @@ -823,14 +823,6 @@ "fullRelativePath": "../../registry/dist/components/video/player/disable-scroll-volume.js", "fullAbsolutePath": "registry/dist/components/video/player/disable-scroll-volume.js" }, - { - "type": "component", - "name": "doubleClickFullscreen", - "displayName": "双击全屏", - "description": "为视频播放器启用双击全屏功能, 请注意不能和 `启用双击控制` 一同使用.", - "fullRelativePath": "../../registry/dist/components/video/player/double-click-fullscreen.js", - "fullAbsolutePath": "registry/dist/components/video/player/double-click-fullscreen.js" - }, { "type": "component", "name": "extendVideoSpeed", diff --git a/doc/features/features.md b/doc/features/features.md index 0d202253e..b3b98e776 100644 --- a/doc/features/features.md +++ b/doc/features/features.md @@ -1133,15 +1133,6 @@ by [@WakelessSloth56](https://github.com/WakelessSloth56),[@LainIO24](https://gi 在网页全屏 / 全屏模式下, 禁止鼠标滚轮控制播放器的音量. 请注意不能和 `反转滚轮调音量` 一同使用. -### [双击全屏](../../registry/dist/components/video/player/double-click-fullscreen.js) -`doubleClickFullscreen` - -**jsDelivr:** [`Stable`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@master/registry/dist/components/video/player/double-click-fullscreen.js) / [`Preview`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/registry/dist/components/video/player/double-click-fullscreen.js) - -**GitHub:** [`Stable`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/registry/dist/components/video/player/double-click-fullscreen.js) / [`Preview`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/registry/dist/components/video/player/double-click-fullscreen.js) - -为视频播放器启用双击全屏功能, 请注意不能和 `启用双击控制` 一同使用. - ### [扩展倍速](../../registry/dist/components/video/player/extend-speed.js) `extendVideoSpeed` From f7e57f2dde712940858c1ca881d72e7360d0d0f3 Mon Sep 17 00:00:00 2001 From: magicFeirl <2100709458@qq.com> Date: Sat, 15 Mar 2025 16:00:26 +0800 Subject: [PATCH 02/40] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=B2=89?= =?UTF-8?q?=E4=B8=9D=E5=8B=8B=E7=AB=A0=E7=82=B9=E4=BA=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/badge-keepalive/BadgeKeepalive.vue | 56 +++++++++++++++++++ .../components/live/badge-keepalive/index.md | 1 + .../components/live/badge-keepalive/index.ts | 16 ++++++ .../components/live/badge-keepalive/utils.ts | 55 ++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue create mode 100644 registry/lib/components/live/badge-keepalive/index.md create mode 100644 registry/lib/components/live/badge-keepalive/index.ts create mode 100644 registry/lib/components/live/badge-keepalive/utils.ts diff --git a/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue b/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue new file mode 100644 index 000000000..a5aebf649 --- /dev/null +++ b/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue @@ -0,0 +1,56 @@ + + + + + \ No newline at end of file diff --git a/registry/lib/components/live/badge-keepalive/index.md b/registry/lib/components/live/badge-keepalive/index.md new file mode 100644 index 000000000..4c032ff2c --- /dev/null +++ b/registry/lib/components/live/badge-keepalive/index.md @@ -0,0 +1 @@ +在直播间页面的功能面板添加一键点亮粉丝勋章功能,仅适用于有粉丝勋章且正在直播的直播间。原理:发送一个 300 次点赞的请求点亮粉丝勋章。 \ No newline at end of file diff --git a/registry/lib/components/live/badge-keepalive/index.ts b/registry/lib/components/live/badge-keepalive/index.ts new file mode 100644 index 000000000..ee83483af --- /dev/null +++ b/registry/lib/components/live/badge-keepalive/index.ts @@ -0,0 +1,16 @@ +import { defineComponentMetadata } from '@/components/define' +import { getUID } from '@/core/utils' + +export const component = defineComponentMetadata({ + name: 'badgeKeepalive', + displayName: '一键点亮直播间粉丝勋章', + entry: () => {}, + reload: none, + unload: none, + tags: [componentsTags.live], + condition: () => Boolean(getUID()), + widget: { + component: () => import('./BadgeKeepalive.vue').then(m => m.default), + }, + urlInclude: ['//live.bilibili.com'], +}) diff --git a/registry/lib/components/live/badge-keepalive/utils.ts b/registry/lib/components/live/badge-keepalive/utils.ts new file mode 100644 index 000000000..2175dc5d8 --- /dev/null +++ b/registry/lib/components/live/badge-keepalive/utils.ts @@ -0,0 +1,55 @@ +import { postTextWithCredentials, getJsonWithCredentials } from '@/core/ajax' +import { getCsrf, getUID } from '@/core/utils' + +// 获取当前直播间号 +export function getLiveRoomId(): string { + const matched = location.href.match(/live.bilibili.com\/(\d+)/) + return matched ? matched[1] : '' +} + +export function validateRoomId(value: string): boolean { + return /^\d+$/.test(value) +} + +function validateJSON(data: object) { + if (data['code'] !== 0) { + throw data['message'] + } + + return data['data'] +} + +export async function getLiveRoomUserInfo(room_id: string) { + const data = await getJsonWithCredentials( + `https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByUser?room_id=${room_id}`, + ) + + return validateJSON(data) +} + +export async function keepAliveRequest(room_id: string, click_time = '300') { + // 需要先获取直播间房主的 UID + const data = await getLiveRoomUserInfo(room_id) + + const curr_weared = data['medal']['curr_weared'] + if (!curr_weared) { + throw `暂未获得直播间 ${room_id} 的粉丝勋章` + } + + const anchor_id = curr_weared['target_id'] + + const params = { + click_time, + room_id, + anchor_id, + uid: getUID(), + csrf: getCsrf(), + } + + const baseURL = + 'https://api.live.bilibili.com/xlive/app-ucenter/v1/like_info_v3/like/likeReportV3' + + return validateJSON( + JSON.parse(await postTextWithCredentials(baseURL, new URLSearchParams(params))), + ) +} From 3b1d1b087e8bd06001daaea578b2c2a525f6f404 Mon Sep 17 00:00:00 2001 From: magicFeirl <2100709458@qq.com> Date: Sun, 16 Mar 2025 14:20:19 +0800 Subject: [PATCH 03/40] =?UTF-8?q?fix:=20lint=E7=9B=B8=E5=85=B3=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/badge-keepalive/BadgeKeepalive.vue | 69 ++++++++++--------- .../components/live/badge-keepalive/index.ts | 4 +- .../components/live/badge-keepalive/utils.ts | 14 ++-- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue b/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue index a5aebf649..cca759be4 100644 --- a/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue +++ b/registry/lib/components/live/badge-keepalive/BadgeKeepalive.vue @@ -1,56 +1,61 @@ \ No newline at end of file + diff --git a/registry/lib/components/live/badge-keepalive/index.ts b/registry/lib/components/live/badge-keepalive/index.ts index ee83483af..c5b7bc1c5 100644 --- a/registry/lib/components/live/badge-keepalive/index.ts +++ b/registry/lib/components/live/badge-keepalive/index.ts @@ -4,13 +4,13 @@ import { getUID } from '@/core/utils' export const component = defineComponentMetadata({ name: 'badgeKeepalive', displayName: '一键点亮直播间粉丝勋章', - entry: () => {}, + entry: none, reload: none, unload: none, tags: [componentsTags.live], - condition: () => Boolean(getUID()), widget: { component: () => import('./BadgeKeepalive.vue').then(m => m.default), + condition: () => Boolean(getUID()), }, urlInclude: ['//live.bilibili.com'], }) diff --git a/registry/lib/components/live/badge-keepalive/utils.ts b/registry/lib/components/live/badge-keepalive/utils.ts index 2175dc5d8..90fed1e04 100644 --- a/registry/lib/components/live/badge-keepalive/utils.ts +++ b/registry/lib/components/live/badge-keepalive/utils.ts @@ -11,12 +11,12 @@ export function validateRoomId(value: string): boolean { return /^\d+$/.test(value) } -function validateJSON(data: object) { - if (data['code'] !== 0) { - throw data['message'] +function validateJSON(data) { + if (data.code !== 0) { + throw new Error(data.message) } - return data['data'] + return data.data } export async function getLiveRoomUserInfo(room_id: string) { @@ -31,12 +31,12 @@ export async function keepAliveRequest(room_id: string, click_time = '300') { // 需要先获取直播间房主的 UID const data = await getLiveRoomUserInfo(room_id) - const curr_weared = data['medal']['curr_weared'] + const { curr_weared } = data.medal if (!curr_weared) { - throw `暂未获得直播间 ${room_id} 的粉丝勋章` + throw new Error(`暂未获得直播间 ${room_id} 的粉丝勋章`) } - const anchor_id = curr_weared['target_id'] + const anchor_id = curr_weared.target_id const params = { click_time, From 7099bf9c06d967ff2e7fe3e46affc123e66ad706 Mon Sep 17 00:00:00 2001 From: pencilqaq <2845525241@qq.com> Date: Fri, 21 Mar 2025 07:56:09 +0800 Subject: [PATCH 04/40] =?UTF-8?q?feat(components):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BDup=E4=B8=BB=E4=B8=93=E5=B1=9E=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E5=8C=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/download-emoticons/Widget.vue | 64 +++++++++++ .../utils/download-emoticons/emoticons.ts | 108 ++++++++++++++++++ .../utils/download-emoticons/index.md | 3 + .../utils/download-emoticons/index.ts | 20 ++++ 4 files changed, 195 insertions(+) create mode 100644 registry/lib/components/utils/download-emoticons/Widget.vue create mode 100644 registry/lib/components/utils/download-emoticons/emoticons.ts create mode 100644 registry/lib/components/utils/download-emoticons/index.md create mode 100644 registry/lib/components/utils/download-emoticons/index.ts diff --git a/registry/lib/components/utils/download-emoticons/Widget.vue b/registry/lib/components/utils/download-emoticons/Widget.vue new file mode 100644 index 000000000..1ddde2490 --- /dev/null +++ b/registry/lib/components/utils/download-emoticons/Widget.vue @@ -0,0 +1,64 @@ + + + diff --git a/registry/lib/components/utils/download-emoticons/emoticons.ts b/registry/lib/components/utils/download-emoticons/emoticons.ts new file mode 100644 index 000000000..e22d8ae46 --- /dev/null +++ b/registry/lib/components/utils/download-emoticons/emoticons.ts @@ -0,0 +1,108 @@ +import { monkey } from '@/core/ajax' +import { useScopedConsole } from '@/core/utils/log' + +const logger = useScopedConsole('表情包下载') + +interface DownloadPromise { + pkg_name: string // 表情包名称 + emoticons: { emoji: string; blob: Promise }[] +} + +export class Emoticons { + private async getEmoticonsByRoomId(roomId: string) { + const response = await this.apiRequest( + `https://api.live.bilibili.com/xlive/web-ucenter/v2/emoticon/GetEmoticons?platform=pc&room_id=${roomId}`, + ) + return response + } + async downloadEmoticons(emoticonsArray) { + const downloadPromises: DownloadPromise[] = emoticonsArray.map(obj => { + const emoticons = obj.emoticons.map(item => { + try { + const blob = this.getImageBlob(item.url) + return { + emoji: item.emoji, + blob, + } + } catch (error) { + logger.error(`下载表情 ${item.emoji} 失败:`, error) + return null + } + }) + return { + emoticons, + pkg_name: obj.pkg_name, + } + }) + return downloadPromises + } + + async getEmoticonsArray(roomId: string): Promise> { + try { + let response = await this.getEmoticonsByRoomId(roomId) + if (response.data.data.length === 0) { + logger.log('获取表情包失败,尝试获取真实roomId') + const realRoomId = await this.getRealRoomId(roomId) + response = await this.getEmoticonsByRoomId(realRoomId) + } + return response.data.data.filter( + item => item.pkg_name === 'UP主大表情' || item.pkg_name === '房间专属表情', + ) + } catch (error) { + throw new Error('获取表情包失败') + } + } + + async batchDownload(tasks: DownloadPromise[]) { + const results: any[] = [] + for (const task of tasks) { + const promise = (async () => { + const blobs: Blob[] = [] + const blobPromises = task.emoticons.map(e => e.blob) + for (const blobPromise of blobPromises) { + const blob = await blobPromise + blobs.push(blob) + } + return { + pkg_name: task.pkg_name, + emoticons: task.emoticons.map((e, i) => ({ emoji: e.emoji, blob: blobs[i] })), + } + })() + results.push(promise) + } + return Promise.all(results) + } + + // 有的直播间id是超短id,需要获取到原始的roomid才能通过api获取到表情包 + async getRealRoomId(rid: string): Promise { + try { + const response = await this.apiRequest( + `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${rid}`, + ) + if (Object.keys(response.data).length === 0) { + throw new Error('获取直播间id失败') + } + return response.data.room_id + } catch (error) { + throw new Error('获取直播间id失败') + } + } + + apiRequest = (url: string): Promise => { + const details: MonkeyXhrBasicDetails = { + url, + method: 'GET', + responseType: 'json', + } + return monkey(details) + } + + getImageBlob = async (url: string) => { + const details: MonkeyXhrBasicDetails = { + url, + method: 'GET', + responseType: 'blob', + } + return monkey(details) + } +} diff --git a/registry/lib/components/utils/download-emoticons/index.md b/registry/lib/components/utils/download-emoticons/index.md new file mode 100644 index 000000000..7afd6ff1b --- /dev/null +++ b/registry/lib/components/utils/download-emoticons/index.md @@ -0,0 +1,3 @@ +## 下载up主专属表情包 + +支持下载up主专属表情包,处于任意直播间页面时,下载按钮会在`功能`面板显示,以压缩包形式保存。 \ No newline at end of file diff --git a/registry/lib/components/utils/download-emoticons/index.ts b/registry/lib/components/utils/download-emoticons/index.ts new file mode 100644 index 000000000..4fb20f855 --- /dev/null +++ b/registry/lib/components/utils/download-emoticons/index.ts @@ -0,0 +1,20 @@ +import { defineComponentMetadata } from '@/components/define' + +export const component = defineComponentMetadata({ + name: 'downloadEmoticons', + displayName: '下载表情', + tags: [componentsTags.utils, componentsTags.live], + entry: none, + author: { + name: 'Pencilqaq', + link: 'https://github.com/pencilqaq', + }, + widget: { + component: () => import('./Widget.vue').then(m => m.default), + }, + urlInclude: [/^https:\/\/live\.bilibili\.com\/(\d+)/], +}) + +// https://api.bilibili.com/x/space/acc/info?mid=387636363 + +// https://api.live.bilibili.com/ajax/msg?roomid=21013446 From 2fcbd4f9e655e051169d8cb1ef095f4de4d08057 Mon Sep 17 00:00:00 2001 From: magicFeirl <2100709458@qq.com> Date: Fri, 21 Mar 2025 14:06:17 +0800 Subject: [PATCH 05/40] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E4=BD=9C?= =?UTF-8?q?=E8=80=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registry/lib/components/live/badge-keepalive/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registry/lib/components/live/badge-keepalive/index.ts b/registry/lib/components/live/badge-keepalive/index.ts index c5b7bc1c5..208ba0a5b 100644 --- a/registry/lib/components/live/badge-keepalive/index.ts +++ b/registry/lib/components/live/badge-keepalive/index.ts @@ -7,6 +7,10 @@ export const component = defineComponentMetadata({ entry: none, reload: none, unload: none, + author: { + name: "magicFeirl", + link: "https://github.com/magicFeirl" + }, tags: [componentsTags.live], widget: { component: () => import('./BadgeKeepalive.vue').then(m => m.default), From 72cef751bdcb8e8d29fc172fe7cdfecb1d370232 Mon Sep 17 00:00:00 2001 From: pencilqaq <2845525241@qq.com> Date: Fri, 21 Mar 2025 20:50:40 +0800 Subject: [PATCH 06/40] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=A1=A8=E6=83=85?= =?UTF-8?q?=E5=8C=85=E7=AD=9B=E9=80=89=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=96=87=E6=9C=AC=E9=94=99=E8=AF=AF=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registry/lib/components/utils/download-emoticons/Widget.vue | 2 +- registry/lib/components/utils/download-emoticons/emoticons.ts | 4 +--- registry/lib/components/utils/download-emoticons/index.ts | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/registry/lib/components/utils/download-emoticons/Widget.vue b/registry/lib/components/utils/download-emoticons/Widget.vue index 1ddde2490..56068784f 100644 --- a/registry/lib/components/utils/download-emoticons/Widget.vue +++ b/registry/lib/components/utils/download-emoticons/Widget.vue @@ -1,7 +1,7 @@