全面移除视频,移除域名混淆加载,直接写死,移除展示类型(同步更新)
This commit is contained in:
parent
5d543868bf
commit
38267a076a
@ -57,22 +57,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog title="查询视频" v-model="chosenVideo">
|
|
||||||
<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">
|
<el-dialog title="修改授权码" v-model="isAlterAuthCode">
|
||||||
<el-form>
|
<el-form>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@ -129,16 +113,10 @@ let realAuthCode = computed(() => {
|
|||||||
let chosenGallery = computed(() => {
|
let chosenGallery = computed(() => {
|
||||||
return store.state.chosenGallery
|
return store.state.chosenGallery
|
||||||
})
|
})
|
||||||
let chosenVideo = computed(() => {
|
|
||||||
return store.state.chosenVideo
|
|
||||||
})
|
|
||||||
|
|
||||||
let loadComplete = computed(() => {
|
let loadComplete = computed(() => {
|
||||||
return store.state.loadComplete
|
return store.state.loadComplete
|
||||||
})
|
})
|
||||||
let maskDomain = computed(() => {
|
|
||||||
return store.state.maskDomain
|
|
||||||
})
|
|
||||||
let weekUsed = computed(() => {
|
let weekUsed = computed(() => {
|
||||||
return store.state.weekUsed
|
return store.state.weekUsed
|
||||||
})
|
})
|
||||||
@ -173,11 +151,7 @@ function postTask(){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let tempLink = coverLink(param.value)
|
let tempLink = coverLink(param.value)
|
||||||
if(param.value.includes("hentai"))
|
store.dispatch("postGalleryTask", {link: tempLink, targetResolution: targetResolution.value})
|
||||||
store.dispatch("postGalleryTask", {link: tempLink, targetResolution: targetResolution.value})
|
|
||||||
else
|
|
||||||
store.dispatch("postVideoTask", {link: tempLink, targetResolution: targetResolution.value})
|
|
||||||
|
|
||||||
targetResolution.value = ""
|
targetResolution.value = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,10 +162,7 @@ function queryRemoteTask(){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let tempLink = coverLink(param.value)
|
let tempLink = coverLink(param.value)
|
||||||
if(param.value.includes("hentai"))
|
store.dispatch("queryGalleryTask", tempLink)
|
||||||
store.dispatch("queryGalleryTask", tempLink)
|
|
||||||
else
|
|
||||||
store.dispatch("queryVideoTask", tempLink)
|
|
||||||
}
|
}
|
||||||
function queryLocalTask(){
|
function queryLocalTask(){
|
||||||
switch (type.value){
|
switch (type.value){
|
||||||
@ -212,10 +183,6 @@ function resetLocalQuery(){
|
|||||||
param.value = ""
|
param.value = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除任务
|
|
||||||
function deleteVideo(){
|
|
||||||
store.dispatch("deleteVideo", chosenVideo.value.id)
|
|
||||||
}
|
|
||||||
function deleteGallery(){
|
function deleteGallery(){
|
||||||
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
||||||
}
|
}
|
||||||
@ -236,28 +203,13 @@ function validate(){
|
|||||||
function validateLink(rawLink){
|
function validateLink(rawLink){
|
||||||
if(rawLink.trim() === "")
|
if(rawLink.trim() === "")
|
||||||
return false
|
return false
|
||||||
if(rawLink.includes("hentai")){
|
if(rawLink.includes("hentai"))
|
||||||
return rawLink.includes("/g/")
|
return rawLink.includes("/g/")
|
||||||
}
|
else
|
||||||
else if(rawLink.includes("xvideos.com")){
|
return false
|
||||||
return true
|
|
||||||
}
|
|
||||||
else if(rawLink.includes("pornhub.com")){
|
|
||||||
return rawLink.includes("view_video.php")
|
|
||||||
}
|
|
||||||
else if(rawLink.includes("xhamster") && rawLink.includes(".com")){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function coverLink(rawLink){
|
function coverLink(rawLink){
|
||||||
if(rawLink.includes("xhamster"))
|
return rawLink.replace("exhentai.org", "element-plus.org").replace("e-hentai.org", "element.org");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//在线阅读以及展示缩略图
|
//在线阅读以及展示缩略图
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="side" style="width: 100%">
|
<div class="side" style="width: 100%">
|
||||||
<span v-show="loadComplete">{{showType === 'gallery' || showType === 'collect' ? '本子' : '视频'}}历史</span>
|
<span v-show="loadComplete">本子历史</span>
|
||||||
<div v-show="loadComplete" class="load_complete">
|
<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">
|
<el-table-column type="expand">
|
||||||
<template #default="props">
|
<template #default="props">
|
||||||
@ -49,55 +49,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</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="deleteVideo(props.row.id)" :disabled="props.row.download === undefined">删除</el-button>
|
|
||||||
<el-button @click="editVideoTag(props.row.id, props.row.tag)">编辑标签</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="名字" width="300vw">
|
|
||||||
<template #default="scoped">
|
|
||||||
{{scoped.row.name}}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="操作" width="300vw">
|
|
||||||
<template #default="scoped">
|
|
||||||
<span>
|
|
||||||
<el-button @click="downloadTask(scoped.row.download)" :disabled="scoped.row.download === undefined">下载</el-button>
|
|
||||||
<el-button @click="changeVideoCollect(scoped.row.id, scoped.row.isCollect)">{{scoped.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
|
|
||||||
<el-button @click="openVideoPanel(scoped.row.download)" :disabled="scoped.row.download === undefined">在线播放</el-button>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="进度" width="80">
|
|
||||||
<template #default="scoped">
|
|
||||||
{{ scoped.row.progress }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<el-row class="pageChanger">
|
<el-row class="pageChanger">
|
||||||
<el-col>
|
<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">
|
<el-select v-model="category" @change="changeCategory">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
分类
|
分类
|
||||||
@ -111,10 +64,10 @@
|
|||||||
排序
|
排序
|
||||||
</template>
|
</template>
|
||||||
<el-option value="name" label="名字"/>
|
<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-option value="createTime" label="任务创建时间"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select v-model="galleryNameType" @change="changeGalleryNameType" v-show="showType === 'gallery'">
|
<el-select v-model="galleryNameType" @change="changeGalleryNameType">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
显示
|
显示
|
||||||
</template>
|
</template>
|
||||||
@ -150,7 +103,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-footer>
|
<el-footer>
|
||||||
<el-button @click="tempGid === '' ? submitVideoTag(): submitGalleryTag()">提交修改</el-button>
|
<el-button @click="submitGalleryTag()">提交修改</el-button>
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
@ -163,9 +116,6 @@
|
|||||||
|
|
||||||
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
|
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="isPlaying" @opened="initPlayer()" @closed="destroyPlayer()" width="635px" title="在线预览">
|
|
||||||
<div id="player"></div>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -173,7 +123,6 @@ import store from "../store";
|
|||||||
import {computed, ref} from "vue";
|
import {computed, ref} from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
import Player from "xgplayer";
|
|
||||||
|
|
||||||
//输入
|
//输入
|
||||||
let inputNode = ref(null)
|
let inputNode = ref(null)
|
||||||
@ -181,21 +130,13 @@ let inputNode = ref(null)
|
|||||||
let isEditingPage = ref(false)
|
let isEditingPage = ref(false)
|
||||||
//是否正在编辑标签
|
//是否正在编辑标签
|
||||||
let isEditingTag = ref(false)
|
let isEditingTag = ref(false)
|
||||||
//是否打开播放面板
|
|
||||||
let isPlaying = ref(false)
|
|
||||||
|
|
||||||
//在线播放链接以及播放器实例
|
|
||||||
let current_video_link = ref("")
|
|
||||||
let player = ref()
|
|
||||||
|
|
||||||
//临时变量
|
//临时变量
|
||||||
let tempTag = ref("")
|
let tempTag = ref("")
|
||||||
let tempGid = ref("")
|
let tempGid = ref("")
|
||||||
let tempId = ref("")
|
|
||||||
|
|
||||||
let category = ref("myDownload") //myDownload myCollect total
|
let category = ref("myDownload") //myDownload myCollect total
|
||||||
let galleryNameType = ref("shortName") // shortName name
|
let galleryNameType = ref("shortName") // shortName name
|
||||||
let showType = ref("gallery") // gallery video collect
|
|
||||||
let sortType = ref("shortName") // shortName name createTime
|
let sortType = ref("shortName") // shortName name createTime
|
||||||
let targetPage = ref(1) // 当前页数
|
let targetPage = ref(1) // 当前页数
|
||||||
|
|
||||||
@ -232,9 +173,8 @@ let isLion = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let emptyText = computed(() => {
|
let emptyText = computed(() => {
|
||||||
let type = showType.value === 'gallery' ? '本子': '视频'
|
|
||||||
let action = category.value === 'myDownload' ? '下载': '收藏'
|
let action = category.value === 'myDownload' ? '下载': '收藏'
|
||||||
return '您未' + action + type
|
return '您未' + action + "本子"
|
||||||
})
|
})
|
||||||
|
|
||||||
//在线预览相关
|
//在线预览相关
|
||||||
@ -285,11 +225,6 @@ function reverseEditMode(){
|
|||||||
function changeCategory(){
|
function changeCategory(){
|
||||||
store.commit("_setCategory", category.value)
|
store.commit("_setCategory", category.value)
|
||||||
}
|
}
|
||||||
function changeShowType(){
|
|
||||||
if(showType.value === 'video')
|
|
||||||
sortType.value = 'name'
|
|
||||||
store.commit("_setShowType", showType.value)
|
|
||||||
}
|
|
||||||
function changeGalleryNameType(){
|
function changeGalleryNameType(){
|
||||||
store.commit("_setShowNameType", galleryNameType.value)
|
store.commit("_setShowNameType", galleryNameType.value)
|
||||||
}
|
}
|
||||||
@ -304,34 +239,17 @@ function changeGalleryCollect(gid, isCollect){
|
|||||||
else
|
else
|
||||||
store.dispatch("collectGallery", gid)
|
store.dispatch("collectGallery", gid)
|
||||||
}
|
}
|
||||||
function changeVideoCollect(id, isCollect){
|
|
||||||
if(isCollect)
|
|
||||||
store.dispatch("disCollectVideo", id)
|
|
||||||
else
|
|
||||||
store.dispatch("collectVideo", id)
|
|
||||||
}
|
|
||||||
function editGalleryTag(gid, tag){
|
function editGalleryTag(gid, tag){
|
||||||
tempTag.value = tag
|
tempTag.value = tag
|
||||||
tempGid.value = gid
|
tempGid.value = gid
|
||||||
isEditingTag.value = true
|
isEditingTag.value = true
|
||||||
}
|
}
|
||||||
function editVideoTag(id, tag){
|
|
||||||
tempTag.value = tag
|
|
||||||
tempId.value = id
|
|
||||||
isEditingTag.value = true
|
|
||||||
}
|
|
||||||
function submitGalleryTag(){
|
function submitGalleryTag(){
|
||||||
store.dispatch("updateGalleryTag", {gid:tempGid.value, tag:tempTag.value})
|
store.dispatch("updateGalleryTag", {gid:tempGid.value, tag:tempTag.value})
|
||||||
tempTag.value = ''
|
tempTag.value = ''
|
||||||
tempGid.value = ''
|
tempGid.value = ''
|
||||||
isEditingTag.value = false
|
isEditingTag.value = false
|
||||||
}
|
}
|
||||||
function submitVideoTag(){
|
|
||||||
store.dispatch("updateVideoTag", {id:tempId.value, tag:tempTag.value})
|
|
||||||
tempTag.value = ''
|
|
||||||
tempId.value = ''
|
|
||||||
isEditingTag.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
//下载,删除,在线看
|
//下载,删除,在线看
|
||||||
function downloadTask(link){
|
function downloadTask(link){
|
||||||
@ -343,9 +261,6 @@ function updateGallery(link){
|
|||||||
function deleteGallery(gid){
|
function deleteGallery(gid){
|
||||||
store.dispatch("deleteGallery", gid)
|
store.dispatch("deleteGallery", gid)
|
||||||
}
|
}
|
||||||
function deleteVideo(id){
|
|
||||||
store.dispatch("deleteVideo", id)
|
|
||||||
}
|
|
||||||
function onlineGalleryReader(gid){
|
function onlineGalleryReader(gid){
|
||||||
store.dispatch("queryOnlineLinks", gid)
|
store.dispatch("queryOnlineLinks", gid)
|
||||||
}
|
}
|
||||||
@ -371,21 +286,6 @@ function shareGallery(data){
|
|||||||
ElMessage(res.data.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'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
function destroyPlayer(){
|
|
||||||
player.value.destroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
//显示缩略图
|
//显示缩略图
|
||||||
function showThumbnail(gallery){
|
function showThumbnail(gallery){
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import {ElMessage} from "element-plus"
|
|||||||
import qs from "qs"
|
import qs from "qs"
|
||||||
const BaseUrl = "http://downloader.lionwebsite.xyz/"
|
const BaseUrl = "http://downloader.lionwebsite.xyz/"
|
||||||
const GalleryManageUrl = BaseUrl + "GalleryManage"
|
const GalleryManageUrl = BaseUrl + "GalleryManage"
|
||||||
const VideoManageUrl = BaseUrl + "VideoManage"
|
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
updateGalleryTasks(context, type){
|
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){
|
postGalleryTask(context, data){
|
||||||
axios.post(GalleryManageUrl, qs.stringify({
|
axios.post(GalleryManageUrl, qs.stringify({
|
||||||
AuthCode: state.AuthCode,
|
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){
|
queryGalleryTask(context, link){
|
||||||
axios.get(GalleryManageUrl, {
|
axios.get(GalleryManageUrl, {
|
||||||
params:{
|
params:{
|
||||||
@ -122,21 +71,6 @@ const actions = {
|
|||||||
ElMessage("查询失败")
|
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){
|
queryOnlineLinks(context, gid){
|
||||||
// 如果本地有缓存,则直接返回,没有再请求
|
// 如果本地有缓存,则直接返回,没有再请求
|
||||||
if(context.state.onlineLinks[gid] !== undefined){
|
if(context.state.onlineLinks[gid] !== undefined){
|
||||||
@ -176,10 +110,8 @@ const actions = {
|
|||||||
if(res.data.result === 'success'){
|
if(res.data.result === 'success'){
|
||||||
context.commit("_authed", {AuthCode, ...JSON.parse(res.data.data)})
|
context.commit("_authed", {AuthCode, ...JSON.parse(res.data.data)})
|
||||||
//初始化
|
//初始化
|
||||||
context.dispatch("loadMaskDomain").then()
|
|
||||||
context.dispatch("loadWeekUsedAmount").then()
|
context.dispatch("loadWeekUsedAmount").then()
|
||||||
context.dispatch("updateGalleryTasks", "all").then(() => confirmCurrentTask(context.state))
|
context.dispatch("updateGalleryTasks", "all").then(() => confirmCurrentTask(context.state))
|
||||||
context.dispatch("updateVideoTasks", "all").then()
|
|
||||||
|
|
||||||
//获取图片合适长度
|
//获取图片合适长度
|
||||||
let screenWidth = window.screen.width * 0.9 - 40
|
let screenWidth = window.screen.width * 0.9 - 40
|
||||||
@ -199,12 +131,6 @@ const actions = {
|
|||||||
context.commit("_unAuthed")
|
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){
|
loadWeekUsedAmount(context){
|
||||||
axios.get(GalleryManageUrl + "/weekUsedAmount", {
|
axios.get(GalleryManageUrl + "/weekUsedAmount", {
|
||||||
params: {
|
params: {
|
||||||
@ -228,16 +154,6 @@ const actions = {
|
|||||||
context.commit("_collectGallery", gid)
|
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){
|
disCollectGallery(context, gid){
|
||||||
axios.post(GalleryManageUrl + "/disCollect?" + qs.stringify({
|
axios.post(GalleryManageUrl + "/disCollect?" + qs.stringify({
|
||||||
gid,
|
gid,
|
||||||
@ -248,16 +164,6 @@ const actions = {
|
|||||||
context.commit("_disCollectGallery", gid)
|
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){
|
updateGalleryTag(context, data){
|
||||||
axios.post(GalleryManageUrl + "/tag?" + qs.stringify(data)).then((res) => {
|
axios.post(GalleryManageUrl + "/tag?" + qs.stringify(data)).then((res) => {
|
||||||
ElMessage(res.data.data)
|
ElMessage(res.data.data)
|
||||||
@ -265,13 +171,6 @@ const actions = {
|
|||||||
context.commit("_updateGalleryTag", data)
|
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){
|
deleteGallery(context, gid){
|
||||||
axios.delete(GalleryManageUrl, {
|
axios.delete(GalleryManageUrl, {
|
||||||
params:{
|
params:{
|
||||||
@ -286,22 +185,6 @@ const actions = {
|
|||||||
ElMessage(res.data.data)
|
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){
|
alterAuthCode(context, AuthCode){
|
||||||
axios.put(BaseUrl + "AuthCode?" + qs.stringify({'AuthCode': state.AuthCode, 'newAuthCode': AuthCode}))
|
axios.put(BaseUrl + "AuthCode?" + qs.stringify({'AuthCode': state.AuthCode, 'newAuthCode': AuthCode}))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -327,15 +210,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){
|
_disCollectGallery(state, gid){
|
||||||
let index
|
let index
|
||||||
for(let i=0; i < state.collectGallery.length; i++){
|
for(let i=0; i < state.collectGallery.length; i++){
|
||||||
@ -347,17 +221,6 @@ const mutations = {
|
|||||||
state.collectGallery[index].isCollect = false
|
state.collectGallery[index].isCollect = false
|
||||||
state.collectGallery.splice(index, 1)
|
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){
|
_updateGalleryTag(state, data){
|
||||||
for(let i=0; i < state.totalGalleryTask.length; i++){
|
for(let i=0; i < state.totalGalleryTask.length; i++){
|
||||||
if(state.totalGalleryTask[i].gid === data.gid){
|
if(state.totalGalleryTask[i].gid === data.gid){
|
||||||
@ -366,14 +229,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){
|
_updateGalleryTasks(state, data){
|
||||||
let {tasks, type} = data
|
let {tasks, type} = data
|
||||||
if(type === 'all') {
|
if(type === 'all') {
|
||||||
@ -396,11 +251,7 @@ const mutations = {
|
|||||||
case "下载完成":
|
case "下载完成":
|
||||||
task.progress = "下载完成"
|
task.progress = "下载完成"
|
||||||
let tempLink
|
let tempLink
|
||||||
let url = new URL(task.link)
|
tempLink = task.link.replace("element-plus.org", "exhentai.org").replace("element.org", "e-hentai.org")
|
||||||
state.maskDomain.forEach((mask) => {
|
|
||||||
if (url.host === mask['raw'])
|
|
||||||
tempLink = task.link.replace(mask['raw'], mask['mask'])
|
|
||||||
})
|
|
||||||
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
|
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -481,82 +332,6 @@ const mutations = {
|
|||||||
ElMessage("加载完成")
|
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){
|
_changePage(state, targetPage){
|
||||||
state.page = targetPage
|
state.page = targetPage
|
||||||
},
|
},
|
||||||
@ -581,8 +356,7 @@ const mutations = {
|
|||||||
let gid = null
|
let gid = null
|
||||||
let name = null
|
let name = null
|
||||||
|
|
||||||
if(state.showType === "gallery")
|
gid = link.split("/")[4]
|
||||||
gid = link.split("/")[4]
|
|
||||||
|
|
||||||
if(gid === null)
|
if(gid === null)
|
||||||
for (i = 0; i < tasks.length; i++) {
|
for (i = 0; i < tasks.length; i++) {
|
||||||
@ -650,10 +424,6 @@ const mutations = {
|
|||||||
let tasks = [state.totalGalleryTask, state.downloadGallery, state.collectGallery]
|
let tasks = [state.totalGalleryTask, state.downloadGallery, state.collectGallery]
|
||||||
deleteTask(tasks, 'gid', gid)
|
deleteTask(tasks, 'gid', gid)
|
||||||
},
|
},
|
||||||
_deleteVideo(state, id){
|
|
||||||
let tasks = [state.totalVideoTask, state.downloadVideo, state.collectVideo]
|
|
||||||
deleteTask(tasks, 'id', id)
|
|
||||||
},
|
|
||||||
_setChosenGallery(state,data){
|
_setChosenGallery(state,data){
|
||||||
if(data.gallery === false) {
|
if(data.gallery === false) {
|
||||||
state.chosenGallery.shortName = getShortname(state.chosenGallery.name)
|
state.chosenGallery.shortName = getShortname(state.chosenGallery.name)
|
||||||
@ -663,32 +433,15 @@ const mutations = {
|
|||||||
state.chosenGallery.progress = "已提交"
|
state.chosenGallery.progress = "已提交"
|
||||||
state.chosenGallery.tag = ""
|
state.chosenGallery.tag = ""
|
||||||
state.totalGalleryTask.push(state.chosenGallery)
|
state.totalGalleryTask.push(state.chosenGallery)
|
||||||
|
state.downloadGallery.push(state.chosenGallery)
|
||||||
}
|
}
|
||||||
state.chosenGallery = data.gallery
|
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){
|
_setCategory(state, category){
|
||||||
state.category = category
|
state.category = category
|
||||||
confirmCurrentTask(state)
|
confirmCurrentTask(state)
|
||||||
sortTasks(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){
|
_setSortType(state, sortType){
|
||||||
state.sortType = sortType
|
state.sortType = sortType
|
||||||
sortTasks(state)
|
sortTasks(state)
|
||||||
@ -699,9 +452,6 @@ const mutations = {
|
|||||||
else
|
else
|
||||||
state.length = state.defaultLength
|
state.length = state.defaultLength
|
||||||
},
|
},
|
||||||
_setMaskDomain(state, maskDomain){
|
|
||||||
state.maskDomain = maskDomain
|
|
||||||
},
|
|
||||||
_addAndSetOnlineLinks(state, data){
|
_addAndSetOnlineLinks(state, data){
|
||||||
let links = JSON.parse(data.links)
|
let links = JSON.parse(data.links)
|
||||||
state.onlineLinks[data.gid] = []
|
state.onlineLinks[data.gid] = []
|
||||||
@ -743,11 +493,6 @@ const state = {
|
|||||||
imageWidth: "", //图片宽度
|
imageWidth: "", //图片宽度
|
||||||
imagePadding: "", //图片padding
|
imagePadding: "", //图片padding
|
||||||
|
|
||||||
totalVideoTask: [], //存放视频数据的数组
|
|
||||||
chosenVideo: false, //准备下载的视频
|
|
||||||
collectVideo: [], //收藏的视频
|
|
||||||
downloadVideo: [], //下载的视频
|
|
||||||
|
|
||||||
page: 1, //当前页数
|
page: 1, //当前页数
|
||||||
length: 10, //每页能有多少个链接
|
length: 10, //每页能有多少个链接
|
||||||
defaultLength: 7, //默认个数
|
defaultLength: 7, //默认个数
|
||||||
@ -759,17 +504,13 @@ const state = {
|
|||||||
AuthCode: '', //授权码
|
AuthCode: '', //授权码
|
||||||
loadComplete: false, //是否加载完成
|
loadComplete: false, //是否加载完成
|
||||||
galleryRefreshTimer: 0, //本子更新计时器id
|
galleryRefreshTimer: 0, //本子更新计时器id
|
||||||
videoRefreshTimer: 0, //视频更新计时器id
|
|
||||||
|
|
||||||
isInclude: false, //是否搜索到任务
|
isInclude: false, //是否搜索到任务
|
||||||
searchTask: [], //搜索到的任务
|
searchTask: [], //搜索到的任务
|
||||||
showType:'gallery', //展示类型
|
|
||||||
category: 'myDownload', //分类
|
category: 'myDownload', //分类
|
||||||
sortType:'shortName', //排序类型
|
sortType:'shortName', //排序类型
|
||||||
currentTasks: [], //当前任务
|
currentTasks: [], //当前任务
|
||||||
weekUsed: {}, //每周用量
|
weekUsed: {}, //每周用量
|
||||||
|
|
||||||
maskDomain: [] //伪装域名
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
@ -836,30 +577,17 @@ function getShortname(name){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function confirmCurrentTask(state){
|
function confirmCurrentTask(state){
|
||||||
if(state.showType === "gallery")
|
switch (state.category){
|
||||||
switch (state.category){
|
case 'myDownload':
|
||||||
case 'myDownload':
|
state.currentTasks = state.downloadGallery
|
||||||
state.currentTasks = state.downloadGallery
|
break
|
||||||
break
|
case 'myCollect':
|
||||||
case 'myCollect':
|
state.currentTasks = state.collectGallery
|
||||||
state.currentTasks = state.collectGallery
|
break
|
||||||
break
|
case 'total':
|
||||||
case 'total':
|
state.currentTasks = state.totalGalleryTask
|
||||||
state.currentTasks = state.totalGalleryTask
|
break
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortTasks(state){
|
function sortTasks(state){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user