update url

This commit is contained in:
2023-12-14 12:56:28 +08:00
parent 4ab1f6da4f
commit 82a0e72122
39 changed files with 299 additions and 350 deletions

View File

@@ -197,10 +197,10 @@ export default class DanmakuClient {
}
private sendHeartbeat() {
if (this.client) {
const query = this.authInfo ? QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat', this.authInfo) : QueryGetAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat-internal')
const query = this.authInfo ? QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL() + 'heartbeat', this.authInfo) : QueryGetAPI<OpenLiveInfo>(OPEN_LIVE_API_URL() + 'heartbeat-internal')
query.then((data) => {
if (data.code != 200) {
console.error('[OPEN-LIVE] 心跳失败: ' + data.message)
console.error('[OPEN-LIVE] 心跳失败')
this.client.stop()
this.client = null
this.initClient()
@@ -267,7 +267,7 @@ export default class DanmakuClient {
}
private async getAuthInfo(): Promise<{ data: OpenLiveInfo | null; message: string }> {
try {
const data = await QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'start', this.authInfo?.Code ? this.authInfo : undefined)
const data = await QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL() + 'start', this.authInfo?.Code ? this.authInfo : undefined)
if (data.code == 200) {
console.log('[OPEN-LIVE] 已获取场次信息')
return {
@@ -275,15 +275,12 @@ export default class DanmakuClient {
message: '',
}
} else {
console.error('无法获取场次数据: ' + data.message)
return {
data: null,
message: data.message,
}
}
} catch (err) {
console.error(err)
return {
data: null,
message: err?.toString() || '未知错误',

View File

@@ -1,33 +1,35 @@
import { defineAsyncComponent, ref } from 'vue'
import { computed, defineAsyncComponent, ref, watchEffect } from 'vue'
const debugAPI = import.meta.env.VITE_DEBUG_API
const releseAPI = `https://vtsuru.suki.club/api/`
const failoverAPI = `https://failover-api.vtsuru.live/api/`
export const isBackendUsable = ref(true)
export const AVATAR_URL = 'https://workers.vrp.moe/api/bilibili/avatar/'
export const apiFail = ref(false)
export const BASE_API = process.env.NODE_ENV === 'development' ? debugAPI : releseAPI
export const BASE_API = () => (process.env.NODE_ENV === 'development' ? debugAPI : apiFail.value ? failoverAPI : releseAPI)
export const FETCH_API = 'https://fetch.vtsuru.live/'
export const TURNSTILE_KEY = '0x4AAAAAAAETUSAKbds019h0'
export const USER_API_URL = `${BASE_API}user/`
export const ACCOUNT_API_URL = `${BASE_API}account/`
export const BILI_API_URL = `${BASE_API}bili/`
export const SONG_API_URL = `${BASE_API}song-list/`
export const NOTIFACTION_API_URL = `${BASE_API}notifaction/`
export const QUESTION_API_URL = `${BASE_API}qa/`
export const LOTTERY_API_URL = `${BASE_API}lottery/`
export const HISTORY_API_URL = `${BASE_API}history/`
export const SCHEDULE_API_URL = `${BASE_API}schedule/`
export const VIDEO_COLLECT_API_URL = `${BASE_API}video-collect/`
export const OPEN_LIVE_API_URL = `${BASE_API}open-live/`
export const SONG_REQUEST_API_URL = `${BASE_API}song-request/`
export const QUEUE_API_URL = `${BASE_API}queue/`
export const EVENT_API_URL = `${BASE_API}event/`
export const LIVE_API_URL = `${BASE_API}live/`
export const FEEDBACK_API_URL = `${BASE_API}feedback/`
export const USER_API_URL = () => `${BASE_API()}user/`
export const ACCOUNT_API_URL = () => `${BASE_API()}account/`
export const BILI_API_URL = () => `${BASE_API()}bili/`
export const SONG_API_URL = () => `${BASE_API()}song-list/`
export const NOTIFACTION_API_URL = () => `${BASE_API()}notifaction/`
export const QUESTION_API_URL = () => `${BASE_API()}qa/`
export const LOTTERY_API_URL = () => `${BASE_API()}lottery/`
export const HISTORY_API_URL = () => `${BASE_API()}history/`
export const SCHEDULE_API_URL = () => `${BASE_API()}schedule/`
export const VIDEO_COLLECT_API_URL = () => `${BASE_API()}video-collect/`
export const OPEN_LIVE_API_URL = () => `${BASE_API()}open-live/`
export const SONG_REQUEST_API_URL = () => `${BASE_API()}song-request/`
export const QUEUE_API_URL = () => `${BASE_API()}queue/`
export const EVENT_API_URL = () => `${BASE_API()}event/`
export const LIVE_API_URL = () => `${BASE_API()}live/`
export const FEEDBACK_API_URL = () => `${BASE_API()}feedback/`
export const ScheduleTemplateMap = {
'': { name: '默认', compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')) },

View File

@@ -10,7 +10,7 @@ const n = ref<NotifactionInfo>()
let isLoading = false
function get() {
if (isLoading) return
QueryGetAPI<NotifactionInfo>(SONG_REQUEST_API_URL + 'get-active')
QueryGetAPI<NotifactionInfo>(SONG_REQUEST_API_URL() + 'get-active')
.then((data) => {
if (data.code == 200) {
n.value = data.data