mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
fix: update API endpoint and fix queue ID generation logic
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// oxlint-disable no-unused-expressions
|
||||
<script setup lang="ts">
|
||||
import type { FetcherStatisticData } from './data/models'
|
||||
|
||||
@@ -169,7 +170,6 @@ async function setCookieCloud() {
|
||||
let uptimeTimer: number | undefined
|
||||
let epsTimer: number | undefined
|
||||
let lastEventCount = 0
|
||||
let networkPollTimer: number | undefined
|
||||
|
||||
// --- Computed Properties ---
|
||||
const isConnected = computed(() => webfetcher.state === 'connected')
|
||||
@@ -544,7 +544,6 @@ onMounted(async () => {
|
||||
onUnmounted(() => {
|
||||
clearInterval(uptimeTimer)
|
||||
clearInterval(epsTimer)
|
||||
clearInterval(networkPollTimer)
|
||||
// Clean up login timers if component unmounts during login
|
||||
clearInterval(timer.value)
|
||||
clearTimeout(expiredTimer.value)
|
||||
|
||||
9
src/components.d.ts
vendored
9
src/components.d.ts
vendored
@@ -19,13 +19,22 @@ declare module 'vue' {
|
||||
LiveInfoContainer: typeof import('./components/LiveInfoContainer.vue')['default']
|
||||
MonacoEditorComponent: typeof import('./components/MonacoEditorComponent.vue')['default']
|
||||
NAlert: typeof import('naive-ui')['NAlert']
|
||||
NAvatar: typeof import('naive-ui')['NAvatar']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCard: typeof import('naive-ui')['NCard']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||
NFlex: typeof import('naive-ui')['NFlex']
|
||||
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
||||
NGridItem: typeof import('naive-ui')['NGridItem']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
NText: typeof import('naive-ui')['NText']
|
||||
NTime: typeof import('naive-ui')['NTime']
|
||||
PointGoodsItem: typeof import('./components/manage/PointGoodsItem.vue')['default']
|
||||
PointHistoryCard: typeof import('./components/manage/PointHistoryCard.vue')['default']
|
||||
PointOrderCard: typeof import('./components/manage/PointOrderCard.vue')['default']
|
||||
|
||||
@@ -5,7 +5,7 @@ const debugAPI
|
||||
= import.meta.env.VITE_API == 'dev'
|
||||
? import.meta.env.VITE_DEBUG_DEV_API
|
||||
: import.meta.env.VITE_DEBUG_RELEASE_API
|
||||
const releseAPI = `https://vtsuru.suki.club/`
|
||||
const releseAPI = `https://api.vtsuru.suki.club/`
|
||||
const failoverAPI = `https://failover-api.vtsuru.suki.club/`
|
||||
|
||||
export const isBackendUsable = ref(true)
|
||||
|
||||
@@ -65,10 +65,10 @@ const obsScrollSpeedMultiplierRef = ref(1)
|
||||
const volumn = useStorage('Settings.Volumn', 0.5)
|
||||
|
||||
// 使用composable管理歌曲请求核心逻辑
|
||||
const songRequest = useLiveRequest()
|
||||
const liveRequest = useLiveRequest()
|
||||
|
||||
// 提供activeSongs给子组件
|
||||
provide('activeSongs', songRequest.activeSongs)
|
||||
provide('activeSongs', liveRequest.activeSongs)
|
||||
|
||||
// 控制歌曲请求功能开关
|
||||
async function onUpdateFunctionEnable() {
|
||||
@@ -82,7 +82,7 @@ async function onUpdateFunctionEnable() {
|
||||
accountInfo.value.settings.enableFunctions.push(FunctionTypes.LiveRequest)
|
||||
}
|
||||
if (!accountInfo.value.settings.songRequest.orderPrefix) {
|
||||
accountInfo.value.settings.songRequest.orderPrefix = songRequest.defaultPrefix
|
||||
accountInfo.value.settings.songRequest.orderPrefix = liveRequest.defaultPrefix
|
||||
}
|
||||
await SaveEnableFunctions(accountInfo.value?.settings.enableFunctions)
|
||||
.then((data) => {
|
||||
@@ -110,7 +110,7 @@ async function onUpdateFunctionEnable() {
|
||||
// 更新歌曲请求设置
|
||||
async function updateSettings() {
|
||||
if (accountInfo.value.id) {
|
||||
songRequest.isLoading = true
|
||||
liveRequest.isLoading = true
|
||||
await SaveSetting('SongRequest', accountInfo.value.settings.songRequest)
|
||||
.then((msg) => {
|
||||
if (msg) {
|
||||
@@ -121,7 +121,7 @@ async function updateSettings() {
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
songRequest.isLoading = false
|
||||
liveRequest.isLoading = false
|
||||
})
|
||||
} else {
|
||||
message.success('完成')
|
||||
@@ -130,26 +130,23 @@ async function updateSettings() {
|
||||
|
||||
// 生命周期钩子
|
||||
onMounted(() => {
|
||||
if (accountInfo.value.id) {
|
||||
accountInfo.value.settings.songRequest = accountInfo.value.settings.songRequest
|
||||
}
|
||||
client.onEvent('danmaku', songRequest.onGetDanmaku)
|
||||
client.onEvent('sc', songRequest.onGetSC)
|
||||
songRequest.init()
|
||||
client.onEvent('danmaku', liveRequest.onGetDanmaku)
|
||||
client.onEvent('sc', liveRequest.onGetSC)
|
||||
liveRequest.init()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
songRequest.init()
|
||||
liveRequest.init()
|
||||
})
|
||||
|
||||
onDeactivated(() => {
|
||||
songRequest.dispose()
|
||||
liveRequest.dispose()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
client.offEvent('danmaku', songRequest.onGetDanmaku)
|
||||
client.offEvent('sc', songRequest.onGetSC)
|
||||
songRequest.dispose()
|
||||
client.offEvent('danmaku', liveRequest.onGetDanmaku)
|
||||
client.offEvent('sc', liveRequest.onGetSC)
|
||||
liveRequest.dispose()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -206,7 +203,7 @@ onUnmounted(() => {
|
||||
OBS 组件
|
||||
</NButton>
|
||||
</template>
|
||||
{{ songRequest.configCanEdit ? '' : '登陆后才可以使用此功能' }}
|
||||
{{ liveRequest.configCanEdit ? '' : '登陆后才可以使用此功能' }}
|
||||
</NTooltip>
|
||||
</NSpace>
|
||||
</NCard>
|
||||
@@ -224,12 +221,12 @@ onUnmounted(() => {
|
||||
<!-- 歌曲播放器 -->
|
||||
<Transition>
|
||||
<div
|
||||
v-if="songRequest.selectedSong"
|
||||
v-if="liveRequest.selectedSong"
|
||||
class="song-list"
|
||||
>
|
||||
<SongPlayer
|
||||
v-model:is-lrc-loading="songRequest.isLrcLoading"
|
||||
:song="songRequest.selectedSong"
|
||||
v-model:is-lrc-loading="liveRequest.isLrcLoading"
|
||||
:song="liveRequest.selectedSong"
|
||||
/>
|
||||
<NDivider style="margin: 15px 0 15px 0" />
|
||||
</div>
|
||||
@@ -239,12 +236,12 @@ onUnmounted(() => {
|
||||
<SongRequestList
|
||||
@update:sort-type="(value: any) => { accountInfo.settings.songRequest.sortType = value; updateSettings() }"
|
||||
@update:is-reverse="(value: any) => {
|
||||
if (songRequest.configCanEdit) {
|
||||
if (liveRequest.configCanEdit) {
|
||||
accountInfo.settings.songRequest.isReverse = value
|
||||
updateSettings()
|
||||
}
|
||||
else {
|
||||
songRequest.isReverse = value
|
||||
liveRequest.isReverse = value
|
||||
}
|
||||
}"
|
||||
/>
|
||||
|
||||
@@ -314,7 +314,7 @@ async function add(danmaku: EventModel) {
|
||||
} as DanmakuUserInfo,
|
||||
createAt: Date.now(),
|
||||
isInLocal: true,
|
||||
id: localQueues.value.length == 0 ? 1 : new List(localQueues.value).Max(s => s.id) + 1, // 本地 ID
|
||||
id: localQueues.value.length == 0 ? 1 : (new List(localQueues.value).Max(s => s.id) ?? 0) + 1, // 本地 ID
|
||||
} as ResponseQueueModel
|
||||
localQueues.value.unshift(songData) // 添加到本地队列开头
|
||||
message.success(`[${danmaku.uname}] 添加至本地队列`)
|
||||
@@ -352,7 +352,7 @@ async function addManual() {
|
||||
user: { name: newQueueName.value } as DanmakuUserInfo,
|
||||
createAt: Date.now(),
|
||||
isInLocal: true,
|
||||
id: localQueues.value.length == 0 ? 1 : new List(localQueues.value).Max(s => s.id) + 1,
|
||||
id: localQueues.value.length == 0 ? 1 : (new List(localQueues.value).Max(s => s.id) ?? 0) + 1,
|
||||
} as ResponseQueueModel
|
||||
localQueues.value.unshift(songData)
|
||||
message.success(`已手动添加用户至队列: ${newQueueName.value}`)
|
||||
|
||||
Reference in New Issue
Block a user