Fix live url (fix #5306)

This commit is contained in:
the1812 2025-08-29 08:25:10 +08:00
parent 6aded9e0e8
commit 300d535b0a
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { defineComponentMetadata } from '@/components/define'
import { getUID } from '@/core/utils'
import { liveUrls } from '@/core/utils/urls'
export const component = defineComponentMetadata({
name: 'badgeKeepalive',
@ -16,5 +17,5 @@ export const component = defineComponentMetadata({
component: () => import('./BadgeKeepalive.vue').then(m => m.default),
condition: () => Boolean(getUID()),
},
urlInclude: ['//live.bilibili.com'],
urlInclude: liveUrls,
})

View File

@ -3,8 +3,8 @@ import { getCsrf, getUID } from '@/core/utils'
// 获取当前直播间号
export function getLiveRoomId(): string {
const matched = location.href.match(/live.bilibili.com\/(\d+)/)
return matched ? matched[1] : ''
const matched = location.href.match(/live.bilibili.com\/(blanc\/)?(\d+)/)
return matched ? matched[2] : ''
}
export function validateRoomId(value: string): boolean {