fix read danmaku

This commit is contained in:
2025-01-19 14:59:20 +08:00
parent 02e24a5783
commit 5e570531f1
5 changed files with 17 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { isDarkMode } from '@/Utils' import { isDarkMode } from '@/Utils'
import { ThemeType } from '@/api/api-models' import { ThemeType } from '@/api/api-models'
import DanmakuClient, { AuthInfo } from '@/data/DanmakuClient' import { AuthInfo } from '@/data/DanmakuClients/OpenLiveClient'
import { useDanmakuClient } from '@/store/useDanmakuClient' import { useDanmakuClient } from '@/store/useDanmakuClient'
import { Lottery24Filled, PeopleQueue24Filled, TabletSpeaker24Filled } from '@vicons/fluent' import { Lottery24Filled, PeopleQueue24Filled, TabletSpeaker24Filled } from '@vicons/fluent'
import { Moon, MusicalNote, Sunny } from '@vicons/ionicons5' import { Moon, MusicalNote, Sunny } from '@vicons/ionicons5'
@@ -39,7 +39,7 @@ const sider = ref()
const { width } = useElementSize(sider) const { width } = useElementSize(sider)
const authInfo = ref<AuthInfo>() const authInfo = ref<AuthInfo>()
const danmakuClient = useDanmakuClient() const danmakuClient = await useDanmakuClient().initClient()
const menuOptions = [ const menuOptions = [
{ {
@@ -125,13 +125,8 @@ onUnmounted(() => {
<NResult status="error" title="无效访问"> <NResult status="error" title="无效访问">
<template #footer> <template #footer>
请前往 请前往
<NButton <NButton text type="primary" tag="a" href="https://play-live.bilibili.com/details/1698742711771"
text target="_blank">
type="primary"
tag="a"
href="https://play-live.bilibili.com/details/1698742711771"
target="_blank"
>
幻星平台 | VTsuru 幻星平台 | VTsuru
</NButton> </NButton>
并点击 获取 , 再点击 获取 H5 插件链接来获取可用链接 并点击 获取 , 再点击 获取 H5 插件链接来获取可用链接
@@ -148,12 +143,8 @@ onUnmounted(() => {
<NTag :type="danmakuClient.connected ? 'success' : 'warning'"> <NTag :type="danmakuClient.connected ? 'success' : 'warning'">
{{ danmakuClient.connected ? `已连接 | ${danmakuClient.authInfo?.anchor_info?.uname}` : '未连接' }} {{ danmakuClient.connected ? `已连接 | ${danmakuClient.authInfo?.anchor_info?.uname}` : '未连接' }}
</NTag> </NTag>
<NSwitch <NSwitch :default-value="!isDarkMode" @update:value="(value: string & number & boolean) => (themeType = value ? ThemeType.Light : ThemeType.Dark)
:default-value="!isDarkMode" ">
@update:value="
(value: string & number & boolean) => (themeType = value ? ThemeType.Light : ThemeType.Dark)
"
>
<template #checked> <template #checked>
<NIcon :component="Sunny" /> <NIcon :component="Sunny" />
</template> </template>
@@ -173,29 +164,15 @@ onUnmounted(() => {
</NPageHeader> </NPageHeader>
</NLayoutHeader> </NLayoutHeader>
<NLayout has-sider style="height: calc(100vh - 45px - 30px)"> <NLayout has-sider style="height: calc(100vh - 45px - 30px)">
<NLayoutSider <NLayoutSider bordered ref="sider" show-trigger default-collapsed collapse-mode="width" :collapsed-width="64"
bordered :width="180" :native-scrollbar="false" style="height: 100%">
ref="sider"
show-trigger
default-collapsed
collapse-mode="width"
:collapsed-width="64"
:width="180"
:native-scrollbar="false"
style="height: 100%"
>
<Transition> <Transition>
<div v-if="danmakuClient.authInfo" style="margin-top: 8px"> <div v-if="danmakuClient.authInfo" style="margin-top: 8px">
<NSpace vertical justify="center" align="center"> <NSpace vertical justify="center" align="center">
<NAvatar <NAvatar :src="danmakuClient.authInfo?.anchor_info?.uface" :img-props="{ referrerpolicy: 'no-referrer' }"
:src="danmakuClient.authInfo?.anchor_info?.uface" round bordered :style="{
:img-props="{ referrerpolicy: 'no-referrer' }"
round
bordered
:style="{
boxShadow: isDarkMode ? 'rgb(195 192 192 / 35%) 0px 0px 8px' : '0 2px 3px rgba(0, 0, 0, 0.1)', boxShadow: isDarkMode ? 'rgb(195 192 192 / 35%) 0px 0px 8px' : '0 2px 3px rgba(0, 0, 0, 0.1)',
}" }" />
/>
<NEllipsis v-if="width > 100" style="max-width: 100%"> <NEllipsis v-if="width > 100" style="max-width: 100%">
<NText strong> <NText strong>
{{ danmakuClient.authInfo?.anchor_info?.uname }} {{ danmakuClient.authInfo?.anchor_info?.uname }}
@@ -204,12 +181,8 @@ onUnmounted(() => {
</NSpace> </NSpace>
</div> </div>
</Transition> </Transition>
<NMenu <NMenu :default-value="$route.name?.toString()" :collapsed-width="64" :collapsed-icon-size="22"
:default-value="$route.name?.toString()" :options="menuOptions" />
:collapsed-width="64"
:collapsed-icon-size="22"
:options="menuOptions"
/>
<NSpace justify="center"> <NSpace justify="center">
<NText depth="3" v-if="width > 150"> <NText depth="3" v-if="width > 150">
有更多功能建议请 有更多功能建议请

View File

@@ -16,7 +16,7 @@ const inputMsg = ref('')
const isMaster = computed(() => { const isMaster = computed(() => {
return route.query.slave == null || route.query.slave == undefined return route.query.slave == null || route.query.slave == undefined
}) })
const dc = useDanmakuClient() const dc = await useDanmakuClient().initClient()
const customCss = ref('') const customCss = ref('')
let rtc= useWebRTC() let rtc= useWebRTC()

View File

@@ -84,7 +84,7 @@ const route = useRoute()
const message = useMessage() const message = useMessage()
const accountInfo = useAccount() const accountInfo = useAccount()
const notification = useNotification() const notification = useNotification()
const client = useDanmakuClient() const client = await useDanmakuClient().initClient()
const originUsers = ref<OpenLiveLotteryUserInfo[]>([]) const originUsers = ref<OpenLiveLotteryUserInfo[]>([])
const currentUsers = ref<OpenLiveLotteryUserInfo[]>([]) const currentUsers = ref<OpenLiveLotteryUserInfo[]>([])

View File

@@ -113,7 +113,7 @@ const route = useRoute()
const accountInfo = useAccount() const accountInfo = useAccount()
const message = useMessage() const message = useMessage()
const notice = useNotification() const notice = useNotification()
const client = useDanmakuClient() const client = await useDanmakuClient().initClient()
const isWarnMessageAutoClose = useStorage('Queue.Settings.WarnMessageAutoClose', false) const isWarnMessageAutoClose = useStorage('Queue.Settings.WarnMessageAutoClose', false)
const isReverse = useStorage('Queue.Settings.Reverse', false) const isReverse = useStorage('Queue.Settings.Reverse', false)

View File

@@ -74,7 +74,7 @@ type SpeechInfo = {
const accountInfo = useAccount() const accountInfo = useAccount()
const message = useMessage() const message = useMessage()
const route = useRoute() const route = useRoute()
const client = useDanmakuClient() const client = await useDanmakuClient().initClient()
const settings = useStorage<SpeechSettings>('Setting.Speech', { const settings = useStorage<SpeechSettings>('Setting.Speech', {
speechInfo: { speechInfo: {
volume: 1, volume: 1,