mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add originalLiveroom (#2133)
This commit is contained in:
parent
d5742130e3
commit
8d83d55fe3
28
registry/lib/components/live/original/Widget.vue
Normal file
28
registry/lib/components/live/original/Widget.vue
Normal file
@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<a :href="url" target="_blank" tabindex="-1">
|
||||
<DefaultWidget
|
||||
name="返回原版直播间"
|
||||
icon="mdi-arrow-left-circle-outline"
|
||||
/>
|
||||
</a>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { DefaultWidget } from '@/ui'
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
DefaultWidget,
|
||||
},
|
||||
data() {
|
||||
const match = document.URL.match(/^https:\/\/live\.bilibili\.com\/([\d]+)/)
|
||||
if (!match) {
|
||||
return {
|
||||
href: document.URL,
|
||||
}
|
||||
}
|
||||
return {
|
||||
href: `https://live.bilibili.com/blanc/${match[1]}`,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
16
registry/lib/components/live/original/index.ts
Normal file
16
registry/lib/components/live/original/index.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { defineComponentMetadata } from '@/components/define'
|
||||
|
||||
export const component = defineComponentMetadata({
|
||||
name: 'originalLiveroom',
|
||||
displayName: '返回原版直播间',
|
||||
description: '在直播间中提供返回原版直播间的按钮, 原版直播间将无视活动皮肤, 强制使用标准的直播页面.',
|
||||
tags: [componentsTags.live],
|
||||
entry: none,
|
||||
urlInclude: [
|
||||
// 不能直接用 liveUrls, 那个是带 blanc 检测的
|
||||
/^https:\/\/live\.bilibili\.com\/[\d]+/,
|
||||
],
|
||||
widget: {
|
||||
component: () => import('./Widget.vue').then(m => m.default),
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user