add allow anonymous user add liverequest

This commit is contained in:
2025-03-18 22:42:18 +08:00
parent e0add9edbe
commit 3d42dd1884
5 changed files with 65 additions and 47 deletions

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

@@ -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

@@ -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

@@ -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

@@ -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)
}