Compare commits

...

9 Commits

Author SHA1 Message Date
b8b73ba6f2 add cn host 2025-03-18 23:33:49 +08:00
31f765277a fix hubs url 2025-03-18 22:58:19 +08:00
3d42dd1884 add allow anonymous user add liverequest 2025-03-18 22:42:18 +08:00
e0add9edbe fix url 2025-03-18 21:29:35 +08:00
e00447497b fix webfetcher iframe detect 2025-03-18 21:00:06 +08:00
e2ff1616b8 fix loading display 2025-03-18 20:54:28 +08:00
36526af71c fix action 2025-03-18 20:50:12 +08:00
a4a45bba1c try fix url construct 2025-03-18 20:48:14 +08:00
1b6ec67ba8 update build action 2025-03-18 20:42:25 +08:00
28 changed files with 382 additions and 246 deletions

View File

@@ -22,3 +22,5 @@ jobs:
run: bun install
- name: 📦 Build
run: bun run build
- name: 📦 Upload SourceMap
run: bunx @hyperdx/cli upload-sourcemaps --serviceKey ${{ secrets.HYPERDX_SERVICE_KEY }} --path dist/assets

BIN
bun.lockb

Binary file not shown.

View File

@@ -10,6 +10,7 @@
},
"dependencies": {
"@hyperdx/browser": "^0.21.2",
"@hyperdx/cli": "^0.1.0",
"@microsoft/signalr": "^8.0.7",
"@microsoft/signalr-protocol-msgpack": "^8.0.7",
"@mixer/postmessage-rpc": "^1.1.4",

View File

@@ -1,5 +1,5 @@
import { ExtendedDock24Filled } from "@vicons/fluent"
import { UserConsumptionSetting } from "./models/consumption"
import { ExtendedDock24Filled } from '@vicons/fluent'
import { UserConsumptionSetting } from './models/consumption'
export interface APIRoot<T> {
code: number
@@ -13,16 +13,16 @@ export interface PaginationResponse<T> extends APIRoot<T> {
more: boolean
}
export enum IndexTypes {
Default,
Default
}
export enum SongListTypes {
Default,
Default
}
export enum GuardLevel {
None = 0,
Zongdu = 1,
Tidu = 2,
Jianzhang = 3,
Jianzhang = 3
}
export interface UserBasicInfo {
name: string
@@ -53,7 +53,7 @@ export interface EventFetcherStateModel {
export enum EventFetcherType {
Application,
OBS,
Server,
Server
}
export interface AccountInfo extends UserInfo {
isEmailVerified: boolean
@@ -98,7 +98,7 @@ export enum BiliAuthCodeStatusType {
NotBind,
Active,
Notfound,
Inactive,
Inactive
}
export interface Setting_SendEmail {
recieveQA: boolean
@@ -134,9 +134,7 @@ export interface Setting_Index {
allowDisplayInIndex: boolean
videos: string[]
notification: string
links: {
[key: string]: string
}
links: { [key: string]: string }
}
export interface Setting_LiveRequest {
orderPrefix: string
@@ -146,6 +144,7 @@ export interface Setting_LiveRequest {
queueMaxSize: number
allowAllDanmaku: boolean
allowFromWeb: boolean
allowAnonymousFromWeb: boolean
needWearFanMedal: boolean
needJianzhang: boolean
needTidu: boolean
@@ -247,28 +246,28 @@ export interface Setting_QuestionDisplay {
export enum QuestionDisplayAlign {
Left,
Right,
Center,
Center
}
export enum SettingPointGiftAllowType {
All,
WhiteList,
WhiteList
}
export enum KeywordMatchType {
Full,
Contains,
Regex,
Regex
}
export enum QueueSortType {
GuardFirst,
PaymentFist,
TimeFirst,
FansMedalFirst,
FansMedalFirst
}
export enum QueueGiftFilterType {
Or,
And,
And
}
export enum FunctionTypes {
SongList,
@@ -277,7 +276,7 @@ export enum FunctionTypes {
SongRequest,
Queue,
Point,
VideoCollect,
VideoCollect
}
export interface SongAuthorInfo {
name: string
@@ -287,7 +286,7 @@ export enum SongFrom {
Custom,
Netease,
FiveSing,
Kugou,
Kugou
}
export interface SongsInfo {
id: number
@@ -319,13 +318,13 @@ export enum SongLanguage {
Japanese, // 日文
Spanish, // 西班牙文
French, // 法文
Other, //其他
Other //其他
}
export enum LevelTypes {
Info,
Success,
Warn,
Error,
Error
}
export interface NotifactionInfo {
id: string
@@ -342,7 +341,7 @@ export enum ViolationTypes {
PORNOGRAPHY,
POLITICS,
ADVERTISING,
AGGRESSION,
AGGRESSION
}
export type QAReviewInfo = {
isApproved: boolean
@@ -396,7 +395,7 @@ export interface ScheduleDayInfo {
export enum ThemeType {
Auto = 'auto',
Light = 'light',
Dark = 'dark',
Dark = 'dark'
}
export interface VideoCollectCreateModel {
id?: string
@@ -430,12 +429,12 @@ export interface VideoCollectVideo {
}
export enum VideoFrom {
Collect,
Spam,
Spam
}
export enum VideoStatus {
Pending,
Accepted,
Rejected,
Rejected
}
export interface VideoSender {
sendAt: number
@@ -487,7 +486,7 @@ export interface OpenLiveLotteryUserInfo {
}
export enum OpenLiveLotteryType {
Waiting,
Result,
Result
}
export interface UpdateLiveLotteryUsersModel {
users: OpenLiveLotteryUserInfo[]
@@ -522,26 +521,26 @@ export enum SongRequestFrom {
Danmaku,
SC,
Web,
Gift,
Gift
}
export enum QueueFrom {
Manual,
Danmaku,
Gift,
Web,
Web
}
export enum SongRequestStatus {
Waiting,
Singing,
Finish,
Cancel,
Cancel
}
export enum QueueStatus {
Waiting,
Progressing,
Finish,
Cancel,
Cancel
}
export interface EventModel {
type: EventDataTypes
@@ -567,7 +566,7 @@ export enum EventDataTypes {
Message,
Like,
SCDel,
Enter,
Enter
}
export interface ResponseQueueModel {
id: number
@@ -620,7 +619,7 @@ export enum FeedbackType {
Opinion,
Bug,
FunctionRequest,
Other,
Other
}
export enum FeedbackStatus {
Padding,
@@ -628,7 +627,7 @@ export enum FeedbackStatus {
Finish,
Todo,
Reject,
Developing,
Developing
}
export interface TagInfo {
name: string
@@ -637,11 +636,11 @@ export interface TagInfo {
export enum GoodsStatus {
Normal, // 商品正常
//OutOfStock, // 商品无货
Discontinued, // 商品下架
Discontinued // 商品下架
}
export enum GoodsTypes {
Physical,
Virtual,
Virtual
}
export interface PointGoodsSetting {
guardFree?: { year: number; month: number }
@@ -757,7 +756,7 @@ export interface ResponsePointOrder2UserModel {
export enum PointOrderStatus {
Pending, // 订单正在等待处理
Shipped, // 订单已发货
Completed, // 订单已完成
Completed // 订单已完成
}
export interface ResponsePointHisrotyModel {
point: number
@@ -773,13 +772,11 @@ export interface ResponsePointHisrotyModel {
export enum PointFrom {
Danmaku,
Manual,
Use,
Use
}
export interface ResponseUserIndexModel {
notification: string
videos: VideoCollectVideo[]
links: {
[key: string]: string
}
links: { [key: string]: string }
}

View File

@@ -25,6 +25,7 @@ export async function QueryPostAPIWithParams<T>(
contentType?: string,
headers?: [string, string][]
): Promise<APIRoot<T>> {
// @ts-expect-error 忽略
return await QueryPostAPIWithParamsInternal<APIRoot<T>>(
urlString,
params,
@@ -40,15 +41,23 @@ async function QueryPostAPIWithParamsInternal<T>(
contentType: string = 'application/json',
headers: [string, string][] = []
) {
const url = new URL(urlString)
let url: URL
try {
url = new URL(urlString.toString())
} catch (e) {
console.error('尝试解析API地址失败: ' + urlString, e)
return {
code: 400,
message: '无效的API地址: ' + urlString,
data: {} as T
}
}
url.search = getParams(params)
headers ??= []
let h = {} as {
[key: string]: string
}
headers.forEach(header => {
let h = {} as { [key: string]: string }
headers.forEach((header) => {
h[header[0]] = header[1]
});
})
if (cookie.value) h['Authorization'] = `Bearer ${cookie.value}`
h['Content-Type'] = contentType
@@ -77,6 +86,7 @@ export async function QueryGetAPI<T>(
params?: any,
headers?: [string, string][]
): Promise<APIRoot<T>> {
// @ts-expect-error 忽略
return await QueryGetAPIInternal<APIRoot<T>>(urlString, params, headers)
}
async function QueryGetAPIInternal<T>(
@@ -85,22 +95,27 @@ async function QueryGetAPIInternal<T>(
headers?: [string, string][]
) {
try {
const url = new URL(urlString)
let url: URL
try {
url = new URL(urlString.toString())
} catch (e) {
console.error('尝试解析API地址失败: ' + urlString, e)
return {
code: 400,
message: '无效的API地址: ' + urlString,
data: {} as T
}
}
url.search = getParams(params)
headers ??= []
let h = {} as {
[key: string]: string
}
let h = {} as { [key: string]: string }
headers.forEach((header) => {
h[header[0]] = header[1]
})
if (cookie.value) {
h['Authorization'] = `Bearer ${cookie.value}`
}
return await QueryAPIInternal<T>(url, {
method: 'get',
headers: h
})
return await QueryAPIInternal<T>(url, { method: 'get', headers: h })
} catch (err) {
console.log(`url:${urlString}, error:${err}`)
throw err
@@ -133,6 +148,7 @@ export async function QueryPostPaginationAPI<T>(
url: string,
body?: unknown
): Promise<PaginationResponse<T>> {
// @ts-expect-error 忽略
return await QueryPostAPIWithParamsInternal<PaginationResponse<T>>(
url,
undefined,
@@ -143,6 +159,7 @@ export async function QueryGetPaginationAPI<T>(
urlString: string,
params?: unknown
): Promise<PaginationResponse<T>> {
// @ts-expect-error 忽略
return await QueryGetAPIInternal<PaginationResponse<T>>(urlString, params)
}
export function GetHeaders(): [string, string][] {

View File

@@ -2,7 +2,9 @@ import DefaultIndexTemplateVue from '@/views/view/indexTemplate/DefaultIndexTemp
import { defineAsyncComponent, ref } from 'vue'
const debugAPI =
import.meta.env.VITE_API == 'dev' ? import.meta.env.VITE_DEBUG_DEV_API : import.meta.env.VITE_DEBUG_RELEASE_API
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 failoverAPI = `https://failover-api.vtsuru.suki.club/`
@@ -15,68 +17,85 @@ export const THINGS_URL = FILE_BASE_URL + '/things/'
export const apiFail = ref(false)
export const BASE_URL = {
toString: () => (process.env.NODE_ENV === 'development' ? debugAPI : apiFail.value ? failoverAPI : releseAPI),
}
export const BASE_API_URL = {
toString: () => BASE_URL + 'api/',
}
export const FETCH_API = 'https://fetch.vtsuru.live/'
export const BASE_HUB_URL = {
toString: () =>
(process.env.NODE_ENV === 'development' ? debugAPI : apiFail.value ? failoverAPI : releseAPI) + 'hub/',
process.env.NODE_ENV === 'development'
? debugAPI
: apiFail.value
? failoverAPI
: releseAPI
}
export const BASE_API_URL = BASE_URL.toString() + 'api/'
export const FETCH_API = 'https://fetch.vtsuru.live/'
export const BASE_HUB_URL =
(process.env.NODE_ENV === 'development'
? debugAPI
: apiFail.value
? failoverAPI
: releseAPI) + 'hub/'
export const TURNSTILE_KEY = '0x4AAAAAAAETUSAKbds019h0'
export const CURRENT_HOST = `${window.location.protocol}//${window.location.host}/`
export const CN_HOST = 'https://cn.vtsuru.suki.club/'
export const USER_API_URL = { toString: () => `${BASE_API_URL}user/` }
export const ACCOUNT_API_URL = { toString: () => `${BASE_API_URL}account/` }
export const BILI_API_URL = { toString: () => `${BASE_API_URL}bili/` }
export const SONG_API_URL = { toString: () => `${BASE_API_URL}song-list/` }
export const NOTIFACTION_API_URL = { toString: () => `${BASE_API_URL}notifaction/` }
export const QUESTION_API_URL = { toString: () => `${BASE_API_URL}qa/` }
export const LOTTERY_API_URL = { toString: () => `${BASE_API_URL}lottery/` }
export const HISTORY_API_URL = { toString: () => `${BASE_API_URL}history/` }
export const SCHEDULE_API_URL = { toString: () => `${BASE_API_URL}schedule/` }
export const VIDEO_COLLECT_API_URL = { toString: () => `${BASE_API_URL}video-collect/` }
export const OPEN_LIVE_API_URL = { toString: () => `${BASE_API_URL}open-live/` }
export const SONG_REQUEST_API_URL = { toString: () => `${BASE_API_URL}live-request/` }
export const QUEUE_API_URL = { toString: () => `${BASE_API_URL}queue/` }
export const EVENT_API_URL = { toString: () => `${BASE_API_URL}event/` }
export const LIVE_API_URL = { toString: () => `${BASE_API_URL}live/` }
export const FEEDBACK_API_URL = { toString: () => `${BASE_API_URL}feedback/` }
export const MUSIC_REQUEST_API_URL = { toString: () => `${BASE_API_URL}music-request/` }
export const VTSURU_API_URL = { toString: () => `${BASE_API_URL}vtsuru/` }
export const POINT_API_URL = { toString: () => `${BASE_API_URL}point/` }
export const BILI_AUTH_API_URL = { toString: () => `${BASE_API_URL}bili-auth/` }
export const FORUM_API_URL = { toString: () => `${BASE_API_URL}forum/` }
export const USER_INDEX_API_URL = { toString: () => `${BASE_API_URL}user-index/` }
export const USER_API_URL = BASE_API_URL + 'user/'
export const ACCOUNT_API_URL = BASE_API_URL + 'account/'
export const BILI_API_URL = BASE_API_URL + 'bili/'
export const SONG_API_URL = BASE_API_URL + 'song-list/'
export const NOTIFACTION_API_URL = BASE_API_URL + 'notification/'
export const QUESTION_API_URL = BASE_API_URL + 'qa/'
export const LOTTERY_API_URL = BASE_API_URL + 'lottery/'
export const HISTORY_API_URL = BASE_API_URL + 'history/'
export const SCHEDULE_API_URL = BASE_API_URL + 'schedule/'
export const VIDEO_COLLECT_API_URL = BASE_API_URL + 'video-collect/'
export const OPEN_LIVE_API_URL = BASE_API_URL + 'open-live/'
export const SONG_REQUEST_API_URL = BASE_API_URL + 'live-request/'
export const QUEUE_API_URL = BASE_API_URL + 'queue/'
export const EVENT_API_URL = BASE_API_URL + 'event/'
export const LIVE_API_URL = BASE_API_URL + 'live/'
export const FEEDBACK_API_URL = BASE_API_URL + 'feedback/'
export const MUSIC_REQUEST_API_URL = BASE_API_URL + 'music-request/'
export const VTSURU_API_URL = BASE_API_URL + 'vtsuru/'
export const POINT_API_URL = BASE_API_URL + 'point/'
export const BILI_AUTH_API_URL = BASE_API_URL + 'bili-auth/'
export const FORUM_API_URL = BASE_API_URL + 'forum/'
export const USER_INDEX_API_URL = BASE_API_URL + 'user-index/'
export const ScheduleTemplateMap = {
'': {
name: '默认',
compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')),
compoent: defineAsyncComponent(
() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')
)
},
pinky: {
name: '粉粉',
compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/PinkySchedule.vue')),
},
compoent: defineAsyncComponent(
() => import('@/views/view/scheduleTemplate/PinkySchedule.vue')
)
}
} as { [key: string]: { name: string; compoent: any } }
export const SongListTemplateMap = {
'': {
name: '默认',
compoent: defineAsyncComponent(() => import('@/views/view/songListTemplate/DefaultSongListTemplate.vue')),
compoent: defineAsyncComponent(
() => import('@/views/view/songListTemplate/DefaultSongListTemplate.vue')
)
},
simple: {
name: '简单',
compoent: defineAsyncComponent(() => import('@/views/view/songListTemplate/SimpleSongListTemplate.vue')),
compoent: defineAsyncComponent(
() => import('@/views/view/songListTemplate/SimpleSongListTemplate.vue')
)
},
traditional: {
name: '传统',
compoent: defineAsyncComponent(() => import('@/views/view/songListTemplate/TraditionalSongListTemplate.vue')),
},
compoent: defineAsyncComponent(
() =>
import('@/views/view/songListTemplate/TraditionalSongListTemplate.vue')
)
}
} as { [key: string]: { name: string; compoent: any } }
export const IndexTemplateMap = {
'': { name: '默认', compoent: DefaultIndexTemplateVue },
'': { name: '默认', compoent: DefaultIndexTemplateVue }
} as { [key: string]: { name: string; compoent: any } }

View File

@@ -96,13 +96,15 @@ QueryGetAPI<string>(BASE_API_URL + 'vtsuru/version')
console.log('默认API调用失败, 切换至故障转移节点')
})
.finally(async () => {
HyperDX.init({
apiKey: '7d1eb66c-24b8-445e-a406-dc2329fa9423',
service: 'vtsuru.live',
tracePropagationTargets: [/vtsuru.suki.club/i], // Set to link traces from frontend to backend requests
consoleCapture: true, // Capture console logs (default false)
advancedNetworkCapture: true // Capture full HTTP request/response headers and bodies (default false)
})
if (process.env.NODE_ENV !== 'development') {
HyperDX.init({
apiKey: '7d1eb66c-24b8-445e-a406-dc2329fa9423',
service: 'vtsuru.live',
tracePropagationTargets: [/vtsuru.suki.club/i], // Set to link traces from frontend to backend requests
consoleCapture: true, // Capture console logs (default false)
advancedNetworkCapture: true // Capture full HTTP request/response headers and bodies (default false)
})
}
//加载其他数据
InitTTS()
await GetSelfAccount()

View File

@@ -4,9 +4,7 @@ import {
MasterRTCClient,
SlaveRTCClient
} from '@/data/RTCClient'
import { Router24Regular } from '@vicons/fluent'
import { useStorage } from '@vueuse/core'
import { nonFunctionArgSeparator } from 'html2canvas/dist/types/css/syntax/parser'
import { acceptHMRUpdate, defineStore } from 'pinia'
import { ref } from 'vue'
import { useRoute } from 'vue-router'

View File

@@ -35,6 +35,8 @@ import { NButton, NCard, NDivider, NLayoutContent, NSpace, NText, NTimeline, NTi
height="200" frameborder="0"></iframe>
<NDivider title-placement="left"> 更新日志 </NDivider>
<NTimeline>
<NTimelineItem type="info" title="功能添加" content="点歌允许从网页匿名点歌" time="2025-3-18" />
<NTimelineItem type="success" title="功能添加" content="棉花糖添加内容审查功能" time="2025-3-2" />
<NTimelineItem type="info" title="功能更新" content="允许棉花糖设置页滚动条进度同步到obs组件" time="2024-11-23" />
<NTimelineItem type="info" title="功能更新" content="礼物兑换允许上舰用户免费兑换, 以及仅允许上舰用户兑换" time="2024-4-23" />
<NTimelineItem type="info" title="功能更新" content="积分订单添加导出功能, 允许删除积分用户" time="2024-3-22" />

View File

@@ -611,7 +611,7 @@ onMounted(() => {
align-items: center;
flex-direction: column;
padding: 50px;
height: 100%;
height: 100vh;
box-sizing: border-box;
">
<template v-if="!isLoadingAccount">

View File

@@ -3,7 +3,7 @@ import { useAccount } from '@/api/account'
import { BiliAuthCodeStatusType, BiliAuthModel } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import EventFetcherStatusCard from '@/components/EventFetcherStatusCard.vue'
import { ACCOUNT_API_URL, TURNSTILE_KEY } from '@/data/constants'
import { ACCOUNT_API_URL, CN_HOST, TURNSTILE_KEY } from '@/data/constants'
import { useAuthStore } from '@/store/useAuthStore'
import { Info24Filled, Mic24Filled, Question24Regular } from '@vicons/fluent'
import { useLocalStorage } from '@vueuse/core'
@@ -286,8 +286,13 @@ onUnmounted(() => {
</script>
<template>
<NFlex justify="center" align="center" vertical>
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;" :default-value="$route.query.tab?.toString() ?? 'info'">
<NAlert type="success" style="width: 100%; ">
本站新增国内镜像: {{ CN_HOST }}, 访问更快
</NAlert>
<NDivider />
<NFlex justify="center" align="center" vertical style="margin: 0 auto; max-width: 1500px;">
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;"
:default-value="$route.query.tab?.toString() ?? 'info'">
<NTabPane name="info" tab="个人信息" style="width: 100%;" display-directive="show:lazy">
<NFlex justify="center" align="center">
<NCard embedded style="width: 100%;max-width: 800px;">

View File

@@ -2,7 +2,7 @@
import { copyToClipboard, downloadImage } from '@/Utils'
import { DisableFunction, EnableFunction, SaveSetting, useAccount } from '@/api/account'
import { FunctionTypes, QAInfo, Setting_QuestionDisplay } from '@/api/api-models'
import { CURRENT_HOST } from '@/data/constants'
import { CN_HOST, CURRENT_HOST } from '@/data/constants'
import router from '@/router'
import { Heart, HeartOutline, TrashBin } from '@vicons/ionicons5'
import QuestionItem from '@/components/QuestionItem.vue'
@@ -62,6 +62,8 @@ const shareModalVisiable = ref(false)
const replyMessage = ref()
const addTagName = ref('')
const useCNUrl = useStorage('Settings.UseCNUrl', false)
const showSettingCard = ref(true)
const showOBSModal = ref(false)
const defaultSettings = {} as Setting_QuestionDisplay
@@ -81,6 +83,7 @@ const setting = computed({
const shareCardRef = ref()
const shareUrl = computed(() => `${CURRENT_HOST}@` + accountInfo.value?.name + '/question-box')
const shareUrlCN = computed(() => CN_HOST + accountInfo.value?.name + '/question-box')
const ps = ref(20)
const pn = ref(1)
@@ -239,6 +242,17 @@ onMounted(() => {
</NTooltip>
</NAlert>
</NSpace>
<NDivider style="margin: 16px 0 16px 0" title-placement="left">
提问页链接
</NDivider>
<NFlex align="center">
<NInputGroup style="max-width: 400px;">
<NInput :value="`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/question-box`" readonly />
<NButton secondary @click="copyToClipboard(`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/question-box`)">
复制 </NButton>
</NInputGroup>
<NCheckbox v-model:checked="useCNUrl"> 使用国内镜像(访问更快) </NCheckbox>
</NFlex>
<NDivider style="margin: 10px 0 10px 0" />
<template v-if="useQB.reviewing > 0">
<NAlert type="warning" title="有提问正在审核中">
@@ -506,9 +520,14 @@ onMounted(() => {
</div>
<NDivider style="margin: 10px" />
<NInputGroup>
<NInput :value="shareUrl" />
<NInput :value="shareUrl" readonly/>
<NButton secondary @click="copyToClipboard(shareUrl)"> 复制 </NButton>
</NInputGroup>
<NDivider style="margin: 10px"> 国内镜像 (访问更快) </NDivider>
<NInputGroup>
<NInput :value="shareUrlCN" readonly />
<NButton secondary @click="copyToClipboard(shareUrlCN)"> 复制 </NButton>
</NInputGroup>
<br /><br />
<NSpace justify="center">
<NButton type="primary" @click="saveShareImage"> 保存卡片 </NButton>

View File

@@ -3,14 +3,18 @@ import { DisableFunction, EnableFunction, useAccount } from '@/api/account'
import { FunctionTypes, ScheduleWeekInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import ScheduleList from '@/components/ScheduleList.vue'
import { SCHEDULE_API_URL } from '@/data/constants'
import { CN_HOST, CURRENT_HOST, SCHEDULE_API_URL } from '@/data/constants'
import { copyToClipboard } from '@/Utils'
import { useStorage } from '@vueuse/core'
import { addWeeks, endOfWeek, endOfYear, format, isBefore, startOfWeek, startOfYear } from 'date-fns'
import {
NAlert,
NBadge,
NButton,
NCheckbox,
NColorPicker,
NDivider,
NFlex,
NInput,
NInputGroup,
NInputGroupLabel,
@@ -130,6 +134,8 @@ const showCopyModal = ref(false)
const updateScheduleModel = ref<ScheduleWeekInfo>({} as ScheduleWeekInfo)
const selectedExistTag = ref()
const useCNUrl = useStorage('Settings.UseCNUrl', false)
const selectedDay = ref(0)
const selectedScheduleYear = ref(new Date().getFullYear())
const selectedScheduleWeek = ref(Number(format(Date.now(), 'w')) + 1)
@@ -277,7 +283,17 @@ onMounted(() => {
<NButton @click="$router.push({ name: 'manage-index', query: { tab: 'template', template: 'schedule' } })">
修改模板
</NButton>
</NSpace>
</NSpace><NDivider style="margin: 16px 0 16px 0" title-placement="left">
日程表展示页链接
</NDivider>
<NFlex align="center">
<NInputGroup style="max-width: 400px;">
<NInput :value="`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/schedule`" readonly />
<NButton secondary @click="copyToClipboard(`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/schedule`)">
复制 </NButton>
</NInputGroup>
<NCheckbox v-model:checked="useCNUrl"> 使用国内镜像(访问更快) </NCheckbox>
</NFlex>
<NDivider />
<NModal v-model:show="showAddModal" style="width: 600px; max-width: 90vw" preset="card" title="添加周程">
<NSpace vertical>

View File

@@ -1,12 +1,13 @@
<script setup lang="ts">
import { objectsToCSV } from '@/Utils'
import { copyToClipboard, objectsToCSV } from '@/Utils'
import { DisableFunction, EnableFunction, useAccount } from '@/api/account'
import { FunctionTypes, SongFrom, SongLanguage, SongRequestOption, SongsInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import SongList from '@/components/SongList.vue'
import { FETCH_API, SONG_API_URL } from '@/data/constants'
import { CN_HOST, CURRENT_HOST, FETCH_API, SONG_API_URL } from '@/data/constants'
import { Info24Filled } from '@vicons/fluent'
import { ArchiveOutline } from '@vicons/ionicons5'
import { useStorage } from '@vueuse/core'
import { format } from 'date-fns'
// @ts-ignore
import { saveAs } from 'file-saver'
@@ -58,6 +59,8 @@ const neteaseIdInput = ref()
const fivesingSearchInput = ref()
const isModalLoading = ref(false)
const useCNUrl = useStorage('Settings.UseCNUrl', false)
const onlyResetNameOnAdded = ref(true)
const neteaseSongListId = computed(() => {
@@ -600,15 +603,15 @@ onMounted(async () => {
</NAlert>
<NButton @click="showModal = true" type="primary"> 添加歌曲 </NButton>
<NButton @click="exportData" type="primary" secondary> 导出为 CSV </NButton>
<NButton @click="$router.push({ name: 'manage-liveRequest' })" secondary> 前往点 </NButton>
<NButton @click="$router.push({ name: 'manage-liveRequest' })" secondary> 前往点播管理 </NButton>
<NButton @click="$router.push({ name: 'user-songList', params: { id: accountInfo?.name } })" secondary>
前往展示页
前往歌单展示页
</NButton>
<NButton :loading="isLoading" @click="() => {
getSongs()
message.success('完成')
}
">
getSongs()
message.success('完成')
}
">
刷新
</NButton>
<NButton
@@ -616,6 +619,17 @@ onMounted(async () => {
修改模板
</NButton>
</NSpace>
<NDivider style="margin: 16px 0 16px 0" title-placement="left">
歌单展示页链接
</NDivider>
<NFlex align="center">
<NInputGroup style="max-width: 400px;">
<NInput :value="`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/song-list`" readonly />
<NButton secondary @click="copyToClipboard(`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/song-list`)">
复制 </NButton>
</NInputGroup>
<NCheckbox v-model:checked="useCNUrl"> 使用国内镜像(访问更快) </NCheckbox>
</NFlex>
<NDivider style="margin: 16px 0 16px 0" />
<NModal v-model:show="showModal" style="max-width: 1000px" preset="card" :key="showModalRenderKey">
<template #header> 添加歌曲 </template>
@@ -659,15 +673,15 @@ onMounted(async () => {
</template>
<NSpace vertical>
<NCheckbox :checked="addSongModel.options != undefined" @update:checked="(checked: boolean) => {
addSongModel.options = checked
? ({
needJianzhang: false,
needTidu: false,
needZongdu: false,
} as SongRequestOption)
: undefined
}
">
addSongModel.options = checked
? ({
needJianzhang: false,
needTidu: false,
needZongdu: false,
} as SongRequestOption)
: undefined
}
">
是否启用
</NCheckbox>
<template v-if="addSongModel.options != undefined">
@@ -678,9 +692,9 @@ onMounted(async () => {
</NSpace>
<NSpace align="center">
<NCheckbox :checked="addSongModel.options.scMinPrice != undefined" @update:checked="(checked: boolean) => {
if (addSongModel.options) addSongModel.options.scMinPrice = checked ? 30 : undefined
}
">
if (addSongModel.options) addSongModel.options.scMinPrice = checked ? 30 : undefined
}
">
需要SC
</NCheckbox>
<NInputGroup v-if="addSongModel.options?.scMinPrice" style="width: 200px">
@@ -690,9 +704,9 @@ onMounted(async () => {
</NSpace>
<NSpace align="center">
<NCheckbox :checked="addSongModel.options.fanMedalMinLevel != undefined" @update:checked="(checked: boolean) => {
if (addSongModel.options) addSongModel.options.fanMedalMinLevel = checked ? 5 : undefined
}
">
if (addSongModel.options) addSongModel.options.fanMedalMinLevel = checked ? 5 : undefined
}
">
需要粉丝牌
<NTooltip>
<template #trigger>

View File

@@ -1,11 +1,11 @@
<script setup lang="ts">
import { getImageUploadModel } from '@/Utils'
import { copyToClipboard, getImageUploadModel } from '@/Utils'
import { DisableFunction, EnableFunction, useAccount } from '@/api/account'
import { FunctionTypes, GoodsStatus, GoodsTypes, PointGoodsModel, ResponsePointGoodModel } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import EventFetcherStatusCard from '@/components/EventFetcherStatusCard.vue'
import PointGoodsItem from '@/components/manage/PointGoodsItem.vue'
import { FILE_BASE_URL, POINT_API_URL } from '@/data/constants'
import { CN_HOST, CURRENT_HOST, FILE_BASE_URL, POINT_API_URL } from '@/data/constants'
import { useAuthStore } from '@/store/useAuthStore'
import { Info24Filled } from '@vicons/fluent'
import { useRouteHash } from '@vueuse/router'
@@ -25,6 +25,7 @@ import {
NImage,
NInput,
NInputNumber,
NInputGroup,
NModal,
NPopconfirm,
NRadioButton,
@@ -45,6 +46,7 @@ import { computed, onMounted, ref } from 'vue'
import PointOrderManage from './PointOrderManage.vue'
import PointSettings from './PointSettings.vue'
import PointUserManage from './PointUserManage.vue'
import { useStorage } from '@vueuse/core'
const message = useMessage()
const accountInfo = useAccount()
@@ -83,6 +85,8 @@ const showAddGoodsModal = ref(false)
const isAllowedPrivacyPolicy = ref(false)
const isUpdating = ref(false)
const useCNUrl = useStorage('Settings.UseCNUrl', false)
const allowedYearOptions = computed(() => {
//从2024到现在的年份
return Array.from({ length: new Date().getFullYear() - 2024 + 1 }, (_, i) => 2024 + i).map((item) => {
@@ -377,6 +381,17 @@ onMounted(() => { })
</NAlert>
<EventFetcherStatusCard />
</NFlex>
<NDivider style="margin: 16px 0 16px 0" title-placement="left">
礼物展示页链接
</NDivider>
<NFlex align="center">
<NInputGroup style="max-width: 400px;">
<NInput :value="`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/point`" readonly />
<NButton secondary @click="copyToClipboard(`${useCNUrl ? CN_HOST : CURRENT_HOST}@${accountInfo.name}/point`)">
复制 </NButton>
</NInputGroup>
<NCheckbox v-model:checked="useCNUrl"> 使用国内镜像(访问更快) </NCheckbox>
</NFlex>
<NDivider />
<NTabs animated v-model:value="hash">
<NTabPane name="goods" tab="礼物">

View File

@@ -47,8 +47,8 @@ defineExpose({ setCss })
const { customCss, isOBS = true } = defineProps<{
customCss?: string
isOBS?: boolean,
active: boolean,
visible: boolean,
active?: boolean,
visible?: boolean,
}>()
const messageRender = ref()

View File

@@ -88,8 +88,13 @@ async function get() {
if (data.code == 200) {
return data.data
}
} catch (err) {}
return {} as { songs: SongRequestInfo[]; setting: Setting_LiveRequest }
} catch (err) {
console.log(err)
}
return {
songs: [],
setting: {} as Setting_LiveRequest,
} as { songs: SongRequestInfo[]; setting: Setting_LiveRequest }
}
const allowGuardTypes = computed(() => {
const types = []
@@ -148,19 +153,12 @@ onUnmounted(() => {
<NDivider class="live-request-divider">
<p class="live-request-header-count">已有 {{ activeSongs.length ?? 0 }} </p>
</NDivider>
<div
class="live-request-processing-container"
:singing="songs.findIndex((s) => s.status == SongRequestStatus.Singing) > -1"
:from="singing?.from as number"
:status="singing?.status as number"
>
<div class="live-request-processing-container"
:singing="songs.findIndex((s) => s.status == SongRequestStatus.Singing) > -1" :from="singing?.from as number"
:status="singing?.status as number">
<div class="live-request-processing-prefix"></div>
<template v-if="singing">
<img
class="live-request-processing-avatar"
:src="singing?.user?.face"
referrerpolicy="no-referrer"
/>
<img class="live-request-processing-avatar" :src="singing?.user?.face" referrerpolicy="no-referrer" />
<p class="live-request-processing-song-name">{{ singing?.songName }}</p>
<p class="live-request-processing-name">{{ singing?.user?.name }}</p>
</template>
@@ -169,22 +167,10 @@ onUnmounted(() => {
</div>
<div class="live-request-content" ref="listContainerRef">
<template v-if="activeSongs.length > 0">
<Vue3Marquee
class="live-request-list"
:key="key"
vertical
:duration="20"
:pause="!isMoreThanContainer"
:style="`height: ${height}px;width: ${width}px;`"
>
<div
class="live-request-list-item"
:from="song.from as number"
:status="song.status as number"
v-for="(song, index) in activeSongs"
:key="song.id"
:style="`height: ${itemHeight}px`"
>
<Vue3Marquee class="live-request-list" :key="key" vertical :duration="20" :pause="!isMoreThanContainer"
:style="`height: ${height}px;width: ${width}px;`">
<div class="live-request-list-item" :from="song.from as number" :status="song.status as number"
v-for="(song, index) in activeSongs" :key="song.id" :style="`height: ${itemHeight}px`">
<div class="live-request-list-item-index" :index="index + 1">
{{ index + 1 }}
</div>
@@ -194,11 +180,8 @@ onUnmounted(() => {
<p v-if="settings.showUserName" class="live-request-list-item-name">
{{ song.from == SongRequestFrom.Manual ? '主播添加' : song.user?.name }}
</p>
<div
v-if="settings.showFanMadelInfo"
class="live-request-list-item-level"
:has-level="(song.user?.fans_medal_level ?? 0) > 0"
>
<div v-if="settings.showFanMadelInfo" class="live-request-list-item-level"
:has-level="(song.user?.fans_medal_level ?? 0) > 0">
{{ `${song.user?.fans_medal_name} ${song.user?.fans_medal_level}` }}
</div>
</div>
@@ -210,13 +193,8 @@ onUnmounted(() => {
</div>
</div>
<div class="live-request-footer" v-if="settings.showRequireInfo" ref="footerRef">
<Vue3Marquee
:key="key"
ref="footerListRef"
class="live-request-footer-marquee"
:duration="10"
animate-on-overflow-only
>
<Vue3Marquee :key="key" ref="footerListRef" class="live-request-footer-marquee" :duration="10"
animate-on-overflow-only>
<span class="live-request-tag" type="prefix">
<div class="live-request-tag-key">前缀</div>
<div class="live-request-tag-value">
@@ -264,6 +242,7 @@ onUnmounted(() => {
border-radius: 10px;
color: white;
}
.live-request-header {
margin: 0;
color: #fff;
@@ -276,17 +255,20 @@ onUnmounted(() => {
0 0 30px #61606086,
0 0 40px rgba(64, 156, 179, 0.555);
}
.live-request-header-count {
color: #ffffffbd;
text-align: center;
font-size: 14px;
}
.live-request-divider {
margin: 0 auto;
margin-top: -15px;
margin-bottom: -15px;
width: 90%;
}
.live-request-processing-container {
height: 35px;
margin: 0 10px 0 10px;
@@ -294,34 +276,41 @@ onUnmounted(() => {
align-items: center;
gap: 10px;
}
.live-request-processing-empty {
font-weight: bold;
font-style: italic;
color: #ffffffbe;
}
.live-request-processing-prefix {
border: 2px solid rgb(231, 231, 231);
height: 30px;
width: 10px;
border-radius: 10px;
}
.live-request-processing-container[singing='true'] .live-request-processing-prefix {
background-color: #75c37f;
animation: animated-border 3s linear infinite;
}
.live-request-processing-container[singing='false'] .live-request-processing-prefix {
background-color: #c37575;
}
.live-request-processing-avatar {
height: 30px;
border-radius: 50%;
/* 添加无限旋转动画 */
animation: rotate 20s linear infinite;
}
/* 网页点歌 */
.live-request-processing-container[from='3'] .live-request-processing-avatar {
display: none;
}
.live-request-processing-song-name {
font-size: large;
font-weight: bold;
@@ -329,21 +318,26 @@ onUnmounted(() => {
white-space: nowrap;
max-width: 80%;
}
.live-request-processing-name {
font-size: 12px;
font-style: italic;
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
.n-divider__line {
background-color: #ffffffd5;
}
.live-request-content {
background-color: #0f0f0f4f;
margin: 10px;
@@ -352,9 +346,11 @@ onUnmounted(() => {
border-radius: 10px;
overflow-x: hidden;
}
.marquee {
justify-items: left;
}
.live-request-list-item {
display: flex;
width: 100%;
@@ -364,6 +360,7 @@ onUnmounted(() => {
justify-content: left;
gap: 10px;
}
.live-request-list-item-song-name {
font-size: 18px;
font-weight: bold;
@@ -380,13 +377,13 @@ onUnmounted(() => {
color: #d2d8d6;
font-size: 12px;
}
.live-request-list-item[from='0'] .live-request-list-item-avatar {
display: none;
}
/* 弹幕点歌 */
.live-request-list-item[from='1'] {
}
.live-request-list-item[from='1'] {}
.live-request-list-item-name {
font-style: italic;
@@ -397,6 +394,7 @@ onUnmounted(() => {
margin-left: auto;
}
.live-request-list-item-index {
text-align: center;
height: 18px;
@@ -407,6 +405,7 @@ onUnmounted(() => {
color: rgba(204, 204, 204, 0.993);
font-size: 12px;
}
.live-request-list-item-level {
text-align: center;
height: 18px;
@@ -417,9 +416,11 @@ onUnmounted(() => {
color: rgba(204, 204, 204, 0.993);
font-size: 12px;
}
.live-request-list-item-level[has-level='false'] {
display: none;
}
.live-request-footer {
margin: 0 5px 5px 5px;
height: 60px;
@@ -428,6 +429,7 @@ onUnmounted(() => {
display: flex;
align-items: center;
}
.live-request-tag {
display: flex;
margin: 5px 0 5px 5px;
@@ -440,30 +442,36 @@ onUnmounted(() => {
flex-direction: column;
justify-content: left;
}
.live-request-tag-key {
font-style: italic;
color: rgb(211, 211, 211);
font-size: 12px;
}
.live-request-tag-value {
font-size: 14px;
}
.live-request-list-item-index[index='1'] {
background-color: #ebc34c;
color: white;
font-weight: bold;
text-shadow: 0 0 6px #ebc34c;
}
.live-request-list-item-index[index='2'] {
background-color: #c0c0c0;
color: white;
font-weight: bold;
}
.live-request-list-item-index[index='3'] {
background-color: #b87333;
color: white;
font-weight: bold;
}
@keyframes animated-border {
0% {
box-shadow: 0 0 0px #589580;

View File

@@ -16,8 +16,8 @@ import { Vue3Marquee } from 'vue3-marquee'
const props = defineProps<{
id?: number,
active: boolean,
visible: boolean,
active?: boolean,
visible?: boolean,
}>()
const message = useMessage()

View File

@@ -16,8 +16,8 @@ type WaitMusicInfo = {
const props = defineProps<{
id?: number,
active: boolean,
visible: boolean,
active?: boolean,
visible?: boolean,
}>()
const message = useMessage()
@@ -52,7 +52,7 @@ async function get() {
if (data.code == 200) {
return data.data
}
} catch (err) {}
} catch (err) { }
return originSongs.value
}
const isMoreThanContainer = computed(() => {
@@ -85,18 +85,13 @@ onUnmounted(() => {
<NDivider class="music-request-divider">
<p class="music-request-header-count">已有 {{ originSongs.waiting.length ?? 0 }} </p>
</NDivider>
<div
class="music-request-singing-container"
:playing="originSongs.playing ? 'true' : 'false'"
:from="originSongs.playing?.music.from ?? -1"
>
<div class="music-request-singing-container" :playing="originSongs.playing ? 'true' : 'false'"
:from="originSongs.playing?.music.from ?? -1">
<div class="music-request-singing-prefix"></div>
<template v-if="originSongs.playing">
<img
class="music-request-singing-avatar"
<img class="music-request-singing-avatar"
:src="originSongs.playing.music.cover ?? AVATAR_URL + originSongs.playing.from?.uid"
referrerpolicy="no-referrer"
/>
referrerpolicy="no-referrer" />
<p class="music-request-singing-song-name">{{ originSongs.playing.music.name }}</p>
<p class="music-request-singing-name">{{ originSongs.playing.from?.name }}</p>
</template>
@@ -105,21 +100,10 @@ onUnmounted(() => {
</div>
<div class="music-request-content" ref="listContainerRef">
<template v-if="originSongs.waiting.length > 0">
<Vue3Marquee
class="music-request-list"
:key="key"
vertical
:pause="!isMoreThanContainer"
:duration="20"
:style="`height: ${height}px;width: ${width}px;`"
>
<span
class="music-request-list-item"
:from="item.music.from as number"
v-for="(item, index) in originSongs.waiting"
:key="item.music.id"
:style="`height: ${itemHeight}px`"
>
<Vue3Marquee class="music-request-list" :key="key" vertical :pause="!isMoreThanContainer" :duration="20"
:style="`height: ${height}px;width: ${width}px;`">
<span class="music-request-list-item" :from="item.music.from as number"
v-for="(item, index) in originSongs.waiting" :key="item.music.id" :style="`height: ${itemHeight}px`">
<div class="music-request-list-item-index" :index="index + 1">
{{ index + 1 }}
</div>
@@ -149,6 +133,7 @@ onUnmounted(() => {
border-radius: 10px;
color: white;
}
.music-request-header {
margin: 0;
color: #fff;
@@ -161,17 +146,20 @@ onUnmounted(() => {
0 0 30px #61606086,
0 0 40px rgba(64, 156, 179, 0.555);
}
.music-request-header-count {
color: #ffffffbd;
text-align: center;
font-size: 14px;
}
.music-request-divider {
margin: 0 auto;
margin-top: -15px;
margin-bottom: -15px;
width: 90%;
}
.music-request-singing-container {
height: 35px;
margin: 0 10px 0 10px;
@@ -179,34 +167,41 @@ onUnmounted(() => {
align-items: center;
gap: 10px;
}
.music-request-singing-empty {
font-weight: bold;
font-style: italic;
color: #ffffffbe;
}
.music-request-singing-prefix {
border: 2px solid rgb(231, 231, 231);
height: 30px;
width: 10px;
border-radius: 10px;
}
.music-request-singing-container[playing='true'] .music-request-singing-prefix {
background-color: #75c37f;
animation: animated-border 3s linear infinite;
}
.music-request-singing-container[playing='false'] .music-request-singing-prefix {
background-color: #c37575;
}
.music-request-singing-avatar {
height: 30px;
border-radius: 50%;
/* 添加无限旋转动画 */
animation: rotate 20s linear infinite;
}
/* 网页点歌 */
.music-request-singing-container[from='3'] .music-request-singing-avatar {
display: none;
}
.music-request-singing-song-name {
font-size: large;
font-weight: bold;
@@ -214,21 +209,26 @@ onUnmounted(() => {
white-space: nowrap;
max-width: 80%;
}
.music-request-singing-name {
font-size: 12px;
font-style: italic;
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
.n-divider__line {
background-color: #ffffffd5;
}
.music-request-content {
background-color: #0f0f0f4f;
margin: 10px;
@@ -237,9 +237,11 @@ onUnmounted(() => {
border-radius: 10px;
overflow-x: hidden;
}
.marquee {
justify-items: left;
}
.music-request-list-item {
display: flex;
width: 100%;
@@ -249,6 +251,7 @@ onUnmounted(() => {
justify-content: left;
gap: 10px;
}
.music-request-list-item-song-name {
font-size: 18px;
font-weight: bold;
@@ -265,13 +268,13 @@ onUnmounted(() => {
color: #d2d8d6;
font-size: 12px;
}
.music-request-list-item[from='0'] .music-request-list-item-avatar {
display: none;
}
/* 弹幕点歌 */
.music-request-list-item[from='1'] {
}
.music-request-list-item[from='1'] {}
.music-request-list-item-name {
font-style: italic;
@@ -282,6 +285,7 @@ onUnmounted(() => {
margin-left: auto;
}
.music-request-list-item-index {
text-align: center;
height: 18px;
@@ -292,6 +296,7 @@ onUnmounted(() => {
color: rgba(204, 204, 204, 0.993);
font-size: 12px;
}
.music-request-list-item-level {
text-align: center;
height: 18px;
@@ -302,9 +307,11 @@ onUnmounted(() => {
color: rgba(204, 204, 204, 0.993);
font-size: 12px;
}
.music-request-list-item-level[has-level='false'] {
display: none;
}
.music-request-tag {
display: flex;
margin: 5px 0 5px 5px;
@@ -317,14 +324,17 @@ onUnmounted(() => {
flex-direction: column;
justify-content: left;
}
.music-request-tag-key {
font-style: italic;
color: rgb(211, 211, 211);
font-size: 12px;
}
.music-request-tag-value {
font-size: 14px;
}
@keyframes animated-border {
0% {
box-shadow: 0 0 0px #589580;

View File

@@ -9,8 +9,8 @@ import { useWebRTC } from '@/store/useRTC'
const props = defineProps<{
id?: number,
active: boolean,
visible: boolean,
active?: boolean,
visible?: boolean,
}>()
const hash = ref('')

View File

@@ -20,8 +20,8 @@ import { Vue3Marquee } from 'vue3-marquee'
const props = defineProps<{
id?: number,
active: boolean,
visible: boolean,
active?: boolean,
visible?: boolean,
}>()
const message = useMessage()

View File

@@ -20,7 +20,7 @@ function onGetDanmaku(data: any) {
let timer: any
onMounted(async () => {
if (window.parent) { //当是客户端组件时不自动启动, 需要客户端来启动以获取启动响应
if (window.frameElement) { //当是客户端组件时不自动启动, 需要客户端来启动以获取启动响应
console.log('[web-fetcher-iframe] 当前为客户端组件')
rpc = new RPC({

View File

@@ -1203,6 +1203,10 @@ onUnmounted(() => {
:disabled="!configCanEdit">
允许通过网页点歌
</NCheckbox>
<NCheckbox v-if="settings.allowFromWeb" v-model:checked="settings.allowAnonymousFromWeb" @update:checked="updateSettings"
:disabled="!configCanEdit">
允许匿名通过网页点歌
</NCheckbox>
</NSpace>
<NDivider> 冷却 (单位: 秒) </NDivider>
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings"

View File

@@ -283,7 +283,15 @@ function speakFromAPI(text: string) {
.trim()
.replace(/^(?:https?:\/\/)/, '')
.replace(/\{\{\s*text\s*\}\}/, encodeURIComponent(text))}`
const tempURL = new URL(url)
let tempURL: URL
try {
tempURL = new URL(url)
} catch (err) {
console.log(err)
message.error('无效的API地址: ' + url)
cancelSpeech()
return
}
if (isVtsuruVoiceAPI.value) {
tempURL.searchParams.set('vtsuruId', accountInfo.value?.id.toString() ?? '-1')
url = tempURL.toString()
@@ -844,9 +852,9 @@ onUnmounted(() => {
<NDivider> 设置 </NDivider>
<NSpace align="center">
<NCheckbox :checked="settings.combineGiftDelay != undefined" @update:checked="(checked: boolean) => {
settings.combineGiftDelay = checked ? 2 : undefined
}
">
settings.combineGiftDelay = checked ? 2 : undefined
}
">
是否启用礼物合并
<NTooltip>
<template #trigger>
@@ -860,9 +868,9 @@ onUnmounted(() => {
<NInputGroup v-if="settings.combineGiftDelay" style="width: 200px">
<NInputGroupLabel> 送礼间隔 () </NInputGroupLabel>
<NInputNumber v-model:value="settings.combineGiftDelay" @update:value="(value) => {
if (!value || value <= 0) settings.combineGiftDelay = undefined
}
" />
if (!value || value <= 0) settings.combineGiftDelay = undefined
}
" />
</NInputGroup>
<NCheckbox v-model:checked="settings.splitText">
启用句子拆分

View File

@@ -12,10 +12,15 @@ import { Setting_LiveRequest, SongRequestInfo, SongsInfo, UserInfo } from '@/api
import { QueryGetAPI, QueryPostAPIWithParams } from '@/api/query'
import { TemplateConfig } from '@/data/VTsuruTypes'
import { SONG_API_URL, SONG_REQUEST_API_URL, SongListTemplateMap, VTSURU_API_URL } from '@/data/constants'
import { useStorage } from '@vueuse/core'
import { addSeconds } from 'date-fns'
import { NSpin, useMessage } from 'naive-ui'
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
const accountInfo = useAccount()
const nextRequestTime = useStorage('SongList.NextRequestTime', new Date())
const minRequestTime = 30
const props = defineProps<{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -104,15 +109,22 @@ async function getConfig() {
})
}
async function requestSong(song: SongsInfo) {
if (song.options || !settings.value.allowFromWeb) {
if (song.options || !settings.value.allowFromWeb || (settings.value.allowFromWeb && !settings.value.allowAnonymousFromWeb)) {
navigator.clipboard.writeText(`${settings.value.orderPrefix} ${song.name}`)
if (!accountInfo.value) {
if (!settings.value.allowAnonymousFromWeb) {
message.warning('主播不允许匿名点歌, 需要从网页点歌的话请注册登录, 点歌弹幕已复制到剪切板')
}
else if (!accountInfo.value.id) {
message.warning('要从网页点歌请先登录, 点歌弹幕已复制到剪切板')
} else {
message.success('复制成功')
}
} else {
if (props.userInfo) {
if (!accountInfo.value.id && nextRequestTime.value > new Date()) {
message.warning('距离点歌冷却还有' + (nextRequestTime.value.getTime() - new Date().getTime()) / 1000 + '秒')
return
}
try {
const data = await QueryPostAPIWithParams(SONG_REQUEST_API_URL + 'add-from-web', {
target: props.userInfo?.id,
@@ -121,6 +133,7 @@ async function requestSong(song: SongsInfo) {
if (data.code == 200) {
message.success('点歌成功')
nextRequestTime.value = addSeconds(new Date(), minRequestTime)
} else {
message.error('点歌失败: ' + data.message)
}

View File

@@ -127,8 +127,7 @@ function loadMore() {
})
" placeholder="选择歌手" clearable />
<NDivider />
<LiveRequestOBS v-if="userInfo?.extra?.enableFunctions.includes(FunctionTypes.SongRequest)"
:id="userInfo?.id" />
<LiveRequestOBS v-if="userInfo?.extra?.enableFunctions.includes(FunctionTypes.SongRequest)" />
</NSpace>
</NCard>
<NEmpty v-if="!data || songs?.length == 0" description="暂无曲目" style="max-width: 0 auto" />

View File

@@ -10,7 +10,7 @@
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"allowJs": false,
"sourceMap": false,
"sourceMap": true,
"baseUrl": ".",
"types": ["node"],
"paths": {

View File

@@ -23,15 +23,10 @@ const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule)
export default defineConfig({
plugins: [
vue({
script: {
propsDestructure: true,
defineModel: true
},
script: { propsDestructure: true, defineModel: true },
include: [/\.vue$/, /\.md$/],
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('yt-')
}
compilerOptions: { isCustomElement: (tag) => tag.startsWith('yt-') }
}
}),
svgLoader(),
@@ -42,19 +37,11 @@ export default defineConfig({
caddyTls(),
monacoEditorPlugin({ languageWorkers: ['css'] })
],
server: {
port: 51000
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
define: {
'process.env': {},
global: 'window'
},
server: { port: 51000 },
resolve: { alias: { '@': path.resolve(__dirname, 'src') } },
define: { 'process.env': {}, global: 'window' },
optimizeDeps: {
include: ['@vicons/fluent', '@vicons/ionicons5', 'vue', 'vue-router']
}
},
build: { sourcemap: true }
})