mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
add allow anonymous user add liverequest
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ExtendedDock24Filled } from "@vicons/fluent"
|
import { ExtendedDock24Filled } from '@vicons/fluent'
|
||||||
import { UserConsumptionSetting } from "./models/consumption"
|
import { UserConsumptionSetting } from './models/consumption'
|
||||||
|
|
||||||
export interface APIRoot<T> {
|
export interface APIRoot<T> {
|
||||||
code: number
|
code: number
|
||||||
@@ -13,16 +13,16 @@ export interface PaginationResponse<T> extends APIRoot<T> {
|
|||||||
more: boolean
|
more: boolean
|
||||||
}
|
}
|
||||||
export enum IndexTypes {
|
export enum IndexTypes {
|
||||||
Default,
|
Default
|
||||||
}
|
}
|
||||||
export enum SongListTypes {
|
export enum SongListTypes {
|
||||||
Default,
|
Default
|
||||||
}
|
}
|
||||||
export enum GuardLevel {
|
export enum GuardLevel {
|
||||||
None = 0,
|
None = 0,
|
||||||
Zongdu = 1,
|
Zongdu = 1,
|
||||||
Tidu = 2,
|
Tidu = 2,
|
||||||
Jianzhang = 3,
|
Jianzhang = 3
|
||||||
}
|
}
|
||||||
export interface UserBasicInfo {
|
export interface UserBasicInfo {
|
||||||
name: string
|
name: string
|
||||||
@@ -53,7 +53,7 @@ export interface EventFetcherStateModel {
|
|||||||
export enum EventFetcherType {
|
export enum EventFetcherType {
|
||||||
Application,
|
Application,
|
||||||
OBS,
|
OBS,
|
||||||
Server,
|
Server
|
||||||
}
|
}
|
||||||
export interface AccountInfo extends UserInfo {
|
export interface AccountInfo extends UserInfo {
|
||||||
isEmailVerified: boolean
|
isEmailVerified: boolean
|
||||||
@@ -98,7 +98,7 @@ export enum BiliAuthCodeStatusType {
|
|||||||
NotBind,
|
NotBind,
|
||||||
Active,
|
Active,
|
||||||
Notfound,
|
Notfound,
|
||||||
Inactive,
|
Inactive
|
||||||
}
|
}
|
||||||
export interface Setting_SendEmail {
|
export interface Setting_SendEmail {
|
||||||
recieveQA: boolean
|
recieveQA: boolean
|
||||||
@@ -134,9 +134,7 @@ export interface Setting_Index {
|
|||||||
allowDisplayInIndex: boolean
|
allowDisplayInIndex: boolean
|
||||||
videos: string[]
|
videos: string[]
|
||||||
notification: string
|
notification: string
|
||||||
links: {
|
links: { [key: string]: string }
|
||||||
[key: string]: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export interface Setting_LiveRequest {
|
export interface Setting_LiveRequest {
|
||||||
orderPrefix: string
|
orderPrefix: string
|
||||||
@@ -146,6 +144,7 @@ export interface Setting_LiveRequest {
|
|||||||
queueMaxSize: number
|
queueMaxSize: number
|
||||||
allowAllDanmaku: boolean
|
allowAllDanmaku: boolean
|
||||||
allowFromWeb: boolean
|
allowFromWeb: boolean
|
||||||
|
allowAnonymousFromWeb: boolean
|
||||||
needWearFanMedal: boolean
|
needWearFanMedal: boolean
|
||||||
needJianzhang: boolean
|
needJianzhang: boolean
|
||||||
needTidu: boolean
|
needTidu: boolean
|
||||||
@@ -247,28 +246,28 @@ export interface Setting_QuestionDisplay {
|
|||||||
export enum QuestionDisplayAlign {
|
export enum QuestionDisplayAlign {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
Center,
|
Center
|
||||||
}
|
}
|
||||||
export enum SettingPointGiftAllowType {
|
export enum SettingPointGiftAllowType {
|
||||||
All,
|
All,
|
||||||
WhiteList,
|
WhiteList
|
||||||
}
|
}
|
||||||
export enum KeywordMatchType {
|
export enum KeywordMatchType {
|
||||||
Full,
|
Full,
|
||||||
Contains,
|
Contains,
|
||||||
Regex,
|
Regex
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum QueueSortType {
|
export enum QueueSortType {
|
||||||
GuardFirst,
|
GuardFirst,
|
||||||
PaymentFist,
|
PaymentFist,
|
||||||
TimeFirst,
|
TimeFirst,
|
||||||
FansMedalFirst,
|
FansMedalFirst
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum QueueGiftFilterType {
|
export enum QueueGiftFilterType {
|
||||||
Or,
|
Or,
|
||||||
And,
|
And
|
||||||
}
|
}
|
||||||
export enum FunctionTypes {
|
export enum FunctionTypes {
|
||||||
SongList,
|
SongList,
|
||||||
@@ -277,7 +276,7 @@ export enum FunctionTypes {
|
|||||||
SongRequest,
|
SongRequest,
|
||||||
Queue,
|
Queue,
|
||||||
Point,
|
Point,
|
||||||
VideoCollect,
|
VideoCollect
|
||||||
}
|
}
|
||||||
export interface SongAuthorInfo {
|
export interface SongAuthorInfo {
|
||||||
name: string
|
name: string
|
||||||
@@ -287,7 +286,7 @@ export enum SongFrom {
|
|||||||
Custom,
|
Custom,
|
||||||
Netease,
|
Netease,
|
||||||
FiveSing,
|
FiveSing,
|
||||||
Kugou,
|
Kugou
|
||||||
}
|
}
|
||||||
export interface SongsInfo {
|
export interface SongsInfo {
|
||||||
id: number
|
id: number
|
||||||
@@ -319,13 +318,13 @@ export enum SongLanguage {
|
|||||||
Japanese, // 日文
|
Japanese, // 日文
|
||||||
Spanish, // 西班牙文
|
Spanish, // 西班牙文
|
||||||
French, // 法文
|
French, // 法文
|
||||||
Other, //其他
|
Other //其他
|
||||||
}
|
}
|
||||||
export enum LevelTypes {
|
export enum LevelTypes {
|
||||||
Info,
|
Info,
|
||||||
Success,
|
Success,
|
||||||
Warn,
|
Warn,
|
||||||
Error,
|
Error
|
||||||
}
|
}
|
||||||
export interface NotifactionInfo {
|
export interface NotifactionInfo {
|
||||||
id: string
|
id: string
|
||||||
@@ -342,7 +341,7 @@ export enum ViolationTypes {
|
|||||||
PORNOGRAPHY,
|
PORNOGRAPHY,
|
||||||
POLITICS,
|
POLITICS,
|
||||||
ADVERTISING,
|
ADVERTISING,
|
||||||
AGGRESSION,
|
AGGRESSION
|
||||||
}
|
}
|
||||||
export type QAReviewInfo = {
|
export type QAReviewInfo = {
|
||||||
isApproved: boolean
|
isApproved: boolean
|
||||||
@@ -396,7 +395,7 @@ export interface ScheduleDayInfo {
|
|||||||
export enum ThemeType {
|
export enum ThemeType {
|
||||||
Auto = 'auto',
|
Auto = 'auto',
|
||||||
Light = 'light',
|
Light = 'light',
|
||||||
Dark = 'dark',
|
Dark = 'dark'
|
||||||
}
|
}
|
||||||
export interface VideoCollectCreateModel {
|
export interface VideoCollectCreateModel {
|
||||||
id?: string
|
id?: string
|
||||||
@@ -430,12 +429,12 @@ export interface VideoCollectVideo {
|
|||||||
}
|
}
|
||||||
export enum VideoFrom {
|
export enum VideoFrom {
|
||||||
Collect,
|
Collect,
|
||||||
Spam,
|
Spam
|
||||||
}
|
}
|
||||||
export enum VideoStatus {
|
export enum VideoStatus {
|
||||||
Pending,
|
Pending,
|
||||||
Accepted,
|
Accepted,
|
||||||
Rejected,
|
Rejected
|
||||||
}
|
}
|
||||||
export interface VideoSender {
|
export interface VideoSender {
|
||||||
sendAt: number
|
sendAt: number
|
||||||
@@ -487,7 +486,7 @@ export interface OpenLiveLotteryUserInfo {
|
|||||||
}
|
}
|
||||||
export enum OpenLiveLotteryType {
|
export enum OpenLiveLotteryType {
|
||||||
Waiting,
|
Waiting,
|
||||||
Result,
|
Result
|
||||||
}
|
}
|
||||||
export interface UpdateLiveLotteryUsersModel {
|
export interface UpdateLiveLotteryUsersModel {
|
||||||
users: OpenLiveLotteryUserInfo[]
|
users: OpenLiveLotteryUserInfo[]
|
||||||
@@ -522,26 +521,26 @@ export enum SongRequestFrom {
|
|||||||
Danmaku,
|
Danmaku,
|
||||||
SC,
|
SC,
|
||||||
Web,
|
Web,
|
||||||
Gift,
|
Gift
|
||||||
}
|
}
|
||||||
export enum QueueFrom {
|
export enum QueueFrom {
|
||||||
Manual,
|
Manual,
|
||||||
Danmaku,
|
Danmaku,
|
||||||
Gift,
|
Gift,
|
||||||
Web,
|
Web
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SongRequestStatus {
|
export enum SongRequestStatus {
|
||||||
Waiting,
|
Waiting,
|
||||||
Singing,
|
Singing,
|
||||||
Finish,
|
Finish,
|
||||||
Cancel,
|
Cancel
|
||||||
}
|
}
|
||||||
export enum QueueStatus {
|
export enum QueueStatus {
|
||||||
Waiting,
|
Waiting,
|
||||||
Progressing,
|
Progressing,
|
||||||
Finish,
|
Finish,
|
||||||
Cancel,
|
Cancel
|
||||||
}
|
}
|
||||||
export interface EventModel {
|
export interface EventModel {
|
||||||
type: EventDataTypes
|
type: EventDataTypes
|
||||||
@@ -567,7 +566,7 @@ export enum EventDataTypes {
|
|||||||
Message,
|
Message,
|
||||||
Like,
|
Like,
|
||||||
SCDel,
|
SCDel,
|
||||||
Enter,
|
Enter
|
||||||
}
|
}
|
||||||
export interface ResponseQueueModel {
|
export interface ResponseQueueModel {
|
||||||
id: number
|
id: number
|
||||||
@@ -620,7 +619,7 @@ export enum FeedbackType {
|
|||||||
Opinion,
|
Opinion,
|
||||||
Bug,
|
Bug,
|
||||||
FunctionRequest,
|
FunctionRequest,
|
||||||
Other,
|
Other
|
||||||
}
|
}
|
||||||
export enum FeedbackStatus {
|
export enum FeedbackStatus {
|
||||||
Padding,
|
Padding,
|
||||||
@@ -628,7 +627,7 @@ export enum FeedbackStatus {
|
|||||||
Finish,
|
Finish,
|
||||||
Todo,
|
Todo,
|
||||||
Reject,
|
Reject,
|
||||||
Developing,
|
Developing
|
||||||
}
|
}
|
||||||
export interface TagInfo {
|
export interface TagInfo {
|
||||||
name: string
|
name: string
|
||||||
@@ -637,11 +636,11 @@ export interface TagInfo {
|
|||||||
export enum GoodsStatus {
|
export enum GoodsStatus {
|
||||||
Normal, // 商品正常
|
Normal, // 商品正常
|
||||||
//OutOfStock, // 商品无货
|
//OutOfStock, // 商品无货
|
||||||
Discontinued, // 商品下架
|
Discontinued // 商品下架
|
||||||
}
|
}
|
||||||
export enum GoodsTypes {
|
export enum GoodsTypes {
|
||||||
Physical,
|
Physical,
|
||||||
Virtual,
|
Virtual
|
||||||
}
|
}
|
||||||
export interface PointGoodsSetting {
|
export interface PointGoodsSetting {
|
||||||
guardFree?: { year: number; month: number }
|
guardFree?: { year: number; month: number }
|
||||||
@@ -757,7 +756,7 @@ export interface ResponsePointOrder2UserModel {
|
|||||||
export enum PointOrderStatus {
|
export enum PointOrderStatus {
|
||||||
Pending, // 订单正在等待处理
|
Pending, // 订单正在等待处理
|
||||||
Shipped, // 订单已发货
|
Shipped, // 订单已发货
|
||||||
Completed, // 订单已完成
|
Completed // 订单已完成
|
||||||
}
|
}
|
||||||
export interface ResponsePointHisrotyModel {
|
export interface ResponsePointHisrotyModel {
|
||||||
point: number
|
point: number
|
||||||
@@ -773,13 +772,11 @@ export interface ResponsePointHisrotyModel {
|
|||||||
export enum PointFrom {
|
export enum PointFrom {
|
||||||
Danmaku,
|
Danmaku,
|
||||||
Manual,
|
Manual,
|
||||||
Use,
|
Use
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResponseUserIndexModel {
|
export interface ResponseUserIndexModel {
|
||||||
notification: string
|
notification: string
|
||||||
videos: VideoCollectVideo[]
|
videos: VideoCollectVideo[]
|
||||||
links: {
|
links: { [key: string]: string }
|
||||||
[key: string]: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main.ts
16
src/main.ts
@@ -96,13 +96,15 @@ QueryGetAPI<string>(BASE_API_URL + 'vtsuru/version')
|
|||||||
console.log('默认API调用失败, 切换至故障转移节点')
|
console.log('默认API调用失败, 切换至故障转移节点')
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
HyperDX.init({
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
apiKey: '7d1eb66c-24b8-445e-a406-dc2329fa9423',
|
HyperDX.init({
|
||||||
service: 'vtsuru.live',
|
apiKey: '7d1eb66c-24b8-445e-a406-dc2329fa9423',
|
||||||
tracePropagationTargets: [/vtsuru.suki.club/i], // Set to link traces from frontend to backend requests
|
service: 'vtsuru.live',
|
||||||
consoleCapture: true, // Capture console logs (default false)
|
tracePropagationTargets: [/vtsuru.suki.club/i], // Set to link traces from frontend to backend requests
|
||||||
advancedNetworkCapture: true // Capture full HTTP request/response headers and bodies (default false)
|
consoleCapture: true, // Capture console logs (default false)
|
||||||
})
|
advancedNetworkCapture: true // Capture full HTTP request/response headers and bodies (default false)
|
||||||
|
})
|
||||||
|
}
|
||||||
//加载其他数据
|
//加载其他数据
|
||||||
InitTTS()
|
InitTTS()
|
||||||
await GetSelfAccount()
|
await GetSelfAccount()
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import { NButton, NCard, NDivider, NLayoutContent, NSpace, NText, NTimeline, NTi
|
|||||||
height="200" frameborder="0"></iframe>
|
height="200" frameborder="0"></iframe>
|
||||||
<NDivider title-placement="left"> 更新日志 </NDivider>
|
<NDivider title-placement="left"> 更新日志 </NDivider>
|
||||||
<NTimeline>
|
<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="允许棉花糖设置页滚动条进度同步到obs组件" time="2024-11-23" />
|
||||||
<NTimelineItem type="info" title="功能更新" content="礼物兑换允许上舰用户免费兑换, 以及仅允许上舰用户兑换" time="2024-4-23" />
|
<NTimelineItem type="info" title="功能更新" content="礼物兑换允许上舰用户免费兑换, 以及仅允许上舰用户兑换" time="2024-4-23" />
|
||||||
<NTimelineItem type="info" title="功能更新" content="积分订单添加导出功能, 允许删除积分用户" time="2024-3-22" />
|
<NTimelineItem type="info" title="功能更新" content="积分订单添加导出功能, 允许删除积分用户" time="2024-3-22" />
|
||||||
|
|||||||
@@ -1203,6 +1203,10 @@ onUnmounted(() => {
|
|||||||
:disabled="!configCanEdit">
|
:disabled="!configCanEdit">
|
||||||
允许通过网页点歌
|
允许通过网页点歌
|
||||||
</NCheckbox>
|
</NCheckbox>
|
||||||
|
<NCheckbox v-if="settings.allowFromWeb" v-model:checked="settings.allowAnonymousFromWeb" @update:checked="updateSettings"
|
||||||
|
:disabled="!configCanEdit">
|
||||||
|
允许匿名通过网页点歌
|
||||||
|
</NCheckbox>
|
||||||
</NSpace>
|
</NSpace>
|
||||||
<NDivider> 冷却 (单位: 秒) </NDivider>
|
<NDivider> 冷却 (单位: 秒) </NDivider>
|
||||||
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings"
|
<NCheckbox v-model:checked="settings.enableCooldown" @update:checked="updateSettings"
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ import { Setting_LiveRequest, SongRequestInfo, SongsInfo, UserInfo } from '@/api
|
|||||||
import { QueryGetAPI, QueryPostAPIWithParams } from '@/api/query'
|
import { QueryGetAPI, QueryPostAPIWithParams } from '@/api/query'
|
||||||
import { TemplateConfig } from '@/data/VTsuruTypes'
|
import { TemplateConfig } from '@/data/VTsuruTypes'
|
||||||
import { SONG_API_URL, SONG_REQUEST_API_URL, SongListTemplateMap, VTSURU_API_URL } from '@/data/constants'
|
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 { NSpin, useMessage } from 'naive-ui'
|
||||||
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
|
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
|
||||||
|
|
||||||
const accountInfo = useAccount()
|
const accountInfo = useAccount()
|
||||||
|
const nextRequestTime = useStorage('SongList.NextRequestTime', new Date())
|
||||||
|
|
||||||
|
const minRequestTime = 30
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
@@ -104,15 +109,22 @@ async function getConfig() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
async function requestSong(song: SongsInfo) {
|
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}`)
|
navigator.clipboard.writeText(`${settings.value.orderPrefix} ${song.name}`)
|
||||||
if (!accountInfo.value) {
|
if (!settings.value.allowAnonymousFromWeb) {
|
||||||
|
message.warning('主播不允许匿名点歌, 需要从网页点歌的话请注册登录, 点歌弹幕已复制到剪切板')
|
||||||
|
}
|
||||||
|
else if (!accountInfo.value.id) {
|
||||||
message.warning('要从网页点歌请先登录, 点歌弹幕已复制到剪切板')
|
message.warning('要从网页点歌请先登录, 点歌弹幕已复制到剪切板')
|
||||||
} else {
|
} else {
|
||||||
message.success('复制成功')
|
message.success('复制成功')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (props.userInfo) {
|
if (props.userInfo) {
|
||||||
|
if (!accountInfo.value.id && nextRequestTime.value > new Date()) {
|
||||||
|
message.warning('距离点歌冷却还有' + (nextRequestTime.value.getTime() - new Date().getTime()) / 1000 + '秒')
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const data = await QueryPostAPIWithParams(SONG_REQUEST_API_URL + 'add-from-web', {
|
const data = await QueryPostAPIWithParams(SONG_REQUEST_API_URL + 'add-from-web', {
|
||||||
target: props.userInfo?.id,
|
target: props.userInfo?.id,
|
||||||
@@ -121,6 +133,7 @@ async function requestSong(song: SongsInfo) {
|
|||||||
|
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
message.success('点歌成功')
|
message.success('点歌成功')
|
||||||
|
nextRequestTime.value = addSeconds(new Date(), minRequestTime)
|
||||||
} else {
|
} else {
|
||||||
message.error('点歌失败: ' + data.message)
|
message.error('点歌失败: ' + data.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user