添加客户端

This commit is contained in:
2025-04-06 13:50:16 +08:00
parent 4476be60b5
commit d5c9e663da
32 changed files with 4462 additions and 443 deletions

View File

@@ -1,30 +0,0 @@
<script setup lang="ts">
import { useAccount } from '@/api/account';
import { useWebFetcher } from '@/store/useWebFetcher';
import {fetch} from "@tauri-apps/plugin-http";
import { NFlex } from 'naive-ui';
const webfetcher = useWebFetcher();
const accountInfo = useAccount();
function initWebfetcher() {
webfetcher.Start();
webfetcher.signalRClient?.send();
}
onMounted(() => {
if (accountInfo.value.id) {
initWebfetcher();
console.info('WebFetcher started')
}
})
</script>
<template>
<NFlex v-if="!accountInfo.id">
<RegisterAndLogin />
</NFlex>
<NFlex v-else>
{{ webfetcher }}
</NFlex>
</template>

View File

@@ -31,7 +31,7 @@ onMounted(async () => {
rpc.expose('status', () => {
return {
status: webFetcher.isStarted ? 'running' : 'stopped',
status: webFetcher.state,
type: webFetcher.client?.type,
roomId: webFetcher.client instanceof OpenLiveClient ?
webFetcher.client.roomAuthInfo?.anchor_info.room_id :
@@ -44,7 +44,8 @@ onMounted(async () => {
rpc.expose('start', async (data: { type: 'openlive' | 'direct', directAuthInfo?: DirectClientAuthInfo, force: boolean }) => {
console.log('[web-fetcher-iframe] 接收到 ' + (data.force ? '强制' : '') + '启动请求')
if (data.force && webFetcher.isStarted) {
if (data.force && webFetcher.state === 'connected') {
console.log('[web-fetcher-iframe] 强制启动, 停止当前实例')
webFetcher.Stop()
}
return await webFetcher.Start(data.type, data.directAuthInfo, true).then((result) => {
@@ -73,9 +74,9 @@ onMounted(async () => {
}
setTimeout(() => {
// @ts-expect-error obs的东西
if (!webFetcher.isStarted && window.obsstudio) {
if (webFetcher.state !== 'connected' && window.obsstudio) {
timer = setInterval(() => {
if (webFetcher.isStarted) {
if (webFetcher.state === 'connected') {
return
}
@@ -99,7 +100,7 @@ onUnmounted(() => {
<div
class="web-fetcher-status"
:style="{
backgroundColor: webFetcher.isStarted ? '#6dc56d' : '#e34a4a',
backgroundColor: webFetcher.state === 'connected' ? '#6dc56d' : '#e34a4a',
}"
/>
</template>

View File

@@ -644,8 +644,9 @@ export const Config = defineTemplateConfig([
</n-flex>
<!-- Song Table -->
<div
<NScrollbar
class="song-table-wrapper"
trigger="none"
:style="{ height: props.config?.fixedHeight ? '55vh' : 'none' }"
>
<table class="song-list-table">
@@ -739,7 +740,7 @@ export const Config = defineTemplateConfig([
</tr>
</tbody>
</table>
</div>
</NScrollbar>
</div>
</div>
</div>
@@ -1116,7 +1117,7 @@ html.dark .song-list-container {
/* min-height: 200px; */ /* Might not be needed if max-height is set */
border-radius: 8px;
/* Scrollbar styling specific to this inner table scroll if needed */
/* ... */
scroll-behavior: smooth;
}