新增下载模式选择;新增下载前查看预览图;去除链接伪装;优化下载完成逻辑判断;仅允许下载里站链接(同步更新)修复未下载完成时查看预览导致后端缓存异常的问题

This commit is contained in:
chuzhongzai 2023-12-21 18:32:05 +08:00
parent 01b3f08d8c
commit 1d28a89851
4 changed files with 66 additions and 33 deletions

View File

@ -37,6 +37,8 @@
</el-drawer>
<el-dialog title="查询本子" v-model="chosenGallery" width="100%">
<el-image v-if='chosenGallery.thumb_link !== undefined' style="float: right; width: 250px; height: 250px" fit="contain"
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + chosenGallery.thumb_link"/>
<table>
<tr>本子名字:{{chosenGallery.name}}</tr>
<tr>本子页数:{{chosenGallery.pages}}</tr>
@ -50,6 +52,13 @@
</el-option>
</el-select>
</tr>
<tr v-if="chosenGallery.availableResolution">
下载模式:<el-select v-model="targetDownloadMode" style="width: 200px" default-first-option>
<el-option :value="1" label="仅下载"/>
<el-option :value="2" label="仅在线看"/>
<el-option :value="3" label="在线看并下载"/>
</el-select>
</tr>
<tr v-if="chosenGallery.availableResolution">
标签:<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)">
{{store.state.tags.get(tid).tag}}
@ -178,6 +187,7 @@ let param = ref("")
let paramForTags = ref([]) //tidS
let targetResolution = ref("")
let targetDownloadMode = ref("")
let tag = ref("")
let tagKeyWord = ref("") //tag
@ -264,10 +274,15 @@ function postTask(){
ElMessage("请选择分辨率再提交")
return
}
let tempLink = coverLink(chosenGallery.value.link)
store.dispatch("postGalleryTask", {link: tempLink,
targetResolution: targetResolution.value,
tags:tag.value})
if(targetDownloadMode.value === ''){
ElMessage("请选择下载模式再提交")
return
}
store.dispatch("postGalleryTask",
{link: chosenGallery.value.link,
targetResolution: targetResolution.value,
mode: targetDownloadMode.value,
tags:tag.value})
targetResolution.value = ""
}
@ -277,8 +292,9 @@ function queryRemoteTask(){
ElMessage("链接错误")
return
}
let tempLink = coverLink(param.value)
store.dispatch("queryGalleryTask", tempLink)
if(param.value.includes("e-hentai"))
param.value = param.value.replace("e-hentai", "exhentai")
store.dispatch("queryGalleryTask", param.value)
}
function queryLocalTask(){
switch (type.value){
@ -404,9 +420,6 @@ function validateLink(rawLink){
else
return false
}
function coverLink(rawLink){
return rawLink.replace("exhentai.org", "element-plus.org").replace("e-hentai.org", "element.org");
}
//线
function openPanel(){

View File

@ -55,8 +55,7 @@ function queryRemoteTask(){
ElMessage("链接错误")
return
}
let tempLink = coverLink(param.value)
store.dispatch("queryGalleryTask", tempLink)
store.dispatch("queryGalleryTask", param.value)
}
function validateLink(rawLink){
@ -68,10 +67,6 @@ function validateLink(rawLink){
return false
}
function coverLink(rawLink){
return rawLink.replace("exhentai.org", "element-plus.org").replace("e-hentai.org", "element.org");
}
function close(){
emit("close")
}
@ -103,8 +98,8 @@ function adjustGalleryName(name, length) {
</div>
<el-scrollbar height="75vh" ref="scrollBar">
<div style="height: 20vh; width: 100%; border-radius: 5px; padding-bottom: 2vh" v-for="gallery in galleries">
<el-image alt="picture" :preview-src-list="['https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl.replace('/t', ''),]"
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl.replace('/t', '') "
<el-image alt="picture" :preview-src-list="['https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl,]"
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl"
style="height:20vh;width:35vw;float: left;"
fit="contain"
loading="lazy"

View File

@ -6,7 +6,7 @@
<div v-for="gallery in currentTasks" :style="{'height': '20vh', 'background': isDark() ? '': 'FloralWhite', 'border-radius': '1%',
'margin-bottom': '10px'}"
@click="viewInfo(gallery)" id="gallery">
<el-image :src="'https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/0?gid=' + gallery.gid"
<el-image :src="getGalleryThumb(gallery)"
style="height: 20vh; width: 35vw; float:left"
fit="contain"
loading="lazy"
@ -15,7 +15,7 @@
{{adjustGalleryName(gallery.name, 95)}}<br>
页数:{{gallery.pages}}<br>
语言:{{gallery.language}}
<span v-if="gallery.download !== undefined">
<span v-if="gallery.status !== '下载完成'">
下载进度: {{gallery.progress}}
</span>
</div>
@ -107,9 +107,9 @@
<el-dialog v-model="isViewing" width="100%" top="0" style="padding: 0">
<div style="height: 20vh; font: bold 16px semi-expanded">
<el-image :src="'https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/0?gid=' + currentGallery.gid"
<el-image :src="currentGallery.download === undefined ?'' : 'https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/0?gid=' + currentGallery.gid"
style="float: left; width: 40vw; height: 20vh" fit="contain"
:preview-src-list="['https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/1?gid=' + currentGallery.gid,]"></el-image>
:preview-src-list="currentGallery.download === undefined ? [] : ['https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/1?gid=' + currentGallery.gid,]"></el-image>
{{adjustGalleryName(currentGallery.name, 150)}}
</div>
<div style="font: bold 20px semi-expanded">
@ -122,7 +122,10 @@
下载链接:<a :href="currentGallery.download">link</a><br>
标签:{{currentGallery.tag === '' ? '无': currentGallery.tag}} <br>
<span v-show="isLion">
downloader:{{currentGallery.downloader}}
downloader:{{currentGallery.downloader}}
</span>
<span v-if="currentGallery.download === undefined">
下载进度: {{currentGallery.progress}}
</span>
</div>
<template #footer>
@ -386,7 +389,9 @@ function updateGallery(link){
store.dispatch("updateGallery", link)
}
function deleteGallery(gid){
store.dispatch("deleteGallery", gid)
store.dispatch("deleteGallery", gid).then(() => {
isViewing.value = false
})
}
function onlineGalleryReader(){
isOnlineReading.value = true;
@ -433,6 +438,19 @@ function adjustGalleryName(name, length) {
return truncated;
}
function getGalleryThumb(gallery){
if(gallery.status !== '下载完成')
return ''
if(gallery.mode === 2 || gallery.mode === 3)
return 'https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/0?gid=' + gallery.gid
if(gallery.thumb_link !== undefined)
return 'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumb_link
return ''
}
function isDark(){
return document.querySelector('html').classList.contains('dark')
}

View File

@ -37,9 +37,7 @@ const actions = {
postGalleryTask(context, data){
axios.post(GalleryManageUrl, qs.stringify({
AuthCode: state.AuthCode,
link: data.link,
targetResolution: data.targetResolution,
tags:data.tags
...data
}, {indices:false})).then((res) => {
if(res.data.result === "success") {
ElMessage("提交成功")
@ -299,12 +297,15 @@ const mutations = {
break;
case "下载完成":
task.progress = "下载完成"
task.download = GalleryManageUrl + "/file/" + encodeURIComponent(task.name) + ".zip?AuthCode=" + state.AuthCode + "&gid=" + task.gid
let links = []
for(let i=1; i<=task.pages; i++)
links.push(GalleryManageUrl + "/onlineImage/" + i + "?gid=" + task.gid);
if(task.mode === 1 || task.mode === 3)
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + ".zip?AuthCode=" + state.AuthCode + "&gid=" + task.gid
task.images = links
if(task.mode === 2 || task.mode === 3) {
let links = []
for (let i = 1; i <= task.pages; i++)
links.push(GalleryManageUrl + "/onlineImage/" + i + "?gid=" + task.gid);
task.images = links
}
break;
case "压缩中":
task.progress = "压缩中"
@ -573,8 +574,14 @@ const mutations = {
state.isShowHistory = false
},
_changeThumbnailGallery(state, gallery){
state.thumbnailGallery = gallery
state.thumbnailGallery.url = GalleryManageUrl + "/onlineImage/1?gid="+gallery.gid
if(gallery.mode === 2 || gallery.mode === 3) {
state.thumbnailGallery = gallery
state.thumbnailGallery.url = GalleryManageUrl + "/onlineImage/1?gid=" + gallery.gid
} else if(gallery.thumb_link !== undefined){
state.thumbnailGallery = gallery
state.thumbnailGallery.url = GalleryManageUrl + "/ehThumbnail?path=" + gallery.thumb_link
state.thumbnailGallery.images = [GalleryManageUrl + "/ehThumbnail?path=" + gallery.thumb_link,]
}
}
}