mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
feat:优化站点卡片
This commit is contained in:
@@ -435,6 +435,44 @@ export interface SiteStatistic {
|
|||||||
note?: string
|
note?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 站点用户数据
|
||||||
|
export interface SiteUserData {
|
||||||
|
// 站点域名
|
||||||
|
domain?: string
|
||||||
|
// 用户名
|
||||||
|
username?: string
|
||||||
|
// 用户ID
|
||||||
|
userid?: number
|
||||||
|
// 用户等级
|
||||||
|
user_level?: string
|
||||||
|
// 加入时间
|
||||||
|
join_at?: string
|
||||||
|
// 积分
|
||||||
|
bonus?: number // 默认为 0.0
|
||||||
|
// 上传量
|
||||||
|
upload?: number // 默认为 0
|
||||||
|
// 下载量
|
||||||
|
download?: number // 默认为 0
|
||||||
|
// 分享率
|
||||||
|
ratio?: number // 默认为 0
|
||||||
|
// 做种数
|
||||||
|
seeding?: number // 默认为 0
|
||||||
|
// 下载数
|
||||||
|
leeching?: number // 默认为 0
|
||||||
|
// 做种体积
|
||||||
|
seeding_size?: number // 默认为 0
|
||||||
|
// 下载体积
|
||||||
|
leeching_size?: number // 默认为 0
|
||||||
|
// 做种人数, 种子大小
|
||||||
|
seeding_info?: any[] // 默认为空数组
|
||||||
|
// 未读消息
|
||||||
|
message_unread?: number // 默认为 0
|
||||||
|
// 未读消息内容
|
||||||
|
message_unread_contents?: any[] // 默认为空数组
|
||||||
|
// 错误信息
|
||||||
|
err_msg?: string | null // 默认为 null
|
||||||
|
}
|
||||||
|
|
||||||
// 正在下载
|
// 正在下载
|
||||||
export interface DownloadingInfo {
|
export interface DownloadingInfo {
|
||||||
// HASH
|
// HASH
|
||||||
|
|||||||
@@ -2,16 +2,13 @@
|
|||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { useToast } from 'vue-toast-notification'
|
import { useToast } from 'vue-toast-notification'
|
||||||
import SiteAddEditDialog from '../dialog/SiteAddEditDialog.vue'
|
import SiteAddEditDialog from '../dialog/SiteAddEditDialog.vue'
|
||||||
import SiteTorrentTable from '../table/SiteTorrentTable.vue'
|
import SiteUserDataDialog from '../dialog/SiteUserDataDialog.vue'
|
||||||
import { requiredValidator } from '@/@validators'
|
import SiteResourceDialog from '../dialog/SiteResourceDialog.vue'
|
||||||
|
import SiteCookieUpdateDialog from '../dialog/SiteCookieUpdateDialog.vue'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { Site, SiteStatistic } from '@/api/types'
|
import type { Site, SiteStatistic } from '@/api/types'
|
||||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||||
import { useDisplay } from 'vuetify'
|
import { VCardActions, VExpandTransition, VSpacer } from 'vuetify/lib/components/index.mjs'
|
||||||
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
|
||||||
|
|
||||||
// 显示器宽度
|
|
||||||
const display = useDisplay()
|
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const cardProps = defineProps({
|
const cardProps = defineProps({
|
||||||
@@ -23,9 +20,6 @@ const cardProps = defineProps({
|
|||||||
// 定义触发的自定义事件
|
// 定义触发的自定义事件
|
||||||
const emit = defineEmits(['update', 'remove'])
|
const emit = defineEmits(['update', 'remove'])
|
||||||
|
|
||||||
// 密码输入
|
|
||||||
const isPasswordVisible = ref(false)
|
|
||||||
|
|
||||||
// 图标
|
// 图标
|
||||||
const siteIcon = ref<string>('')
|
const siteIcon = ref<string>('')
|
||||||
|
|
||||||
@@ -38,9 +32,6 @@ const testButtonText = ref('测试')
|
|||||||
// 测试按钮可用性
|
// 测试按钮可用性
|
||||||
const testButtonDisable = ref(false)
|
const testButtonDisable = ref(false)
|
||||||
|
|
||||||
// 更新按钮可用性
|
|
||||||
const updateButtonDisable = ref(false)
|
|
||||||
|
|
||||||
// 更新站点Cookie UA弹窗
|
// 更新站点Cookie UA弹窗
|
||||||
const siteCookieDialog = ref(false)
|
const siteCookieDialog = ref(false)
|
||||||
|
|
||||||
@@ -50,18 +41,11 @@ const siteEditDialog = ref(false)
|
|||||||
// 资源浏览弹窗
|
// 资源浏览弹窗
|
||||||
const resourceDialog = ref(false)
|
const resourceDialog = ref(false)
|
||||||
|
|
||||||
// 进度条
|
// 用户数据弹窗
|
||||||
const progressDialog = ref(false)
|
const siteUserDataDialog = ref(false)
|
||||||
|
|
||||||
// 进度文本
|
// 站点操作显示
|
||||||
const progressText = ref('请稍候 ...')
|
const siteActionShow = ref(false)
|
||||||
|
|
||||||
// 用户名密码表单
|
|
||||||
const userPwForm = ref({
|
|
||||||
username: '',
|
|
||||||
password: '',
|
|
||||||
code: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
// 站点使用统计
|
// 站点使用统计
|
||||||
const siteStats = ref<SiteStatistic>({})
|
const siteStats = ref<SiteStatistic>({})
|
||||||
@@ -113,34 +97,9 @@ async function handleResourceBrowse() {
|
|||||||
resourceDialog.value = true
|
resourceDialog.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用API,更新站点Cookie UA
|
// 打开站点用户数据弹窗
|
||||||
async function updateSiteCookie() {
|
async function handleSiteUserData() {
|
||||||
try {
|
siteUserDataDialog.value = true
|
||||||
if (!userPwForm.value.username || !userPwForm.value.password) return
|
|
||||||
|
|
||||||
// 更新按钮状态
|
|
||||||
siteCookieDialog.value = false
|
|
||||||
updateButtonDisable.value = true
|
|
||||||
|
|
||||||
progressDialog.value = true
|
|
||||||
progressText.value = `正在更新 ${cardProps.site?.name} Cookie & UA ...`
|
|
||||||
|
|
||||||
const result: { [key: string]: any } = await api.get(`site/cookie/${cardProps.site?.id}`, {
|
|
||||||
params: {
|
|
||||||
username: userPwForm.value.username,
|
|
||||||
password: userPwForm.value.password,
|
|
||||||
code: userPwForm.value.code,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
if (result.success) $toast.success(`${cardProps.site?.name} 更新Cookie & UA 成功!`)
|
|
||||||
else $toast.error(`${cardProps.site?.name} 更新失败:${result.message}`)
|
|
||||||
|
|
||||||
progressDialog.value = false
|
|
||||||
updateButtonDisable.value = false
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开站点页面
|
// 打开站点页面
|
||||||
@@ -162,17 +121,24 @@ const statColor = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 监听resourceDialog,如果为false则重新查询站点使用统计
|
|
||||||
watch(resourceDialog, value => {
|
|
||||||
if (!value) getSiteStats()
|
|
||||||
})
|
|
||||||
|
|
||||||
// 保存站点
|
// 保存站点
|
||||||
function saveSite() {
|
function saveSite() {
|
||||||
siteEditDialog.value = false
|
siteEditDialog.value = false
|
||||||
emit('update')
|
emit('update')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新站点Cookie UA后的回调
|
||||||
|
function onSiteCookieUpdated() {
|
||||||
|
siteCookieDialog.value = false
|
||||||
|
getSiteStats()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 资源浏览弹窗关闭后的回调
|
||||||
|
function onSiteResourceDone() {
|
||||||
|
resourceDialog.value = false
|
||||||
|
getSiteStats()
|
||||||
|
}
|
||||||
|
|
||||||
// 装载时查询站点图标
|
// 装载时查询站点图标
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getSiteIcon()
|
getSiteIcon()
|
||||||
@@ -194,7 +160,7 @@ onMounted(() => {
|
|||||||
<VImg :src="siteIcon" />
|
<VImg :src="siteIcon" />
|
||||||
</VAvatar>
|
</VAvatar>
|
||||||
</template>
|
</template>
|
||||||
<VCardItem style="padding-block-end: 0;">
|
<VCardItem style="padding-block-end: 0">
|
||||||
<VCardTitle class="font-bold">
|
<VCardTitle class="font-bold">
|
||||||
<span @click.stop="openSitePage">{{ cardProps.site?.name }}</span>
|
<span @click.stop="openSitePage">{{ cardProps.site?.name }}</span>
|
||||||
</VCardTitle>
|
</VCardTitle>
|
||||||
@@ -202,7 +168,7 @@ onMounted(() => {
|
|||||||
<span @click.stop="openSitePage">{{ cardProps.site?.url }}</span>
|
<span @click.stop="openSitePage">{{ cardProps.site?.url }}</span>
|
||||||
</VCardSubtitle>
|
</VCardSubtitle>
|
||||||
</VCardItem>
|
</VCardItem>
|
||||||
<VCardText class="py-2" style="block-size: 36px;">
|
<VCardText class="py-2" style="block-size: 36px">
|
||||||
<VTooltip v-if="cardProps.site?.limit_interval" text="流控">
|
<VTooltip v-if="cardProps.site?.limit_interval" text="流控">
|
||||||
<template #activator="{ props }">
|
<template #activator="{ props }">
|
||||||
<VIcon color="primary" class="me-2" v-bind="props" icon="mdi-speedometer" />
|
<VIcon color="primary" class="me-2" v-bind="props" icon="mdi-speedometer" />
|
||||||
@@ -224,67 +190,55 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</VTooltip>
|
</VTooltip>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
<VDivider />
|
|
||||||
<VCardActions>
|
<VCardActions>
|
||||||
<VBtn v-if="!cardProps.site?.public" :disabled="updateButtonDisable" @click.stop="handleSiteUpdate">
|
<VBtn
|
||||||
<template #prepend>
|
:icon="siteActionShow ? 'mdi-chevron-up' : 'mdi-chevron-down'"
|
||||||
<VIcon icon="mdi-refresh" />
|
@click.stop="siteActionShow = !siteActionShow"
|
||||||
</template>
|
/>
|
||||||
更新
|
<VSpacer />
|
||||||
</VBtn>
|
|
||||||
<VBtn :disabled="testButtonDisable" @click.stop="testSite">
|
|
||||||
<template #prepend>
|
|
||||||
<VIcon icon="mdi-link" />
|
|
||||||
</template>
|
|
||||||
{{ testButtonText }}
|
|
||||||
</VBtn>
|
|
||||||
<VBtn @click.stop="handleResourceBrowse">
|
|
||||||
<template #prepend>
|
|
||||||
<VIcon icon="mdi-web" />
|
|
||||||
</template>
|
|
||||||
浏览
|
|
||||||
</VBtn>
|
|
||||||
</VCardActions>
|
</VCardActions>
|
||||||
|
<VDivider class="mb-1" v-if="siteActionShow" />
|
||||||
|
<VExpandTransition>
|
||||||
|
<div v-show="siteActionShow" class="py-1 pe-12">
|
||||||
|
<VBtn v-if="!cardProps.site?.public" @click.stop="handleSiteUpdate" variant="text">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-refresh" />
|
||||||
|
</template>
|
||||||
|
更新
|
||||||
|
</VBtn>
|
||||||
|
<VBtn :disabled="testButtonDisable" @click.stop="testSite" variant="text">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-link" />
|
||||||
|
</template>
|
||||||
|
{{ testButtonText }}
|
||||||
|
</VBtn>
|
||||||
|
<VBtn @click.stop="handleResourceBrowse" variant="text">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-web" />
|
||||||
|
</template>
|
||||||
|
浏览
|
||||||
|
</VBtn>
|
||||||
|
<VBtn @click.stop="handleSiteUserData" variant="text">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-chart-bell-curve" />
|
||||||
|
</template>
|
||||||
|
数据
|
||||||
|
</VBtn>
|
||||||
|
</div>
|
||||||
|
</VExpandTransition>
|
||||||
<StatIcon v-if="cardProps.site?.is_active" :color="statColor" />
|
<StatIcon v-if="cardProps.site?.is_active" :color="statColor" />
|
||||||
<span class="absolute top-1 right-8">
|
<span class="absolute top-1 right-8">
|
||||||
<VIcon class="cursor-move">mdi-drag</VIcon>
|
<VIcon class="cursor-move">mdi-drag</VIcon>
|
||||||
</span>
|
</span>
|
||||||
</VCard>
|
</VCard>
|
||||||
<!-- 更新站点Cookie & UA弹窗 -->
|
<!-- 更新站点Cookie & UA弹窗 -->
|
||||||
<VDialog v-model="siteCookieDialog" max-width="50rem">
|
<SiteCookieUpdateDialog
|
||||||
<!-- Dialog Content -->
|
v-if="siteCookieDialog"
|
||||||
<VCard title="更新站点Cookie & UA">
|
v-model="siteCookieDialog"
|
||||||
<DialogCloseBtn @click="siteCookieDialog = false" />
|
:site="cardProps.site"
|
||||||
<VCardText>
|
@close="siteCookieDialog = false"
|
||||||
<VForm @submit.prevent="() => {}">
|
@done="onSiteCookieUpdated"
|
||||||
<VRow>
|
/>
|
||||||
<VCol cols="12" md="4">
|
|
||||||
<VTextField v-model="userPwForm.username" label="用户名" :rules="[requiredValidator]" />
|
|
||||||
</VCol>
|
|
||||||
<VCol cols="12" md="4">
|
|
||||||
<VTextField
|
|
||||||
v-model="userPwForm.password"
|
|
||||||
label="密码"
|
|
||||||
:type="isPasswordVisible ? 'text' : 'password'"
|
|
||||||
:append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
|
||||||
:rules="[requiredValidator]"
|
|
||||||
@click:append-inner="isPasswordVisible = !isPasswordVisible"
|
|
||||||
@keydown.enter="updateSiteCookie"
|
|
||||||
/>
|
|
||||||
</VCol>
|
|
||||||
<VCol cols="12" md="4">
|
|
||||||
<VTextField v-model="userPwForm.code" label="两步验证" />
|
|
||||||
</VCol>
|
|
||||||
</VRow>
|
|
||||||
</VForm>
|
|
||||||
</VCardText>
|
|
||||||
|
|
||||||
<VCardActions>
|
|
||||||
<VSpacer />
|
|
||||||
<VBtn variant="elevated" @click="updateSiteCookie" prepend-icon="mdi-refresh" class="px-5"> 开始更新 </VBtn>
|
|
||||||
</VCardActions>
|
|
||||||
</VCard>
|
|
||||||
</VDialog>
|
|
||||||
<!-- 站点编辑弹窗 -->
|
<!-- 站点编辑弹窗 -->
|
||||||
<SiteAddEditDialog
|
<SiteAddEditDialog
|
||||||
v-if="siteEditDialog"
|
v-if="siteEditDialog"
|
||||||
@@ -294,30 +248,19 @@ onMounted(() => {
|
|||||||
@remove="emit('remove')"
|
@remove="emit('remove')"
|
||||||
@close="siteEditDialog = false"
|
@close="siteEditDialog = false"
|
||||||
/>
|
/>
|
||||||
|
<!-- 站点数据弹窗 -->
|
||||||
|
<SiteUserDataDialog
|
||||||
|
v-if="siteUserDataDialog"
|
||||||
|
v-model="siteUserDataDialog"
|
||||||
|
:site="cardProps.site"
|
||||||
|
@close="siteUserDataDialog = false"
|
||||||
|
/>
|
||||||
<!-- 站点资源弹窗 -->
|
<!-- 站点资源弹窗 -->
|
||||||
<VDialog
|
<SiteResourceDialog
|
||||||
v-if="resourceDialog"
|
v-if="resourceDialog"
|
||||||
v-model="resourceDialog"
|
v-model="resourceDialog"
|
||||||
max-width="80rem"
|
:site="cardProps.site"
|
||||||
scrollable
|
@close="onSiteResourceDone"
|
||||||
z-index="1010"
|
/>
|
||||||
:fullscreen="!display.mdAndUp.value"
|
|
||||||
>
|
|
||||||
<VCard :title="`浏览站点 - ${cardProps.site?.name}`">
|
|
||||||
<DialogCloseBtn @click="resourceDialog = false" />
|
|
||||||
<VDivider />
|
|
||||||
<VCardText class="pt-2">
|
|
||||||
<SiteTorrentTable :site="cardProps.site?.id" />
|
|
||||||
</VCardText>
|
|
||||||
</VCard>
|
|
||||||
</VDialog>
|
|
||||||
<!-- 进度框 -->
|
|
||||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.v-table th {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ const siteForm = ref<Site>({
|
|||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|
||||||
|
// 维护类型
|
||||||
|
const siteType = ref('cookie')
|
||||||
|
|
||||||
|
// 是否限流
|
||||||
|
const isLimit = ref(false)
|
||||||
|
|
||||||
// 状态下拉项
|
// 状态下拉项
|
||||||
const statusItems = [
|
const statusItems = [
|
||||||
{ title: '启用', value: true },
|
{ title: '启用', value: true },
|
||||||
@@ -106,6 +112,15 @@ async function deleteSiteInfo() {
|
|||||||
async function updateSiteInfo() {
|
async function updateSiteInfo() {
|
||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
|
if (isLimit.value) {
|
||||||
|
siteForm.value.limit_interval = siteForm.value.limit_interval || 0
|
||||||
|
siteForm.value.limit_count = siteForm.value.limit_count || 0
|
||||||
|
siteForm.value.limit_seconds = siteForm.value.limit_seconds || 0
|
||||||
|
} else {
|
||||||
|
siteForm.value.limit_interval = 0
|
||||||
|
siteForm.value.limit_count = 0
|
||||||
|
siteForm.value.limit_seconds = 0
|
||||||
|
}
|
||||||
const result: { [key: string]: any } = await api.put('site/', siteForm.value)
|
const result: { [key: string]: any } = await api.put('site/', siteForm.value)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
$toast.success(`${siteForm.value?.name} 更新成功!`)
|
$toast.success(`${siteForm.value?.name} 更新成功!`)
|
||||||
@@ -120,9 +135,12 @@ async function updateSiteInfo() {
|
|||||||
doneNProgress()
|
doneNProgress()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
if (props.oper !== 'add') {
|
if (props.oper !== 'add') {
|
||||||
fetchSiteInfo()
|
await fetchSiteInfo()
|
||||||
|
if (siteForm.value.limit_interval || siteForm.value.limit_count || siteForm.value.limit_seconds)
|
||||||
|
isLimit.value = true
|
||||||
|
if (siteForm.value.apikey) siteType.value = 'api'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -179,35 +197,69 @@ onMounted(() => {
|
|||||||
<VCol cols="12" md="3">
|
<VCol cols="12" md="3">
|
||||||
<VTextField v-model="siteForm.timeout" label="超时时间(秒)" hint="站点请求超时时间" persistent-hint />
|
<VTextField v-model="siteForm.timeout" label="超时时间(秒)" hint="站点请求超时时间" persistent-hint />
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="12">
|
</VRow>
|
||||||
<VTextarea v-model="siteForm.cookie" label="站点Cookie" hint="站点请求头中的Cookie信息" persistent-hint />
|
<VTabs v-model="siteType" show-arrows class="v-tabs-pill mt-3">
|
||||||
</VCol>
|
<VTab selected-class="v-tab--selected">
|
||||||
<VCol cols="12" md="6">
|
<div>
|
||||||
<VTextField
|
<VIcon size="20" start icon="mdi-cookie" value="cookie" />
|
||||||
v-model="siteForm.token"
|
Cookie
|
||||||
label="请求头(Authorization)"
|
</div>
|
||||||
hint="站点请求头中的Authorization信息,特殊站点需要"
|
</VTab>
|
||||||
persistent-hint
|
<VTab selected-class="v-tab--selected">
|
||||||
/>
|
<div>
|
||||||
</VCol>
|
<VIcon size="20" start icon="mdi-api" value="api" />
|
||||||
<VCol cols="12" md="6">
|
API
|
||||||
<VTextField
|
</div>
|
||||||
v-model="siteForm.apikey"
|
</VTab>
|
||||||
label="令牌(API Key)"
|
</VTabs>
|
||||||
hint="站点的访问API Key,特殊站点需要"
|
<VWindow v-model="siteType" class="my-3 disable-tab-transition" :touch="false">
|
||||||
persistent-hint
|
<VWindowItem value="cookie">
|
||||||
/>
|
<VRow>
|
||||||
</VCol>
|
<VCol cols="12">
|
||||||
<VCol cols="12">
|
<VTextarea
|
||||||
<VTextField
|
v-model="siteForm.cookie"
|
||||||
v-model="siteForm.ua"
|
label="站点Cookie"
|
||||||
label="站点User-Agent"
|
hint="站点请求头中的Cookie信息"
|
||||||
hint="获取Cookie的浏览器对应的User-Agent"
|
persistent-hint
|
||||||
persistent-hint
|
/>
|
||||||
/>
|
</VCol>
|
||||||
|
<VCol cols="12">
|
||||||
|
<VTextField
|
||||||
|
v-model="siteForm.ua"
|
||||||
|
label="站点User-Agent"
|
||||||
|
hint="获取Cookie的浏览器对应的User-Agent"
|
||||||
|
persistent-hint
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
</VWindowItem>
|
||||||
|
<VWindowItem value="api">
|
||||||
|
<VRow>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VTextField
|
||||||
|
v-model="siteForm.token"
|
||||||
|
label="请求头(Authorization)"
|
||||||
|
hint="站点请求头中的Authorization信息,特殊站点需要"
|
||||||
|
persistent-hint
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VTextField
|
||||||
|
v-model="siteForm.apikey"
|
||||||
|
label="令牌(API Key)"
|
||||||
|
hint="站点的访问API Key,特殊站点需要"
|
||||||
|
persistent-hint
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
</VWindowItem>
|
||||||
|
</VWindow>
|
||||||
|
<VRow>
|
||||||
|
<VCol cols="12" md="4">
|
||||||
|
<VSwitch v-model="isLimit" label="限制站点访问频率" />
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
<VRow>
|
<VRow v-if="isLimit">
|
||||||
<VCol cols="12" md="4">
|
<VCol cols="12" md="4">
|
||||||
<VTextField
|
<VTextField
|
||||||
v-model="siteForm.limit_interval"
|
v-model="siteForm.limit_interval"
|
||||||
@@ -238,10 +290,15 @@ onMounted(() => {
|
|||||||
</VRow>
|
</VRow>
|
||||||
<VRow>
|
<VRow>
|
||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<VSwitch v-model="siteForm.proxy" label="代理" hint="使用代理服务器访问该站点" persistent-hint />
|
<VSwitch v-model="siteForm.proxy" label="使用代理访问" hint="使用代理服务器访问该站点" persistent-hint />
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<VSwitch v-model="siteForm.render" label="仿真" hint="使用浏览器模拟真实访问该站点" persistent-hint />
|
<VSwitch
|
||||||
|
v-model="siteForm.render"
|
||||||
|
label="浏览器仿真"
|
||||||
|
hint="使用浏览器模拟真实访问该站点"
|
||||||
|
persistent-hint
|
||||||
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
</VForm>
|
</VForm>
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import api from '@/api'
|
||||||
|
import { Site } from '@/api/types'
|
||||||
|
import { requiredValidator } from '@/@validators'
|
||||||
|
import { useToast } from 'vue-toast-notification'
|
||||||
|
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const cardProps = defineProps({
|
||||||
|
site: Object as PropType<Site>,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 定义触发的自定义事件
|
||||||
|
const emit = defineEmits(['close', 'done'])
|
||||||
|
|
||||||
|
// 提示框
|
||||||
|
const $toast = useToast()
|
||||||
|
|
||||||
|
// 用户名密码表单
|
||||||
|
const userPwForm = ref({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
code: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 密码输入
|
||||||
|
const isPasswordVisible = ref(false)
|
||||||
|
|
||||||
|
// 更新按钮可用性
|
||||||
|
const updateButtonDisable = ref(false)
|
||||||
|
|
||||||
|
// 进度条
|
||||||
|
const progressDialog = ref(false)
|
||||||
|
|
||||||
|
// 进度文本
|
||||||
|
const progressText = ref('请稍候 ...')
|
||||||
|
|
||||||
|
// 调用API,更新站点Cookie UA
|
||||||
|
async function updateSiteCookie() {
|
||||||
|
try {
|
||||||
|
if (!userPwForm.value.username || !userPwForm.value.password) return
|
||||||
|
|
||||||
|
// 更新按钮状态
|
||||||
|
updateButtonDisable.value = true
|
||||||
|
|
||||||
|
progressDialog.value = true
|
||||||
|
progressText.value = `正在更新 ${cardProps.site?.name} Cookie & UA ...`
|
||||||
|
|
||||||
|
const result: { [key: string]: any } = await api.get(`site/cookie/${cardProps.site?.id}`, {
|
||||||
|
params: {
|
||||||
|
username: userPwForm.value.username,
|
||||||
|
password: userPwForm.value.password,
|
||||||
|
code: userPwForm.value.code,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
$toast.success(`${cardProps.site?.name} 更新Cookie & UA 成功!`)
|
||||||
|
emit('done')
|
||||||
|
} else $toast.error(`${cardProps.site?.name} 更新失败:${result.message}`)
|
||||||
|
|
||||||
|
progressDialog.value = false
|
||||||
|
updateButtonDisable.value = false
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VDialog max-width="50rem">
|
||||||
|
<!-- Dialog Content -->
|
||||||
|
<VCard title="更新站点Cookie & UA">
|
||||||
|
<DialogCloseBtn @click="emit('close')" />
|
||||||
|
<VCardText>
|
||||||
|
<VForm @submit.prevent="() => {}">
|
||||||
|
<VRow>
|
||||||
|
<VCol cols="12" md="4">
|
||||||
|
<VTextField v-model="userPwForm.username" label="用户名" :rules="[requiredValidator]" />
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="4">
|
||||||
|
<VTextField
|
||||||
|
v-model="userPwForm.password"
|
||||||
|
label="密码"
|
||||||
|
:type="isPasswordVisible ? 'text' : 'password'"
|
||||||
|
:append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
||||||
|
:rules="[requiredValidator]"
|
||||||
|
@click:append-inner="isPasswordVisible = !isPasswordVisible"
|
||||||
|
@keydown.enter="updateSiteCookie"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="4">
|
||||||
|
<VTextField v-model="userPwForm.code" label="两步验证" />
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
</VForm>
|
||||||
|
</VCardText>
|
||||||
|
|
||||||
|
<VCardActions>
|
||||||
|
<VSpacer />
|
||||||
|
<VBtn
|
||||||
|
variant="elevated"
|
||||||
|
@click="updateSiteCookie"
|
||||||
|
:disabled="updateButtonDisable"
|
||||||
|
prepend-icon="mdi-refresh"
|
||||||
|
class="px-5"
|
||||||
|
>
|
||||||
|
开始更新
|
||||||
|
</VBtn>
|
||||||
|
</VCardActions>
|
||||||
|
</VCard>
|
||||||
|
<!-- 进度框 -->
|
||||||
|
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
||||||
|
</VDialog>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { Site } from '@/api/types'
|
||||||
|
import { useDisplay } from 'vuetify'
|
||||||
|
import api from '@/api'
|
||||||
|
import type { TorrentInfo } from '@/api/types'
|
||||||
|
import { formatFileSize } from '@core/utils/formatters'
|
||||||
|
import AddDownloadDialog from '../dialog/AddDownloadDialog.vue'
|
||||||
|
|
||||||
|
// 显示器宽度
|
||||||
|
const display = useDisplay()
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
site: Object as PropType<Site>,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 注册事件
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
// 数据列表
|
||||||
|
const resourceDataList = ref<TorrentInfo[]>([])
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const resourceSearch = ref('')
|
||||||
|
|
||||||
|
// 总条数
|
||||||
|
const resourceTotalItems = ref(0)
|
||||||
|
|
||||||
|
// 每页条数
|
||||||
|
const resourceItemsPerPage = ref(25)
|
||||||
|
|
||||||
|
// 加载状态
|
||||||
|
const resourceLoading = ref(false)
|
||||||
|
|
||||||
|
// 种子元数据
|
||||||
|
const torrent = ref<TorrentInfo>()
|
||||||
|
|
||||||
|
// 资源浏览表头
|
||||||
|
const resourceHeaders = [
|
||||||
|
{ title: '标题', key: 'title', sortable: false },
|
||||||
|
{ title: '时间', key: 'pubdate', sortable: true },
|
||||||
|
{ title: '大小', key: 'size', sortable: true },
|
||||||
|
{ title: '做种', key: 'seeders', sortable: true },
|
||||||
|
{ title: '下载', key: 'peers', sortable: true },
|
||||||
|
{ title: '', key: 'actions', sortable: false },
|
||||||
|
]
|
||||||
|
|
||||||
|
// 打开种子详情页面
|
||||||
|
function openTorrentDetail(page_url: string) {
|
||||||
|
window.open(page_url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载种子文件
|
||||||
|
async function downloadTorrentFile(enclosure: string) {
|
||||||
|
window.open(enclosure, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用API,查询站点资源
|
||||||
|
async function getResourceList() {
|
||||||
|
resourceLoading.value = true
|
||||||
|
try {
|
||||||
|
resourceDataList.value = await api.get(`site/resource/${props.site?.id}`)
|
||||||
|
resourceLoading.value = false
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 促销Chip类
|
||||||
|
function getVolumeFactorClass(downloadVolume: number, uploadVolume: number) {
|
||||||
|
if (downloadVolume === 0) return 'text-white bg-lime-500'
|
||||||
|
else if (downloadVolume < 1) return 'text-white bg-green-500'
|
||||||
|
else if (uploadVolume !== 1) return 'text-white bg-sky-500'
|
||||||
|
else return 'text-white bg-gray-500'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加下载
|
||||||
|
async function addDownload(_torrent: any) {
|
||||||
|
torrent.value = _torrent
|
||||||
|
addDownloadDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加下载对话框
|
||||||
|
const addDownloadDialog = ref(false)
|
||||||
|
|
||||||
|
// 添加下载成功
|
||||||
|
function addDownloadSuccess(url: string) {
|
||||||
|
addDownloadDialog.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加下载失败
|
||||||
|
function addDownloadError(error: string) {
|
||||||
|
addDownloadDialog.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 装载时查询站点图标
|
||||||
|
onMounted(() => {
|
||||||
|
getResourceList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VDialog max-width="80rem" scrollable z-index="1010" :fullscreen="!display.mdAndUp.value">
|
||||||
|
<VCard :title="`浏览 - ${props.site?.name}`">
|
||||||
|
<DialogCloseBtn @click="emit('close')" />
|
||||||
|
<VDivider />
|
||||||
|
<VCardText class="pt-2">
|
||||||
|
<VDataTable
|
||||||
|
v-model:items-per-page="resourceItemsPerPage"
|
||||||
|
:headers="resourceHeaders"
|
||||||
|
:items="resourceDataList"
|
||||||
|
:items-length="resourceTotalItems"
|
||||||
|
:search="resourceSearch"
|
||||||
|
:loading="resourceLoading"
|
||||||
|
density="compact"
|
||||||
|
item-value="title"
|
||||||
|
return-object
|
||||||
|
fixed-header
|
||||||
|
hover
|
||||||
|
items-per-page-text="每页条数"
|
||||||
|
page-text="{0}-{1} 共 {2} 条"
|
||||||
|
loading-text="加载中..."
|
||||||
|
>
|
||||||
|
<template #item.title="{ item }">
|
||||||
|
<a href="javascript:void(0)" @click.stop="addDownload(item)">
|
||||||
|
<div class="text-high-emphasis pt-1">
|
||||||
|
{{ item.title }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm my-1">
|
||||||
|
{{ item.description }}
|
||||||
|
</div>
|
||||||
|
<VChip v-if="item.hit_and_run" variant="elevated" size="small" class="me-1 mb-1 text-white bg-black">
|
||||||
|
H&R
|
||||||
|
</VChip>
|
||||||
|
<VChip v-if="item.freedate_diff" variant="elevated" color="secondary" size="small" class="me-1 mb-1">
|
||||||
|
{{ item.freedate_diff }}
|
||||||
|
</VChip>
|
||||||
|
<VChip
|
||||||
|
v-for="(label, index) in item.labels"
|
||||||
|
:key="index"
|
||||||
|
variant="elevated"
|
||||||
|
size="small"
|
||||||
|
color="primary"
|
||||||
|
class="me-1 mb-1"
|
||||||
|
>
|
||||||
|
{{ label }}
|
||||||
|
</VChip>
|
||||||
|
<VChip
|
||||||
|
v-if="item.downloadvolumefactor !== 1 || item.uploadvolumefactor !== 1"
|
||||||
|
:class="getVolumeFactorClass(item.downloadvolumefactor, item.uploadvolumefactor)"
|
||||||
|
variant="elevated"
|
||||||
|
size="small"
|
||||||
|
class="me-1 mb-1"
|
||||||
|
>
|
||||||
|
{{ item.volume_factor }}
|
||||||
|
</VChip>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template #item.pubdate="{ item }">
|
||||||
|
<div>{{ item.date_elapsed }}</div>
|
||||||
|
<div class="text-sm">
|
||||||
|
{{ item.pubdate }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #item.size="{ item }">
|
||||||
|
<div class="text-nowrap whitespace-nowrap">
|
||||||
|
{{ formatFileSize(item.size) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #item.seeders="{ item }">
|
||||||
|
<div>{{ item.seeders }}</div>
|
||||||
|
</template>
|
||||||
|
<template #item.peers="{ item }">
|
||||||
|
<div>{{ item.peers }}</div>
|
||||||
|
</template>
|
||||||
|
<template #item.actions="{ item }">
|
||||||
|
<div class="me-n3">
|
||||||
|
<IconBtn>
|
||||||
|
<VIcon icon="mdi-dots-vertical" />
|
||||||
|
<VMenu activator="parent" close-on-content-click>
|
||||||
|
<VList>
|
||||||
|
<VListItem variant="plain" @click="openTorrentDetail(item.page_url || '')">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-information" />
|
||||||
|
</template>
|
||||||
|
<VListItemTitle>查看详情</VListItemTitle>
|
||||||
|
</VListItem>
|
||||||
|
<VListItem
|
||||||
|
v-if="item.enclosure?.startsWith('http')"
|
||||||
|
variant="plain"
|
||||||
|
@click="downloadTorrentFile(item.enclosure)"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-download" />
|
||||||
|
</template>
|
||||||
|
<VListItemTitle>下载种子文件</VListItemTitle>
|
||||||
|
</VListItem>
|
||||||
|
</VList>
|
||||||
|
</VMenu>
|
||||||
|
</IconBtn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #no-data> 没有数据 </template>
|
||||||
|
</VDataTable>
|
||||||
|
</VCardText>
|
||||||
|
</VCard>
|
||||||
|
<!-- 添加下载对话框 -->
|
||||||
|
<AddDownloadDialog
|
||||||
|
v-if="addDownloadDialog"
|
||||||
|
v-model="addDownloadDialog"
|
||||||
|
:torrent="torrent"
|
||||||
|
@done="addDownloadSuccess"
|
||||||
|
@error="addDownloadError"
|
||||||
|
@close="addDownloadDialog = false"
|
||||||
|
/>
|
||||||
|
</VDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.v-table th {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { Site, SiteUserData } from '@/api/types'
|
||||||
|
import api from '@/api'
|
||||||
|
import { useDisplay } from 'vuetify'
|
||||||
|
|
||||||
|
// 显示器宽度
|
||||||
|
const display = useDisplay()
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
site: Object as PropType<Site>,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 注册事件
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
// 站点数据列表
|
||||||
|
const siteDatas = ref<SiteUserData[]>([])
|
||||||
|
|
||||||
|
// 查询站点用户数据
|
||||||
|
async function fetchSiteUserData() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(`site/userdata/${props.site?.id}`)
|
||||||
|
if (result.success) siteDatas.value = result.data
|
||||||
|
console.log(result)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
fetchSiteUserData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VDialog scrollable eager max-width="50rem" :fullscreen="!display.mdAndUp.value">
|
||||||
|
<VCard :title="`数据 - ${props.site?.name}`" class="rounded-t">
|
||||||
|
<DialogCloseBtn @click="emit('close')" />
|
||||||
|
<VCardText> </VCardText>
|
||||||
|
</VCard>
|
||||||
|
</VDialog>
|
||||||
|
</template>
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import api from '@/api'
|
|
||||||
import type { TorrentInfo } from '@/api/types'
|
|
||||||
import { formatFileSize } from '@core/utils/formatters'
|
|
||||||
import AddDownloadDialog from '../dialog/AddDownloadDialog.vue'
|
|
||||||
|
|
||||||
// 输入参数
|
|
||||||
const props = defineProps({
|
|
||||||
site: Number,
|
|
||||||
width: String,
|
|
||||||
height: String,
|
|
||||||
})
|
|
||||||
|
|
||||||
// 数据列表
|
|
||||||
const resourceDataList = ref<TorrentInfo[]>([])
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const resourceSearch = ref('')
|
|
||||||
|
|
||||||
// 总条数
|
|
||||||
const resourceTotalItems = ref(0)
|
|
||||||
|
|
||||||
// 每页条数
|
|
||||||
const resourceItemsPerPage = ref(25)
|
|
||||||
|
|
||||||
// 加载状态
|
|
||||||
const resourceLoading = ref(false)
|
|
||||||
|
|
||||||
// 种子元数据
|
|
||||||
const torrent = ref<TorrentInfo>()
|
|
||||||
|
|
||||||
// 资源浏览表头
|
|
||||||
const resourceHeaders = [
|
|
||||||
{ title: '标题', key: 'title', sortable: false },
|
|
||||||
{ title: '时间', key: 'pubdate', sortable: true },
|
|
||||||
{ title: '大小', key: 'size', sortable: true },
|
|
||||||
{ title: '做种', key: 'seeders', sortable: true },
|
|
||||||
{ title: '下载', key: 'peers', sortable: true },
|
|
||||||
{ title: '', key: 'actions', sortable: false },
|
|
||||||
]
|
|
||||||
|
|
||||||
// 打开种子详情页面
|
|
||||||
function openTorrentDetail(page_url: string) {
|
|
||||||
window.open(page_url, '_blank')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下载种子文件
|
|
||||||
async function downloadTorrentFile(enclosure: string) {
|
|
||||||
window.open(enclosure, '_blank')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用API,查询站点资源
|
|
||||||
async function getResourceList() {
|
|
||||||
resourceLoading.value = true
|
|
||||||
try {
|
|
||||||
resourceDataList.value = await api.get(`site/resource/${props.site}`)
|
|
||||||
resourceLoading.value = false
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 促销Chip类
|
|
||||||
function getVolumeFactorClass(downloadVolume: number, uploadVolume: number) {
|
|
||||||
if (downloadVolume === 0) return 'text-white bg-lime-500'
|
|
||||||
else if (downloadVolume < 1) return 'text-white bg-green-500'
|
|
||||||
else if (uploadVolume !== 1) return 'text-white bg-sky-500'
|
|
||||||
else return 'text-white bg-gray-500'
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加下载
|
|
||||||
async function addDownload(_torrent: any) {
|
|
||||||
torrent.value = _torrent
|
|
||||||
addDownloadDialog.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加下载对话框
|
|
||||||
const addDownloadDialog = ref(false)
|
|
||||||
|
|
||||||
// 添加下载成功
|
|
||||||
function addDownloadSuccess(url: string) {
|
|
||||||
addDownloadDialog.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加下载失败
|
|
||||||
function addDownloadError(error: string) {
|
|
||||||
addDownloadDialog.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 装载时查询站点图标
|
|
||||||
onMounted(() => {
|
|
||||||
getResourceList()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<VDataTable
|
|
||||||
v-model:items-per-page="resourceItemsPerPage"
|
|
||||||
:headers="resourceHeaders"
|
|
||||||
:items="resourceDataList"
|
|
||||||
:items-length="resourceTotalItems"
|
|
||||||
:search="resourceSearch"
|
|
||||||
:loading="resourceLoading"
|
|
||||||
density="compact"
|
|
||||||
item-value="title"
|
|
||||||
return-object
|
|
||||||
fixed-header
|
|
||||||
hover
|
|
||||||
items-per-page-text="每页条数"
|
|
||||||
page-text="{0}-{1} 共 {2} 条"
|
|
||||||
loading-text="加载中..."
|
|
||||||
>
|
|
||||||
<template #item.title="{ item }">
|
|
||||||
<a href="javascript:void(0)" @click.stop="addDownload(item)">
|
|
||||||
<div class="text-high-emphasis pt-1">
|
|
||||||
{{ item.title }}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm my-1">
|
|
||||||
{{ item.description }}
|
|
||||||
</div>
|
|
||||||
<VChip v-if="item.hit_and_run" variant="elevated" size="small" class="me-1 mb-1 text-white bg-black">
|
|
||||||
H&R
|
|
||||||
</VChip>
|
|
||||||
<VChip v-if="item.freedate_diff" variant="elevated" color="secondary" size="small" class="me-1 mb-1">
|
|
||||||
{{ item.freedate_diff }}
|
|
||||||
</VChip>
|
|
||||||
<VChip
|
|
||||||
v-for="(label, index) in item.labels"
|
|
||||||
:key="index"
|
|
||||||
variant="elevated"
|
|
||||||
size="small"
|
|
||||||
color="primary"
|
|
||||||
class="me-1 mb-1"
|
|
||||||
>
|
|
||||||
{{ label }}
|
|
||||||
</VChip>
|
|
||||||
<VChip
|
|
||||||
v-if="item.downloadvolumefactor !== 1 || item.uploadvolumefactor !== 1"
|
|
||||||
:class="getVolumeFactorClass(item.downloadvolumefactor, item.uploadvolumefactor)"
|
|
||||||
variant="elevated"
|
|
||||||
size="small"
|
|
||||||
class="me-1 mb-1"
|
|
||||||
>
|
|
||||||
{{ item.volume_factor }}
|
|
||||||
</VChip>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
<template #item.pubdate="{ item }">
|
|
||||||
<div>{{ item.date_elapsed }}</div>
|
|
||||||
<div class="text-sm">
|
|
||||||
{{ item.pubdate }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #item.size="{ item }">
|
|
||||||
<div class="text-nowrap whitespace-nowrap">
|
|
||||||
{{ formatFileSize(item.size) }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #item.seeders="{ item }">
|
|
||||||
<div>{{ item.seeders }}</div>
|
|
||||||
</template>
|
|
||||||
<template #item.peers="{ item }">
|
|
||||||
<div>{{ item.peers }}</div>
|
|
||||||
</template>
|
|
||||||
<template #item.actions="{ item }">
|
|
||||||
<div class="me-n3">
|
|
||||||
<IconBtn>
|
|
||||||
<VIcon icon="mdi-dots-vertical" />
|
|
||||||
<VMenu activator="parent" close-on-content-click>
|
|
||||||
<VList>
|
|
||||||
<VListItem variant="plain" @click="openTorrentDetail(item.page_url || '')">
|
|
||||||
<template #prepend>
|
|
||||||
<VIcon icon="mdi-information" />
|
|
||||||
</template>
|
|
||||||
<VListItemTitle>查看详情</VListItemTitle>
|
|
||||||
</VListItem>
|
|
||||||
<VListItem
|
|
||||||
v-if="item.enclosure?.startsWith('http')"
|
|
||||||
variant="plain"
|
|
||||||
@click="downloadTorrentFile(item.enclosure)"
|
|
||||||
>
|
|
||||||
<template #prepend>
|
|
||||||
<VIcon icon="mdi-download" />
|
|
||||||
</template>
|
|
||||||
<VListItemTitle>下载种子文件</VListItemTitle>
|
|
||||||
</VListItem>
|
|
||||||
</VList>
|
|
||||||
</VMenu>
|
|
||||||
</IconBtn>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #no-data> 没有数据 </template>
|
|
||||||
</VDataTable>
|
|
||||||
<AddDownloadDialog
|
|
||||||
v-if="addDownloadDialog"
|
|
||||||
v-model="addDownloadDialog"
|
|
||||||
:torrent="torrent"
|
|
||||||
@done="addDownloadSuccess"
|
|
||||||
@error="addDownloadError"
|
|
||||||
@close="addDownloadDialog = false"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
@@ -53,6 +53,12 @@ async function savaSitesPriority() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新站点事件时
|
||||||
|
function onSiteSave() {
|
||||||
|
siteAddDialog.value = false
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
// 加载时获取数据
|
// 加载时获取数据
|
||||||
onBeforeMount(fetchData)
|
onBeforeMount(fetchData)
|
||||||
|
|
||||||
@@ -102,12 +108,7 @@ onActivated(() => {
|
|||||||
v-if="siteAddDialog"
|
v-if="siteAddDialog"
|
||||||
v-model="siteAddDialog"
|
v-model="siteAddDialog"
|
||||||
oper="add"
|
oper="add"
|
||||||
@save="
|
@save="onSiteSave"
|
||||||
() => {
|
|
||||||
siteAddDialog = false
|
|
||||||
fetchData()
|
|
||||||
}
|
|
||||||
"
|
|
||||||
@close="siteAddDialog = false"
|
@close="siteAddDialog = false"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user