mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
fix message provider get
This commit is contained in:
6
.github/workflows/bun.yml
vendored
6
.github/workflows/bun.yml
vendored
@@ -1,13 +1,11 @@
|
|||||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
||||||
|
|
||||||
name: Node.js CI
|
name: Bun CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master" ]
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -17,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use bun
|
- name: Use bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
- name: 📥 Install dependencies
|
- name: 📥 Install dependencies
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import { ExtendedDock24Filled } from "@vicons/fluent"
|
||||||
|
import { UserConsumptionSetting } from "./models/consumption"
|
||||||
|
|
||||||
export interface APIRoot<T> {
|
export interface APIRoot<T> {
|
||||||
code: number
|
code: number
|
||||||
message: string
|
message: string
|
||||||
@@ -58,6 +61,7 @@ export interface AccountInfo extends UserInfo {
|
|||||||
biliVerifyCode?: string
|
biliVerifyCode?: string
|
||||||
bindEmail?: string
|
bindEmail?: string
|
||||||
settings: UserSetting
|
settings: UserSetting
|
||||||
|
consumptionSetting: UserConsumptionSetting
|
||||||
token: string
|
token: string
|
||||||
|
|
||||||
biliAuthCode?: string
|
biliAuthCode?: string
|
||||||
|
|||||||
20
src/api/models/consumption.ts
Normal file
20
src/api/models/consumption.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export enum ConsumptionTypes{
|
||||||
|
DanmakuStorage,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDeductionSetting {
|
||||||
|
isEnabled: boolean
|
||||||
|
}
|
||||||
|
export interface UserConsumptionSetting {
|
||||||
|
danmakuStorage: DanmakuStorageDeductionSetting
|
||||||
|
}
|
||||||
|
export enum DeductionStorageType {
|
||||||
|
Time,
|
||||||
|
Count
|
||||||
|
}
|
||||||
|
export interface DanmakuStorageDeductionSetting extends IDeductionSetting {
|
||||||
|
storageType: DeductionStorageType
|
||||||
|
isUnlimited: boolean
|
||||||
|
limitDays: number
|
||||||
|
limitCount: number
|
||||||
|
}
|
||||||
41
src/store/usePaymentSettingStore.ts
Normal file
41
src/store/usePaymentSettingStore.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { useAccount } from '@/api/account'
|
||||||
|
import { ConsumptionTypes, IDeductionSetting, UserConsumptionSetting } from '@/api/models/consumption'
|
||||||
|
import { QueryPostAPIWithParams } from '@/api/query'
|
||||||
|
import { ACCOUNT_API_URL } from '@/data/constants'
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
export const useConsumptionSettingStore = defineStore(
|
||||||
|
'consumptionSetting',
|
||||||
|
() => {
|
||||||
|
const accountInfo = useAccount()
|
||||||
|
const consumptionSetting = computed<UserConsumptionSetting>(() => {
|
||||||
|
return accountInfo.value.consumptionSetting
|
||||||
|
})
|
||||||
|
const consumptionTypeMap = {
|
||||||
|
[ConsumptionTypes.DanmakuStorage]: {
|
||||||
|
name: '弹幕存储',
|
||||||
|
key: 'danmakuStorage'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function UpdateConsumptionSetting(
|
||||||
|
type: ConsumptionTypes,
|
||||||
|
value: unknown
|
||||||
|
) {
|
||||||
|
return await QueryPostAPIWithParams(
|
||||||
|
ACCOUNT_API_URL + 'update-consumption-setting',
|
||||||
|
{
|
||||||
|
type: type
|
||||||
|
},
|
||||||
|
value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
function GetSetting(type: ConsumptionTypes) {
|
||||||
|
// @ts-expect-error 直接从对象获取key
|
||||||
|
return consumptionSetting.value[consumptionTypeMap[type].key] as IDeductionSetting
|
||||||
|
}
|
||||||
|
|
||||||
|
return { consumptionSetting, consumptionTypeMap, UpdateConsumptionSetting, GetSetting }
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -50,7 +50,7 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
|||||||
let isRevieveGetted = false
|
let isRevieveGetted = false
|
||||||
//const isSendGetted = false
|
//const isSendGetted = false
|
||||||
|
|
||||||
const message = useMessage()
|
const message = window.$message
|
||||||
|
|
||||||
async function GetRecieveQAInfo() {
|
async function GetRecieveQAInfo() {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|||||||
@@ -287,19 +287,6 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NFlex justify="center" align="center" vertical>
|
<NFlex justify="center" align="center" vertical>
|
||||||
<NAlert type="warning" title="2024.2.26">
|
|
||||||
近期逸站对开放平台直播弹幕流进行了极为严格的限制, 目前本站服务器只能连接个位数的直播间, 这使得在不使用
|
|
||||||
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text>
|
|
||||||
VtsuruEventFetcher
|
|
||||||
</NButton>
|
|
||||||
的情况下获取弹幕数据几乎不可能实现.
|
|
||||||
<br />
|
|
||||||
在这种情况下建议有相关功能需求的用户 (如直播记录, 积分等) 部署
|
|
||||||
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text>
|
|
||||||
VtsuruEventFetcher
|
|
||||||
</NButton>
|
|
||||||
以获得完整的功能体验
|
|
||||||
</NAlert>
|
|
||||||
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;">
|
<NTabs type="segment" animated v-if="accountInfo" style="width: 100%;">
|
||||||
<NTabPane name="info" tab="个人信息" style="width: 100%;" display-directive="show:lazy">
|
<NTabPane name="info" tab="个人信息" style="width: 100%;" display-directive="show:lazy">
|
||||||
<NFlex justify="center" align="center">
|
<NFlex justify="center" align="center">
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAccount } from '@/api/account';
|
import { useAccount } from '@/api/account';
|
||||||
import { onMounted } from 'vue';
|
import { ConsumptionTypes } from '@/api/models/consumption';
|
||||||
|
import { NFlex, NIcon, NLayout, NLayoutSider, NMenu, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { h, onMounted } from 'vue';
|
||||||
|
import { useConsumptionSettingStore } from '@/store/usePaymentSettingStore';
|
||||||
|
import { CheckmarkCircle24Filled } from '@vicons/fluent';
|
||||||
|
|
||||||
const accountInfo = useAccount()
|
const accountInfo = useAccount()
|
||||||
|
const useConsumption = useConsumptionSettingStore()
|
||||||
|
|
||||||
const { } = defineProps<{
|
const { } = defineProps<{
|
||||||
|
|
||||||
}>()
|
}>()
|
||||||
|
const enabledIcon = h(NIcon, { component: CheckmarkCircle24Filled, color: 'lightgrey' })
|
||||||
|
const disabledIcon = h(NIcon, { component: CheckmarkCircle24Filled, color: 'red' })
|
||||||
|
const tabDisplay = (type: ConsumptionTypes) => {
|
||||||
|
const setting = useConsumption.GetSetting(type)
|
||||||
|
return h(NFlex, {}, () => [
|
||||||
|
h(NIcon, { component: setting.isEnabled ? enabledIcon : disabledIcon, }),
|
||||||
|
h('span', {}, setting.isEnabled ? '已启用' : '未启用'),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
async function getAccountPaymentSettings() {
|
async function getAccountPaymentSettings() {
|
||||||
try {
|
try {
|
||||||
@@ -22,5 +36,11 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
WIP...
|
<NTabs animated type="line">
|
||||||
|
<NTabPane name="弹幕储存" tab="弹幕储存">
|
||||||
|
<template #tab>
|
||||||
|
<component :is="tabDisplay(ConsumptionTypes.DanmakuStorage)" />
|
||||||
|
</template>
|
||||||
|
</NTabPane>
|
||||||
|
</NTabs>
|
||||||
</template>
|
</template>
|
||||||
Reference in New Issue
Block a user