全面移除视频,移除域名混淆加载,直接写死,移除展示类型(同步更新)
This commit is contained in:
parent
e128d46a42
commit
d60f230a56
@ -56,21 +56,6 @@
|
||||
</tr>
|
||||
|
||||
</el-dialog>
|
||||
<el-dialog title="查询视频" v-model="chosenVideo" width="100">
|
||||
<table>
|
||||
<tr>视频名字:{{chosenVideo.name}}</tr>
|
||||
<tr>视频网站: <el-link :href="chosenVideo.website">{{chosenVideo.website}}</el-link> </tr>
|
||||
<tr>视频链接: <el-link :href="chosenVideo.link">{{chosenVideo.link}}</el-link></tr>
|
||||
<tr>视频状态:{{chosenVideo.status}}</tr>
|
||||
<tr v-if="!chosenVideo.resolution">
|
||||
目标分辨率: <el-select v-model="targetResolution">
|
||||
<el-option v-for="(resolution) in chosenVideo.availableResolution" :value="resolution" :label="resolution"/>
|
||||
</el-select>
|
||||
</tr>
|
||||
</table>
|
||||
<el-button @click="postTask" v-if="!chosenVideo.resolution">下载</el-button>
|
||||
<el-button @click="deleteVideo" v-if="chosenVideo.resolution">删除</el-button>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="修改授权码" v-model="isAlterAuthCode" width="100">
|
||||
<el-form>
|
||||
@ -131,18 +116,10 @@ let chosenGallery = computed(() => {
|
||||
return store.state.chosenGallery
|
||||
})
|
||||
|
||||
let chosenVideo = computed(() => {
|
||||
return store.state.chosenVideo
|
||||
})
|
||||
|
||||
let loadComplete = computed(() => {
|
||||
return store.state.loadComplete
|
||||
})
|
||||
|
||||
let maskDomain = computed(() => {
|
||||
return store.state.maskDomain
|
||||
})
|
||||
|
||||
let weekUsed = computed(() => {
|
||||
return store.state.weekUsed
|
||||
})
|
||||
@ -178,11 +155,7 @@ function postTask(){
|
||||
return
|
||||
}
|
||||
let tempLink = coverLink(param.value)
|
||||
if(param.value.includes("hentai"))
|
||||
store.dispatch("postGalleryTask", {link: tempLink, targetResolution: targetResolution.value})
|
||||
else
|
||||
store.dispatch("postVideoTask", {link: tempLink, targetResolution: targetResolution.value})
|
||||
|
||||
store.dispatch("postGalleryTask", {link: tempLink, targetResolution: targetResolution.value})
|
||||
targetResolution.value = ""
|
||||
}
|
||||
|
||||
@ -193,10 +166,7 @@ function queryRemoteTask(){
|
||||
return
|
||||
}
|
||||
let tempLink = coverLink(param.value)
|
||||
if(param.value.includes("hentai"))
|
||||
store.dispatch("queryGalleryTask", tempLink)
|
||||
else
|
||||
store.dispatch("queryVideoTask", tempLink)
|
||||
store.dispatch("queryGalleryTask", tempLink)
|
||||
}
|
||||
function queryLocalTask(){
|
||||
switch (type.value){
|
||||
@ -218,9 +188,6 @@ function resetLocalQuery(){
|
||||
}
|
||||
|
||||
//删除任务
|
||||
function deleteVideo(){
|
||||
store.dispatch("deleteVideo", chosenVideo.value.id)
|
||||
}
|
||||
function deleteGallery(){
|
||||
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
||||
}
|
||||
@ -241,28 +208,13 @@ function validate(){
|
||||
function validateLink(rawLink){
|
||||
if(rawLink.trim() === "")
|
||||
return false
|
||||
if(rawLink.includes("hentai")){
|
||||
if(rawLink.includes("hentai"))
|
||||
return rawLink.includes("/g/")
|
||||
}
|
||||
else if(rawLink.includes("xvideos.com")){
|
||||
return true
|
||||
}
|
||||
else if(rawLink.includes("pornhub.com")){
|
||||
return rawLink.includes("view_video.php")
|
||||
}
|
||||
else if(rawLink.includes("xhamster") && rawLink.includes(".com")){
|
||||
return true
|
||||
}
|
||||
else
|
||||
return false
|
||||
}
|
||||
function coverLink(rawLink){
|
||||
if(rawLink.includes("xhamster"))
|
||||
rawLink = "https://zh.xhamster" + rawLink.substring(rawLink.indexOf(".com"))
|
||||
let url = new URL(rawLink)
|
||||
maskDomain.value.forEach((mask) => {
|
||||
if(url.host === mask['raw'])
|
||||
rawLink = rawLink.replace(mask['raw'], mask['mask'])
|
||||
})
|
||||
return rawLink;
|
||||
return rawLink.replace("exhentai.org", "element-plus.org").replace("e-hentai.org", "element.org");
|
||||
}
|
||||
|
||||
//打开面板以及在线阅读
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<el-drawer v-model="isOpenHistoryPanel" direction="ltr" size="100%" @close="closeHistoryPanel" >
|
||||
<div class="side">
|
||||
<div v-show="loadComplete" class="load_complete">
|
||||
<el-table :data="currentTasks" v-show="showType === 'gallery'" :empty-text="emptyText" :row-key="gallery=>gallery.gid">
|
||||
<el-table :data="currentTasks" :empty-text="emptyText" :row-key="gallery=>gallery.gid">
|
||||
|
||||
<el-table-column type="expand" width="25px">
|
||||
<template #default="props">
|
||||
@ -44,48 +44,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-table :data="currentTasks" v-show="showType === 'video'" :empty-text="emptyText" :row-key="video=>video.id">
|
||||
<el-table-column type="expand">
|
||||
<template #default="props">
|
||||
名字:{{props.row.name}} <br>
|
||||
网站:{{props.row.website}} <br>
|
||||
链接:<el-link :href="props.row.link">链接</el-link> <br>
|
||||
文件大小:{{props.row.fileSize}} <br>
|
||||
视频长度:{{props.row.duration}} <br>
|
||||
分辨率:{{props.row.resolution}} <br>
|
||||
任务创建时间:{{props.row.createTimeDisplay}}<br>
|
||||
标签:{{props.row.tag === '' ? '无': props.row.tag}} <br>
|
||||
<span v-show="isLion">
|
||||
downloader:{{props.row.downloader}}
|
||||
</span>
|
||||
<el-button @click="downloadTask(props.row.download)" :disabled="props.row.download === undefined">下载</el-button>
|
||||
<el-button @click="deleteVideo(props.row.id)" :disabled="props.row.download === undefined">删除</el-button>
|
||||
<el-button @click="openVideoPanel(props.row.download)" :disabled="props.row.download === undefined">在线播放</el-button>
|
||||
<el-button @click="editVideoTag(props.row.id, props.row.tag)">编辑标签</el-button>
|
||||
<el-button @click="changeVideoCollect(props.row.id, props.row.isCollect)">{{props.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="名字" width="200">
|
||||
<template #default="scoped">
|
||||
{{scoped.row.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="进度" width="60">
|
||||
<template #default="scoped">
|
||||
{{ scoped.row.progress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<el-row class="pageChanger">
|
||||
<el-col>
|
||||
<el-select v-model="showType" @change="changeShowType" class="el-select" style="width: 75px">
|
||||
<el-option value="gallery" label="本子"/>
|
||||
<el-option value="video" label="视频"/>
|
||||
</el-select>
|
||||
<el-select v-model="category" @change="changeCategory">
|
||||
<template #prefix>
|
||||
分类
|
||||
@ -99,10 +59,10 @@
|
||||
排序
|
||||
</template>
|
||||
<el-option value="name" label="名字"/>
|
||||
<el-option value="shortName" label="简洁名字" v-show="showType === 'gallery'"/>
|
||||
<el-option value="shortName" label="简洁名字"/>
|
||||
<el-option value="createTime" label="任务创建时间"/>
|
||||
</el-select>
|
||||
<el-select v-model="galleryNameType" @change="changeGalleryNameType" v-show="showType === 'gallery'">
|
||||
<el-select v-model="galleryNameType" @change="changeGalleryNameType">
|
||||
<template #prefix>
|
||||
显示
|
||||
</template>
|
||||
@ -140,7 +100,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-footer>
|
||||
<el-button @click="tempGid === '' ? submitVideoTag(): submitGalleryTag()">提交修改</el-button>
|
||||
<el-button @click="submitGalleryTag()">提交修改</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
|
||||
@ -150,9 +110,6 @@
|
||||
:preview-src-list="currentLinks" :initial-index="index" loading="lazy"/>
|
||||
</el-scrollbar>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="isPlaying" @opened="initPlayer()" @closed="destroyPlayer()" width="95%" title="在线预览">
|
||||
<div id="player"></div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -160,7 +117,6 @@ import store from "../store";
|
||||
import {computed, ref} from "vue";
|
||||
import axios from "axios";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Player from "xgplayer";
|
||||
|
||||
//输入
|
||||
let inputNode = ref(null)
|
||||
@ -168,21 +124,13 @@ let inputNode = ref(null)
|
||||
let isEditingPage = ref(false)
|
||||
//是否正在编辑标签
|
||||
let isEditingTag = ref(false)
|
||||
//是否打开播放面板
|
||||
let isPlaying = ref(false)
|
||||
|
||||
//当前视频链接以及播放器实例
|
||||
let current_video_link = ref("")
|
||||
let player = ref()
|
||||
|
||||
//临时变量
|
||||
let tempTag = ref("")
|
||||
let tempGid = ref("")
|
||||
let tempId = ref("")
|
||||
|
||||
let category = ref("myDownload") //myDownload myCollect total
|
||||
let galleryNameType = ref("shortName") // shortName name
|
||||
let showType = ref("gallery") // gallery video collect
|
||||
let sortType = ref("shortName") // shortName name createTime
|
||||
let targetPage = ref(1) // 当前页数
|
||||
|
||||
@ -220,12 +168,11 @@ let isLion = computed(() => {
|
||||
})
|
||||
|
||||
let emptyText = computed(() => {
|
||||
let type = showType.value === 'gallery' ? '本子': '视频'
|
||||
let action = category.value === 'myDownload' ? '下载': '收藏'
|
||||
return '您未' + action + type
|
||||
return '您未' + action + '本子'
|
||||
})
|
||||
|
||||
//在线预览链接
|
||||
//在线预览
|
||||
let currentLinks = computed(() => {
|
||||
return store.state.currentLinks
|
||||
})
|
||||
@ -267,11 +214,6 @@ function reverseEditMode(){
|
||||
function changeCategory(){
|
||||
store.commit("_setCategory", category.value)
|
||||
}
|
||||
function changeShowType(){
|
||||
if(showType.value === 'video')
|
||||
sortType.value = 'name'
|
||||
store.commit("_setShowType", showType.value)
|
||||
}
|
||||
function changeGalleryNameType(){
|
||||
store.commit("_setShowNameType", galleryNameType.value)
|
||||
}
|
||||
@ -286,34 +228,17 @@ function changeGalleryCollect(gid, isCollect){
|
||||
else
|
||||
store.dispatch("collectGallery", gid)
|
||||
}
|
||||
function changeVideoCollect(id, isCollect){
|
||||
if(isCollect)
|
||||
store.dispatch("disCollectVideo", id)
|
||||
else
|
||||
store.dispatch("collectVideo", id)
|
||||
}
|
||||
function editGalleryTag(gid, tag){
|
||||
tempTag.value = tag
|
||||
tempGid.value = gid
|
||||
isEditingTag.value = true
|
||||
}
|
||||
function editVideoTag(id, tag){
|
||||
tempTag.value = tag
|
||||
tempId.value = id
|
||||
isEditingTag.value = true
|
||||
}
|
||||
function submitGalleryTag(){
|
||||
store.dispatch("updateGalleryTag", {gid:tempGid.value, tag:tempTag.value})
|
||||
tempTag.value = ''
|
||||
tempGid.value = ''
|
||||
isEditingTag.value = false
|
||||
}
|
||||
function submitVideoTag(){
|
||||
store.dispatch("updateVideoTag", {id:tempId.value, tag:tempTag.value})
|
||||
tempTag.value = ''
|
||||
tempId.value = ''
|
||||
isEditingTag.value = false
|
||||
}
|
||||
|
||||
//下载,删除,在线看
|
||||
function downloadTask(link){
|
||||
@ -325,9 +250,6 @@ function updateGallery(link){
|
||||
function deleteGallery(gid){
|
||||
store.dispatch("deleteGallery", gid)
|
||||
}
|
||||
function deleteVideo(id){
|
||||
store.dispatch("deleteVideo", id)
|
||||
}
|
||||
function onlineGalleryReader(gid){
|
||||
store.dispatch("queryOnlineLinks", gid)
|
||||
}
|
||||
@ -353,24 +275,6 @@ function shareGallery(data){
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
}
|
||||
function openVideoPanel(link){
|
||||
current_video_link.value = link
|
||||
isPlaying.value = true
|
||||
}
|
||||
function initPlayer(){
|
||||
player.value = new Player({
|
||||
id: "player",
|
||||
url: current_video_link.value,
|
||||
videoInit: true,
|
||||
lang: 'zh-cn',
|
||||
width: '100%',
|
||||
height: '56%'
|
||||
})
|
||||
}
|
||||
function destroyPlayer(){
|
||||
player.value.destroy()
|
||||
}
|
||||
|
||||
//显示缩略图
|
||||
function showThumbnail(gallery){
|
||||
store.commit("_changeThumbnailGallery", gallery)
|
||||
|
||||
@ -4,7 +4,6 @@ import {ElMessage} from "element-plus"
|
||||
import qs from "qs"
|
||||
const BaseUrl = "http://downloader.lionwebsite.xyz/"
|
||||
const GalleryManageUrl = BaseUrl + "GalleryManage"
|
||||
const VideoManageUrl = BaseUrl + "VideoManage"
|
||||
|
||||
const actions = {
|
||||
updateGalleryTasks(context, type){
|
||||
@ -35,34 +34,6 @@ const actions = {
|
||||
}
|
||||
})
|
||||
},
|
||||
updateVideoTasks(context, type){
|
||||
axios.get(VideoManageUrl, {
|
||||
params:{
|
||||
type,
|
||||
AuthCode: state.AuthCode
|
||||
}
|
||||
}).then(res => {
|
||||
if(res.data.result === "success") {
|
||||
let tasks = JSON.parse(res.data.data)
|
||||
if (type === "all" && state.videoRefreshTimer === 0) { //判断是否有未下载完成的视频以及定时更新是否开启
|
||||
for (let i = tasks.length - 1; i > tasks.length - 11; i--) //从后往前遍历十个本子,查看是否有未下载完成的视频
|
||||
if (tasks[i].status !== "下载完成") {
|
||||
state.videoRefreshTimer = setInterval(() => {
|
||||
context.dispatch("updateVideoTasks", "undone").then()
|
||||
}, 20000)
|
||||
break
|
||||
}
|
||||
}
|
||||
context.commit("_updateVideoTasks", {tasks, type})
|
||||
}
|
||||
|
||||
else if(type === 'undone') {
|
||||
clearInterval(state.videoRefreshTimer)
|
||||
state.videoRefreshTimer = 0
|
||||
context.dispatch("updateVideoTasks", "all").then()
|
||||
}
|
||||
})
|
||||
},
|
||||
postGalleryTask(context, data){
|
||||
axios.post(GalleryManageUrl, qs.stringify({
|
||||
AuthCode: state.AuthCode,
|
||||
@ -85,28 +56,6 @@ const actions = {
|
||||
}
|
||||
})
|
||||
},
|
||||
postVideoTask(context, data){
|
||||
axios.post(VideoManageUrl, qs.stringify({
|
||||
AuthCode: state.AuthCode,
|
||||
link: data.link,
|
||||
targetResolution: data.targetResolution
|
||||
})).then((res) => {
|
||||
if(res.data.result === "success") {
|
||||
ElMessage("提交成功")
|
||||
context.commit("_setChosenVideo", {video: false, resolution: data.targetResolution})
|
||||
if(state.videoRefreshTimer === 0)
|
||||
state.videoRefreshTimer = setInterval(() => {
|
||||
context.dispatch("updateVideoTasks", "undone").then()
|
||||
}, 20000)
|
||||
}
|
||||
else{
|
||||
if(res.data.data)
|
||||
ElMessage(res.data.data)
|
||||
else
|
||||
ElMessage("提交失败")
|
||||
}
|
||||
})
|
||||
},
|
||||
queryGalleryTask(context, link){
|
||||
axios.get(GalleryManageUrl, {
|
||||
params:{
|
||||
@ -122,21 +71,6 @@ const actions = {
|
||||
ElMessage("查询失败")
|
||||
})
|
||||
},
|
||||
queryVideoTask(context, link){
|
||||
axios.get(VideoManageUrl, {
|
||||
params:{
|
||||
param: link,
|
||||
type: "link",
|
||||
AuthCode: state.AuthCode
|
||||
}
|
||||
}).then((res) => {
|
||||
if(res.data.result === 'success')
|
||||
context.commit("_setChosenVideo", {video: JSON.parse(res.data.data)})
|
||||
|
||||
else
|
||||
ElMessage("查询失败")
|
||||
})
|
||||
},
|
||||
queryOnlineLinks(context, gid){
|
||||
// 如果本地有缓存,则直接返回,没有再请求
|
||||
if(context.state.onlineLinks[gid] !== undefined){
|
||||
@ -176,10 +110,8 @@ const actions = {
|
||||
if(res.data.result === 'success'){
|
||||
context.commit("_authed", {AuthCode, ...JSON.parse(res.data.data)})
|
||||
//初始化
|
||||
context.dispatch("loadMaskDomain").then()
|
||||
context.dispatch("loadWeekUsedAmount").then()
|
||||
context.dispatch("updateGalleryTasks", "all").then(() => confirmCurrentTask(context.state))
|
||||
context.dispatch("updateVideoTasks", "all").then()
|
||||
|
||||
//手机不需要设置宽度
|
||||
}
|
||||
@ -187,12 +119,6 @@ const actions = {
|
||||
context.commit("_unAuthed")
|
||||
})
|
||||
},
|
||||
loadMaskDomain(context){
|
||||
axios.get(BaseUrl + "maskDomain").then((res) => {
|
||||
if(res.data.result === "success")
|
||||
context.commit("_setMaskDomain", JSON.parse(res.data.data))
|
||||
})
|
||||
},
|
||||
loadWeekUsedAmount(context){
|
||||
axios.get(GalleryManageUrl + "/weekUsedAmount", {
|
||||
params: {
|
||||
@ -216,16 +142,6 @@ const actions = {
|
||||
context.commit("_collectGallery", gid)
|
||||
})
|
||||
},
|
||||
collectVideo(context, id){
|
||||
axios.post(VideoManageUrl + "/collect?" + qs.stringify({
|
||||
id,
|
||||
userId: state.userId
|
||||
})).then((res) => {
|
||||
ElMessage(res.data.data)
|
||||
if(res.data.result === 'success')
|
||||
context.commit("_collectVideo", id)
|
||||
})
|
||||
},
|
||||
disCollectGallery(context, gid){
|
||||
axios.post(GalleryManageUrl + "/disCollect?" + qs.stringify(
|
||||
{
|
||||
@ -237,16 +153,6 @@ const actions = {
|
||||
context.commit("_disCollectGallery", gid)
|
||||
})
|
||||
},
|
||||
disCollectVideo(context, id){
|
||||
axios.post(VideoManageUrl + "/disCollect?" + qs.stringify({
|
||||
id,
|
||||
userId: state.userId
|
||||
})).then((res) => {
|
||||
ElMessage(res.data.data)
|
||||
if(res.data.result === "success")
|
||||
context.commit("_disCollectVideo", id)
|
||||
})
|
||||
},
|
||||
updateGalleryTag(context, data){
|
||||
axios.post(GalleryManageUrl + "/tag?" + qs.stringify(data)).then((res) => {
|
||||
ElMessage(res.data.data)
|
||||
@ -254,13 +160,6 @@ const actions = {
|
||||
context.commit("_updateGalleryTag", data)
|
||||
})
|
||||
},
|
||||
updateVideoTag(context, data){
|
||||
axios.post(VideoManageUrl + "/tag?" + qs.stringify(data)).then((res) => {
|
||||
ElMessage(res.data.data)
|
||||
if(res.data.result === 'success')
|
||||
context.commit("_updateVideoTag", data)
|
||||
})
|
||||
},
|
||||
deleteGallery(context, gid){
|
||||
axios.delete(GalleryManageUrl, {
|
||||
params:{
|
||||
@ -275,21 +174,6 @@ const actions = {
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
},
|
||||
deleteVideo(context, id){
|
||||
axios.delete(VideoManageUrl, {
|
||||
params:{
|
||||
AuthCode:state.AuthCode,
|
||||
id
|
||||
}
|
||||
}).then((res) => {
|
||||
if(res.data.result === "success"){
|
||||
ElMessage("删除成功")
|
||||
context.commit("_deleteVideo", id)
|
||||
}
|
||||
else
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
},
|
||||
alterAuthCode(context, AuthCode){
|
||||
axios.put(BaseUrl + "AuthCode?" + qs.stringify({'AuthCode': state.AuthCode, 'newAuthCode': AuthCode}))
|
||||
.then((res) => {
|
||||
@ -315,15 +199,6 @@ const mutations = {
|
||||
}
|
||||
}
|
||||
},
|
||||
_collectVideo(state, id){
|
||||
let tasks = state.totalVideoTask
|
||||
for(let i=0; i< tasks.length; i++){
|
||||
if(!tasks[i].isCollect && tasks[i].id === id){
|
||||
tasks[i].isCollect = true
|
||||
state.collectGallery.push(tasks[i])
|
||||
}
|
||||
}
|
||||
},
|
||||
_disCollectGallery(state, gid){
|
||||
let index
|
||||
for(let i=0; i < state.collectGallery.length; i++){
|
||||
@ -335,17 +210,6 @@ const mutations = {
|
||||
state.collectGallery[index].isCollect = false
|
||||
state.collectGallery.splice(index, 1)
|
||||
},
|
||||
_disCollectVideo(state, id){
|
||||
let index
|
||||
for(let i=0; i < state.collectVideo.length; i++){
|
||||
if(state.collectVideo[i].id === id){
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
state.collectVideo[index].isCollect = false
|
||||
state.collectVideo.splice(index, 1)
|
||||
},
|
||||
_updateGalleryTag(state, data){
|
||||
for(let i=0; i < state.totalGalleryTask.length; i++){
|
||||
if(state.totalGalleryTask[i].gid === data.gid){
|
||||
@ -354,14 +218,6 @@ const mutations = {
|
||||
}
|
||||
}
|
||||
},
|
||||
_updateVideoTag(state, data){
|
||||
for(let i=0; i < state.totalVideoTask.length; i++){
|
||||
if(state.totalVideoTask[i].gid === data.gid){
|
||||
state.totalVideoTask[i].tag = data.tag
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
_updateGalleryTasks(state, data){
|
||||
let {tasks, type} = data
|
||||
if(type === 'all') {
|
||||
@ -384,11 +240,7 @@ const mutations = {
|
||||
case "下载完成":
|
||||
task.progress = "下载完成"
|
||||
let tempLink
|
||||
let url = new URL(task.link)
|
||||
state.maskDomain.forEach((mask) => {
|
||||
if (url.host === mask['raw'])
|
||||
tempLink = task.link.replace(mask['raw'], mask['mask'])
|
||||
})
|
||||
tempLink = task.link.replace("element-plus.org", "exhentai.org").replace("element.org", "e-hentai.org")
|
||||
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
|
||||
break;
|
||||
}
|
||||
@ -469,82 +321,6 @@ const mutations = {
|
||||
ElMessage("加载完成")
|
||||
}
|
||||
},
|
||||
_updateVideoTasks(state, data){
|
||||
let {tasks, type} = data
|
||||
if(type === 'all') {
|
||||
state.totalVideoTask.splice(0)
|
||||
state.collectVideo.splice(0)
|
||||
state.downloadVideo.splice(0)
|
||||
|
||||
tasks.forEach((task) => {
|
||||
task.progress = task.status
|
||||
//视频下载很快,所以不太注重下载进度
|
||||
if (task.status === "下载完成") {
|
||||
let tempLink
|
||||
let url = new URL(task.link)
|
||||
|
||||
state.maskDomain.forEach((mask) => {
|
||||
if (url.host === mask['raw'])
|
||||
tempLink = task.link.replace(mask['raw'], mask['mask'])
|
||||
})
|
||||
task.download = VideoManageUrl + "/file/" + encodeURI(task.name) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
|
||||
}
|
||||
|
||||
//处理时间戳
|
||||
task.createTimeDisplay = new Date(task.createTime * 1000).toLocaleString("zh")
|
||||
|
||||
//处理标签
|
||||
if(! 'tag' in task)
|
||||
task.tag = ""
|
||||
|
||||
//处理是否收藏
|
||||
if('collector' in task){
|
||||
let collector = task.collector.split(",")
|
||||
delete task.collector
|
||||
for(let i=0; i<collector.length; i++){
|
||||
if(parseInt(collector[i]) === state.userId){
|
||||
task.isCollect = true
|
||||
state.collectVideo.push(task)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if(!'isCollect' in task)
|
||||
task.isCollect = false
|
||||
}
|
||||
|
||||
//处理是否下载
|
||||
if(task.downloader === state.userId)
|
||||
state.downloadVideo.push(task)
|
||||
|
||||
state.totalVideoTask.push(task)
|
||||
})
|
||||
}
|
||||
else{
|
||||
let tempArray = Array.from(state.totalVideoTask)
|
||||
state.totalVideoTask.splice(0)
|
||||
let preDeleteIndex
|
||||
tempArray.forEach((task) => {
|
||||
preDeleteIndex = -1
|
||||
if(task.status !== "下载完成")
|
||||
for(let i=0; i < tasks.length; i++)
|
||||
if(tasks[i].name === task.name){
|
||||
task.progress = tasks[i].status
|
||||
preDeleteIndex = i
|
||||
break
|
||||
}
|
||||
if(preDeleteIndex !== -1)
|
||||
delete tasks[preDeleteIndex]
|
||||
state.totalVideoTask.push(task)
|
||||
})
|
||||
}
|
||||
state.totalVideoTask = state.totalVideoTask.sort((before, after) => {
|
||||
if(state.sortType === 'name')
|
||||
return before.name > after.name ? 1: -1
|
||||
else
|
||||
return before.createTime - after.createTime
|
||||
})
|
||||
},
|
||||
_changePage(state, targetPage){
|
||||
state.page = targetPage
|
||||
},
|
||||
@ -634,10 +410,6 @@ const mutations = {
|
||||
let tasks = [state.totalGalleryTask, state.downloadGallery, state.collectGallery]
|
||||
deleteTask(tasks, 'gid', gid)
|
||||
},
|
||||
_deleteVideo(state, id){
|
||||
let tasks = [state.totalVideoTask, state.downloadVideo, state.collectVideo]
|
||||
deleteTask(tasks, 'id', id)
|
||||
},
|
||||
_setChosenGallery(state,data){
|
||||
if(data.gallery === false) {
|
||||
state.chosenGallery.shortName = getShortname(state.chosenGallery.name)
|
||||
@ -646,32 +418,15 @@ const mutations = {
|
||||
state.chosenGallery.createTimeDisplay = "等待下载完成后再查看"
|
||||
state.chosenGallery.progress = "已提交"
|
||||
state.totalGalleryTask.push(state.chosenGallery)
|
||||
state.downloadGallery.push(state.chosenGallery)
|
||||
}
|
||||
state.chosenGallery = data.gallery
|
||||
},
|
||||
_setChosenVideo(state,data){
|
||||
if(data.video === false) {
|
||||
state.chosenVideo.resolution = data.resolution
|
||||
state.chosenVideo.fileSize = "下载完成后再查看"
|
||||
state.chosenVideo.duration = "下载完成后再查看"
|
||||
state.chosenVideo.createTimeDisplay = "下载完成后再查看"
|
||||
state.chosenVideo.progress = "已提交"
|
||||
state.totalVideoTask.push(state.chosenVideo)
|
||||
}
|
||||
state.chosenVideo = data.video
|
||||
},
|
||||
_setCategory(state, category){
|
||||
state.category = category
|
||||
confirmCurrentTask(state)
|
||||
sortTasks(state)
|
||||
},
|
||||
_setShowType(state, showType){
|
||||
state.showType = showType
|
||||
confirmCurrentTask(state)
|
||||
if(showType === 'video' && state.sortType === "shortName")
|
||||
state.sortType = 'name'
|
||||
sortTasks(state)
|
||||
},
|
||||
_setSortType(state, sortType){
|
||||
state.sortType = sortType
|
||||
sortTasks(state)
|
||||
@ -682,9 +437,6 @@ const mutations = {
|
||||
else
|
||||
state.length = state.defaultLength
|
||||
},
|
||||
_setMaskDomain(state, maskDomain){
|
||||
state.maskDomain = maskDomain
|
||||
},
|
||||
_addAndSetOnlineLinks(state, data){
|
||||
let links = JSON.parse(data.links)
|
||||
state.onlineLinks[data.gid] = []
|
||||
@ -730,11 +482,6 @@ const state = {
|
||||
currentGid: "", //当前GID
|
||||
currentLinks: [], //当前本子链接
|
||||
|
||||
totalVideoTask: [], //存放视频数据的数组
|
||||
chosenVideo: false, //准备下载的视频
|
||||
collectVideo: [], //收藏的视频
|
||||
downloadVideo: [], //下载的视频
|
||||
|
||||
page: 1, //当前页数
|
||||
length: 5, //每页能有多少个链接
|
||||
defaultLength: 4, //默认个数
|
||||
@ -746,18 +493,14 @@ const state = {
|
||||
AuthCode: '', //授权码
|
||||
loadComplete: false, //是否加载完成
|
||||
galleryRefreshTimer: 0, //本子更新计时器id
|
||||
videoRefreshTimer: 0, //视频更新计时器id
|
||||
|
||||
isInclude: false, //是否搜索到任务
|
||||
searchTask: [], //搜索到的任务
|
||||
isShowHistory: false, //是否打开面板
|
||||
showType: "gallery", //展示类型
|
||||
category: 'myDownload', //分类
|
||||
sortType:'shortName', //排序类型
|
||||
currentTasks: [], //当前任务
|
||||
weekUsed: {}, //每周用量
|
||||
|
||||
maskDomain: [] //伪装域名
|
||||
}
|
||||
|
||||
const getters = {
|
||||
@ -824,30 +567,17 @@ function getShortname(name){
|
||||
}
|
||||
|
||||
function confirmCurrentTask(state){
|
||||
if(state.showType === "gallery")
|
||||
switch (state.category){
|
||||
case 'myDownload':
|
||||
state.currentTasks = state.downloadGallery
|
||||
break
|
||||
case 'myCollect':
|
||||
state.currentTasks = state.collectGallery
|
||||
break
|
||||
case 'total':
|
||||
state.currentTasks = state.totalGalleryTask
|
||||
break
|
||||
}
|
||||
else
|
||||
switch (state.category){
|
||||
case 'myDownload':
|
||||
state.currentTasks = state.downloadVideo
|
||||
break
|
||||
case 'myCollect':
|
||||
state.currentTasks = state.collectGallery
|
||||
break
|
||||
case 'total':
|
||||
state.currentTasks = state.totalVideoTask
|
||||
break
|
||||
}
|
||||
switch (state.category){
|
||||
case 'myDownload':
|
||||
state.currentTasks = state.downloadGallery
|
||||
break
|
||||
case 'myCollect':
|
||||
state.currentTasks = state.collectGallery
|
||||
break
|
||||
case 'total':
|
||||
state.currentTasks = state.totalGalleryTask
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function sortTasks(state){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user