From 3d42dd1884bf11cea46067176c98000b8055f535 Mon Sep 17 00:00:00 2001 From: Megghy Date: Tue, 18 Mar 2025 22:42:18 +0800 Subject: [PATCH] add allow anonymous user add liverequest --- src/api/api-models.ts | 73 ++++++++++++++--------------- src/main.ts | 16 ++++--- src/views/AboutView.vue | 2 + src/views/open_live/LiveRequest.vue | 4 ++ src/views/view/SongListView.vue | 17 ++++++- 5 files changed, 65 insertions(+), 47 deletions(-) diff --git a/src/api/api-models.ts b/src/api/api-models.ts index e32539e..0c0ad7b 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -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 { code: number @@ -13,16 +13,16 @@ export interface PaginationResponse extends APIRoot { 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 } } diff --git a/src/main.ts b/src/main.ts index 1b23148..48a8308 100644 --- a/src/main.ts +++ b/src/main.ts @@ -96,13 +96,15 @@ QueryGetAPI(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() diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue index 3d0722b..97a9833 100644 --- a/src/views/AboutView.vue +++ b/src/views/AboutView.vue @@ -35,6 +35,8 @@ import { NButton, NCard, NDivider, NLayoutContent, NSpace, NText, NTimeline, NTi height="200" frameborder="0"> 更新日志 + + diff --git a/src/views/open_live/LiveRequest.vue b/src/views/open_live/LiveRequest.vue index 8ca8557..5230ddf 100644 --- a/src/views/open_live/LiveRequest.vue +++ b/src/views/open_live/LiveRequest.vue @@ -1203,6 +1203,10 @@ onUnmounted(() => { :disabled="!configCanEdit"> 允许通过网页点歌 + + 允许匿名通过网页点歌 + 冷却 (单位: 秒) 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) }