Compare commits

...

10 Commits

6 changed files with 377 additions and 197 deletions

View File

@ -8,10 +8,10 @@ import DashBoard from "./components/DashBoard.vue";
<template>
<div class="app">
<el-container>
<DashBoard/>
<main>
<Side/>
<el-main>
<DashBoard/>
</el-main>
</main>
</el-container>
</div>
</template>

View File

@ -1,35 +1,19 @@
<template>
<div class="DashBoard" v-show="loadComplete">
<el-drawer class="DashBoard" v-model="store.state.isShowHistory" size="90%" direction="ltr">
<span>E站额度本周已用:{{weekUsed.weekUsedAmount}} <br>上次重置时间:{{weekUsed.lastResetAmountTime}}</span><br>
<el-button @click="queryWeekUsedAmount">查询用量</el-button>
<hr>
<el-row>
<el-col>
查询参数类型: <el-select style="width: 125px" v-model="type" @change="resetLocalQuery()">
<el-option value="link" label="链接"/>
<el-option value="keyword" label="关键字"/>
<el-option value="tag" label="标签"/>
</el-select><br>
<el-input style="width: 200px;" v-model="param" v-if="type !== 'tag'">
<template #prepend>
参数:
链接:
</template>
</el-input>
<div v-if="type === 'tag'">
<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)">
{{store.state.tags.get(tid).tag}}
</el-tag>
<el-autocomplete v-model="param" :fetch-suggestions="completeQueryTag" @select="handleTagSelect" ref="tagInput" placeholder="检索标签"/>
</div>
</el-col>
<el-col>
<el-button @click="queryRemoteTask" v-show="type === 'link'">远程查询</el-button>
<el-button @click="queryLocalTask">当前页查询</el-button>
<el-button @click="removeAllQueryTag" v-show="type === 'tag'">清空查询标签</el-button>
<el-button @click="queryRemoteTask" v-show="type === 'link'">解析链接</el-button>
</el-col>
</el-row>
<hr>
<el-button @click="openPanel">打开面板</el-button>
<el-button @click="isQuerying = true">里站搜索</el-button>
<el-button @click="isAlterAuthCode = true">修改授权码</el-button>
<el-button @click="deleteAuthCode">删除本地授权码</el-button>
@ -40,17 +24,21 @@
<el-button @click="isQuerying = true">里站搜索</el-button>
<el-button @click="isViewingTag = true">查看标签</el-button>
<br>
<div v-show="thumbnailGallery !== {}">
<el-button v-if="isLion" @click="resetUndone">重置任务</el-button>
<div v-show="thumbnailGallery.url !== undefined">
<span>
{{thumbnailGallery.shortName}}
</span><br>
<picture>
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.url,]" :initial-index="0" class="preview" style="height: 30vh"/>
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.images[0],]" :initial-index="0" class="preview"
style="height: 30vh" fit="contain"/>
</picture>
</div>
</div>
</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>
@ -64,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}}
@ -80,7 +75,7 @@
</tr>
</el-dialog>
<HentaiSearch :is-querying="isQuerying" @close="closeQueryPanel"></HentaiSearch>
<HentaiSearch :is-querying="isQuerying" @close="isQuerying = false"></HentaiSearch>
<el-dialog title="修改授权码" v-model="isAlterAuthCode" width="100%">
<el-form>
@ -192,6 +187,7 @@ let param = ref("")
let paramForTags = ref([]) //tidS
let targetResolution = ref("")
let targetDownloadMode = ref("")
let tag = ref("")
let tagKeyWord = ref("") //tag
@ -231,9 +227,15 @@ let tags = computed(() => {
})
let thumbnailGallery = computed(() => {
if(store.state.thumbnailGallery.images === undefined)
store.state.thumbnailGallery.images = []
return store.state.thumbnailGallery
})
let isLion = computed(() => {
return store.state.userId === 3
})
function pullNewTag(){
store.dispatch("loadTags")
}
@ -272,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 = ""
}
@ -285,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){
@ -354,7 +362,7 @@ function removeAllQueryTag(){
function handleTagSelect(data){
if('tag' in data){ //,axiosvue
axios.post("http://downloader.lionwebsite.xyz/GalleryManage/tag?" + qs.stringify({
axios.post("https://downloader.lionwebsite.xyz/GalleryManage/tag?" + qs.stringify({
tag:data.tag,
AuthCode: store.state.AuthCode
})
@ -385,9 +393,6 @@ function resetLocalQuery(){
store.commit("_searchLocalByTag", [''])
param.value = ""
}
function closeQueryPanel(){
isQuerying.value = false
}
//
function deleteGallery(){
@ -415,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(){
@ -427,6 +429,10 @@ function onlineGalleryReader(gid){
store.dispatch("queryOnlineLinks", gid)
}
//
function resetUndone(){
store.dispatch("resetUndone").then()
}
function deleteAuthCode(){
localStorage.removeItem('auth')
ElMessage("删除授权码完成")
@ -523,6 +529,11 @@ function dark(){
html.classList.add('dark')
document.querySelector(".DashBoard").style.setProperty("background-color", null)
document.querySelector(".app").style.setProperty("background-color", null)
let galleries = document.querySelectorAll("#gallery");
for(let gallery of galleries){
gallery.style.setProperty("background-color", null)
}
}
function light(){
let html = document.querySelector("html")
@ -531,6 +542,11 @@ function light(){
document.querySelector(".DashBoard").style.setProperty("background-color", "ghostwhite")
document.querySelector(".app").style.setProperty("background-color", "#c6e2ff")
let galleries = document.querySelectorAll("#gallery");
if(galleries !== undefined && galleries.length !== 0)
for(let gallery of galleries){
gallery.style.setProperty("background-color", "FloralWhite")
}
}
function saveConfig(){
if(darkConfig.value.customTime) {
@ -540,8 +556,14 @@ function saveConfig(){
}
}
store.state.lengthPerPage = Number(lengthPerPage.value)
localStorage.setItem("lengthPerPage", lengthPerPage.value)
if(lengthPerPage.value < 0 || lengthPerPage.value > 30) {
ElMessage("分页页数设置错误范围1~30")
lengthPerPage.value = 30
}
else {
store.state.lengthPerPage = Number(lengthPerPage.value)
localStorage.setItem("lengthPerPage", lengthPerPage.value)
}
localStorage.setItem("darkConfig", JSON.stringify(darkConfig.value))
isConfig.value = false
adjustForStyle()
@ -557,7 +579,6 @@ function saveConfig(){
.validate{
width: 50vw;
background-color: ghostwhite;
display: block;
padding-top: 200px;
padding-left: 20vw;

View File

@ -14,6 +14,7 @@ let queryPage = ref({})
let galleries = ref([])
let param = ref()
let isShowUp = ref()
let isLoading = ref()
watch(props, () => {
isShowUp.value = props.isQuerying
})
@ -27,11 +28,11 @@ function queryGalleries(link){
tempParam = keyword.value
}
tempParam = tempParam.replace(" ", "+")
document.getElementById("loading").style.display = "inline-block";
isLoading = true
axios.get("http://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
axios.get("https://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
.then((res) => {
document.getElementById("loading").style.display = "none";
isLoading = false
if (res.data.result === "success") {
let tempGalleries = JSON.parse(res.data.data)
queryPage.value.first = 'first' in res.data ? res.data.first : undefined
@ -54,8 +55,7 @@ function queryRemoteTask(){
ElMessage("链接错误")
return
}
let tempLink = coverLink(param.value)
store.dispatch("queryGalleryTask", tempLink)
store.dispatch("queryGalleryTask", param.value)
}
function validateLink(rawLink){
@ -67,30 +67,45 @@ 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")
}
function adjustGalleryName(name, length) {
let truncated = '';
let bytesCount = 0;
for (const char of name) {
const charCode = char.charCodeAt(0);
const byteLength = charCode < 0x80 ? 1 : charCode < 0x800 ? 2 : 3;
if (bytesCount + byteLength <= length) {
truncated += char;
bytesCount += byteLength;
} else {
truncated += "..."
break;
}
}
return truncated;
}
</script>
<template>
<el-dialog title="里站搜索" v-model="isShowUp" top="0" style="margin-bottom: 0" width="100%" class="el-dialogClass" @close="close">
<el-dialog title="里站搜索" v-model="isShowUp" top="0" style="margin-bottom: 0" fullscreen class="el-dialogClass" @close="close">
<div style="text-align: center">
<el-input v-model="keyword" style="width: 50vw"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <div id="loading"/>
<el-input v-model="keyword" style="width: 50vw"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <div id="loading" v-if="isLoading"/>
</div>
<el-scrollbar height="65vh" ref="scrollBar">
<div style="height: 20vh; width: 100%; border-radius: 5px" v-for="gallery in galleries">
<el-image alt="picture" :preview-src-list="['http://downloader.lionwebsite.xyz/query/image?path=' + gallery.thumbnailUrl,]"
:src="'http://downloader.lionwebsite.xyz/query/image?path=' + gallery.thumbnailUrl"
<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,]"
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl"
style="height:20vh;width:35vw;float: left;"
fit="contain"
loading="lazy"
/>
<div style="font: bold 10px semi-condensed; margin-top: 1vh; padding-left: 40vw; padding-top: 2vw">
<span>{{gallery.name}}</span><br>
<div style="font: bold 16px semi-condensed; height: 25vh; padding-left: 40vw;">
<span>{{adjustGalleryName(gallery.name, 80)}}</span><br>
<span>上传时间{{gallery.uploadTime}}</span><br>
<span>页数{{gallery.page}}</span><br>
<span class="ct6">类型{{gallery.type}}</span><br>
@ -120,7 +135,7 @@ function close(){
border-top-color: #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
display: none;
display: inline-block;
}
@keyframes spin {

View File

@ -1,13 +1,15 @@
<script setup>
import {computed, ref, watch} from "vue";
import store from "../store/index.js";
let props = defineProps(['currentLinks', 'isOnlineReading'])
let props = defineProps(['currentGallery', 'isOnlineReading'])
let emit = defineEmits(['close'])
let isShowUp = ref()
let onlineReadingScrollbar = ref()
let links = ref()
let index = ref(0)
let temp_index = ref(0) //
let max = ref(0)
let current_page = 0
let lengthPerPage = computed(() => {
return store.state.lengthPerPage
})
@ -19,12 +21,12 @@ watch(props, (props)=>{
//
function alterPage(){
console.log(lengthPerPage.value)
if(props.currentLinks.length > lengthPerPage.value){
links.value = props.currentLinks.slice(0, lengthPerPage.value)
max.value = Math.ceil(props.currentLinks.length / lengthPerPage.value)
if(props.currentGallery.images.length > lengthPerPage.value){
links.value = props.currentGallery.images.slice(0, lengthPerPage.value)
max.value = Math.ceil(props.currentGallery.images.length / lengthPerPage.value)
}else{
links.value = props.currentLinks
links.value = props.currentGallery.images
max.value = 0
}
index.value = 0
temp_index.value = 1
@ -32,7 +34,7 @@ function alterPage(){
//
function jump(targetIndex){
links.value = props.currentLinks.slice(targetIndex * lengthPerPage.value, (targetIndex + 1) * lengthPerPage.value)
links.value = props.currentGallery.images.slice(targetIndex * lengthPerPage.value, (targetIndex + 1) * lengthPerPage.value)
index.value = targetIndex
temp_index.value = targetIndex + 1
onlineReadingScrollbar.value.setScrollTop(0)
@ -40,18 +42,57 @@ function jump(targetIndex){
function closeDialog(){
onlineReadingScrollbar.value.setScrollTop(0)
emit('close')
}
function switch_page(target_page){
console.log(current_page, target_page)
//
if(target_page > (current_page + 1) && current_page === 0 && index.value > 0) {
console.log("上一页")
document.querySelector("span.el-image-viewer__btn.el-image-viewer__close").click()
jump(index.value - 1)
onlineReadingScrollbar.value.setScrollTop(onlineReadingScrollbar.value.wrapRef.scrollHeight)
let top = 0
let timer = setInterval(() => {
if(onlineReadingScrollbar.value.scrollTop === top){
clearInterval(timer)
document.querySelector("div.el-scrollbar__wrap.el-scrollbar__wrap--hidden-default > div > div:last-child > img").click()
}
top = onlineReadingScrollbar.value.scrollTop
onlineReadingScrollbar.value.setScrollTop(onlineReadingScrollbar.value.wrapRef.scrollHeight)
}, 100)
//
}else if(target_page === 0 && current_page === lengthPerPage.value - 1 && index.value < max.value){
console.log("下一页")
jump(index.value + 1)
current_page = 0
document.querySelector("div.el-scrollbar__wrap.el-scrollbar__wrap--hidden-default > div > div:nth-child(1) > img").click()
}
else{
current_page = target_page
}
}
function set_current_page(page){
current_page = page
}
</script>
<template>
<el-dialog v-model="isShowUp" title="在线预览" @close="closeDialog" width="100%" top="0">
<div style="font-size: 20px; text-align: center;" v-if="max > 0">
{{index + 1}} - {{(index) * lengthPerPage + 1}} ~ {{(index + 1) * lengthPerPage + 1 > currentLinks.length? currentLinks.length: (index + 1) * lengthPerPage + 1}}
</div>
<el-dialog v-model="isShowUp" @close="closeDialog" width="100%" top="0" fullscreen >
<template #header style="padding-bottom: 0">
在线预览: {{currentGallery.name}} 页数{{currentGallery.pages}}<br>
<div style="font-size: 3vh; display: inline" v-if="max > 0">
{{ index + 1 }} - {{ (index) * lengthPerPage + 1 }} ~
{{ (index + 1) * lengthPerPage + 1 > currentGallery.images.length ? currentGallery.images.length : (index + 1) * lengthPerPage }}
</div>
</template>
<el-scrollbar height="75vh" ref="onlineReadingScrollbar">
<el-image v-for="(link, i) in links" :src="link" :style="{'width': 'auto', 'text-align': 'center', 'background-color': 'ghostwhite'}"
:preview-src-list="currentLinks" :initial-index="index * lengthPerPage + i" loading="lazy"/>
:preview-src-list="links" :initial-index="i" @switch="switch_page" @show="set_current_page(i)"/>
</el-scrollbar>
<!--五页以下-->

View File

@ -1,48 +1,50 @@
<template>
<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" :empty-text="emptyText" :row-key="gallery=>gallery.gid">
<el-table-column type="expand" width="25px">
<template #default="props">
名字:{{ props.row.name}} <br>
链接:<el-link :href="props.row.link">Link</el-link> <br>
语言:{{props.row.language}} <br>
页数:{{props.row.pages}} <br>
文件大小:{{props.row.fileSize}}<br>
分辨率:{{props.row.resolution}}<br>
任务创建时间:{{props.row.createTimeDisplay}}<br>
标签:{{props.row.tag === '' ? '无': props.row.tag}} <br>
<span v-show="isLion">
downloader:{{props.row.downloader}}
<el-scrollbar max-height="80vh">
<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="getGalleryThumb(gallery)"
style="height: 20vh; width: 35vw; float:left"
fit="contain"
loading="lazy"
></el-image>
<div style="font: bold 16px semi-condensed;">
{{adjustGalleryName(gallery.name, 95)}}<br>
页数:{{gallery.pages}}<br>
语言:{{gallery.language}}
<span v-if="gallery.status !== '下载完成'">
下载进度: {{gallery.progress}}
</span>
<el-button @click="downloadTask(props.row.download)" :disabled="props.row.download === undefined">下载</el-button>
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.download === undefined">删除</el-button>
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-if="isLion">分享</el-button>
<el-button @click="changeGalleryCollect(props.row.gid, props.row.isCollect)" :disabled="props.row.download === undefined">{{props.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="onlineGalleryReader(props.row.gid)" :disabled="props.row.download === undefined">在线看</el-button>
<el-button @click="showThumbnail(props.row)" :disabled="props.row.download === undefined">预览封面</el-button><br>
<el-button @click="editGalleryTag(props.row)" :disabled="props.row.download === undefined">编辑标签</el-button>
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.download === undefined">更新本子</el-button>
</template>
</el-table-column>
<el-table-column label="名字" width="240px">
<template #default="scoped">
<span @click="showThumbnail(scoped.row)">
{{galleryNameType === 'shortName' ? scoped.row.shortName: scoped.row.name}}
</span>
</template>
</el-table-column>
<el-table-column label="进度" width="55px">
<template #default="scoped">
{{ scoped.row.progress }}
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-scrollbar>
<el-col>
<el-row>
<el-button @click="store.state.isShowHistory = true"></el-button>
<el-select style="width: 22vw" v-model="type">
<el-option value="keyword" label="关键字"/>
<el-option value="tag" label="标签"/>
</el-select>
<el-input style="width: 60vw" v-model="param" v-show="type === 'keyword'" placeholder="关键字搜索">
<template #append>
<el-button @click="queryLocalTask">搜索</el-button>
</template>
</el-input>
<el-autocomplete v-model="param" :fetch-suggestions="generateQueryTag"
@select="handleQueryTagSelect" placeholder="检索标签"
style="width: 60vw" v-if="type === 'tag'">
<template #append>
<el-button :disabled="paramForTags.length === 0" @click="removeAllQueryTag">清空tag</el-button>
</template>
</el-autocomplete>
</el-row>
</el-col>
<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)" size="large" style="display: inline-block" v-if="paramForTags.length !== 0">
{{store.state.tags.get(tid).tag}}
</el-tag>
<el-row class="pageChanger">
<el-col>
@ -86,7 +88,6 @@
</el-row>
</div>
</div>
</el-drawer>
<el-dialog v-model="isEditingTag" title="编辑本子标签" width="100%">
<el-form>
@ -104,7 +105,47 @@
</el-form>
</el-dialog>
<OnlineReader :currentLinks="currentLinks" :isOnlineReading="isOnlineReading"/>
<el-dialog v-model="isViewing" width="100%" top="0" style="padding: 0">
<div style="height: 20vh; font: bold 16px semi-expanded">
<el-image :src="getGalleryThumb(currentGallery)"
style="float: left; width: 40vw; height: 20vh" fit="contain"/>
{{adjustGalleryName(currentGallery.name, 150)}}
</div>
<div style="font: bold 20px semi-expanded">
页数:{{currentGallery.pages}} <br>
语言:{{currentGallery.language}} <br>
下载时间:{{currentGallery.createTimeDisplay}} <br>
大小:{{currentGallery.fileSize}} <br>
分辨率:{{currentGallery.resolution}} <br>
链接:<a :href="currentGallery.link">link</a> <br>
下载链接:<a :href="currentGallery.download">link</a><br>
标签:{{currentGallery.tag === '' ? '无': currentGallery.tag}} <br>
<span v-show="isLion">
downloader:{{currentGallery.downloader}}
</span>
<span v-if="currentGallery.download === undefined">
下载进度: {{currentGallery.progress}}
</span>
</div>
<template #footer>
<el-button @click="downloadTask(currentGallery.download)" :disabled="currentGallery.status !== '下载完成' || currentGallery.mode === 2"
size="large">下载</el-button>
<el-button @click="deleteGallery(currentGallery.gid)" :disabled="currentGallery.status !== '下载完成'"
size="large">删除</el-button>
<el-button @click="shareGallery({gid:currentGallery.gid, shortName:currentGallery.shortName + '.zip'})" v-if="isLion"
size="large">分享</el-button>
<el-button @click="changeGalleryCollect(currentGallery.gid, currentGallery.isCollect)" :disabled="currentGallery.status !== '下载完成'"
size="large">{{currentGallery.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="onlineGalleryReader" :disabled="currentGallery.status !== '下载完成' || currentGallery.mode === 1"
size="large">在线看</el-button>
<el-button @click="editGalleryTag(currentGallery)" :disabled="currentGallery.status !== '下载完成'"
size="large">编辑标签</el-button>
<el-button @click="updateGallery(currentGallery.link)" :disabled="currentGallery.status !== '下载完成'"
size="large">更新本子</el-button>
</template>
</el-dialog>
<OnlineReader :current-gallery="currentGallery" :isOnlineReading="isOnlineReading" @close="isOnlineReading = false"/>
</template>
<script setup>
@ -114,12 +155,18 @@ import axios from "axios";
import {ElMessage} from "element-plus";
import OnlineReader from "./OnlineReader.vue";
let link = "https://downloader.lionwebsite.xyz/GalleryManage/"
//
let inputNode = ref(null)
//
let isEditingPage = ref(false)
//
let isEditingTag = ref(false)
//
let isOnlineReading = ref(false)
//
let isViewing = ref(false)
//
let galleryForTag = ref({})
@ -129,6 +176,13 @@ let galleryNameType = ref("shortName") // shortName name
let sortType = ref("shortName") // shortName name createTime
let targetPage = ref(1) //
//
let type = ref("keyword")
let param = ref("")
let paramForTags = ref([]) //tidS
let onlineReadingScrollbar = ref(null)
let loadComplete = computed(() => {
@ -139,12 +193,6 @@ let currentTasks = computed(() => {
return store.getters.currentTasks ? store.getters.currentTasks: null
})
let isOpenHistoryPanel = computed(() => {
return store.state.isShowHistory
})
let isOnlineReading = computed(() => {
return store.state.isOnlineReading
})
//
let tags = computed(() => {
return store.state.tags
@ -174,9 +222,7 @@ let emptyText = computed(() => {
})
//线
let currentLinks = computed(() => {
return store.state.currentLinks
})
let currentGallery = ref({name:"name"})
//
function next() {
@ -243,12 +289,10 @@ function querySimilarTag(keyWord, cb){
skip = false
for(let id of galleryForTag.value.tags)
if(id === key) {
if(!hit && tag.tag === keyWord) //
if (!hit && tag.tag === keyWord) //
hit = true
skip = true
break
}else{
console.log("id:", id, key)
}
if(skip)
continue
@ -276,6 +320,58 @@ function handleTagSelect(data){
tagInput.value.blur()
}
function generateQueryTag(keyWord, cb){
let result = []
let hit = false //
let skip //
for(const [key, tag] of store.state.tags){
skip = false
if(paramForTags.value.length !== 0) {
for (let id of paramForTags.value)
if (id === key) {
if (!hit && tag.tag === keyWord) //
hit = true
skip = true
break
}
if(skip)
continue
}
if(tag.tag.includes(keyWord))
result.push({value: tag.tag, tag:tag})
}
cb(result)
}
function removeQueryTag(tid){
for (let i=0; i<paramForTags.value.length; i++){
if(paramForTags.value[i] === tid){
paramForTags.value.splice(i, 1)
break
}
}
queryLocalTask()
}
function removeAllQueryTag(){
paramForTags.value.splice(0)
queryLocalTask()
}
function handleQueryTagSelect(data) {
console.log(data)
paramForTags.value.push(data.tag.id)
param.value = ''
queryLocalTask()
}
function queryLocalTask(){
switch (type.value){
case "keyword":
store.commit("_searchLocalByKeyword", param.value)
break
case "tag":
store.commit("_searchLocalByTag", paramForTags.value)
break
}
}
function mark(gid, tid){
store.dispatch("mark", {gid, tid})
}
@ -292,18 +388,24 @@ function updateGallery(link){
store.dispatch("updateGallery", link)
}
function deleteGallery(gid){
store.dispatch("deleteGallery", gid)
store.dispatch("deleteGallery", gid).then(() => {
isViewing.value = false
})
}
function onlineGalleryReader(gid){
store.dispatch("queryOnlineLinks", gid)
function onlineGalleryReader(){
isOnlineReading.value = true;
}
function viewInfo(gallery){
currentGallery.value = gallery
isViewing.value = true;
}
function shareGallery(data){
const {gid, shortName} = data
let link
axios.post("http://downloader.lionwebsite.xyz/GalleryManage/share?userId=3&expireHour=3&gid=" + gid).then((res) => {
axios.post("https://downloader.lionwebsite.xyz/GalleryManage/share?userId=3&expireHour=3&gid=" + gid).then((res) => {
if(res.data.result === "success"){
let data = JSON.parse(res.data.data)
link = 'http://lionwebsite.xyz/GetFile/{0}?ShareCode={1}'.replace('{0}', encodeURIComponent(shortName)).replace('{1}', data.shareCode)
link = 'https://lionwebsite.xyz/GetFile/{0}?ShareCode={1}'.replace('{0}', encodeURIComponent(shortName)).replace('{1}', data.shareCode)
ElMessage({dangerouslyUseHTMLString: true,
message: "<span>分享成功, 过期时间:" + data.expireTime + "</span><br><a href=" + link + ">链接</a>",
duration: 0,
@ -315,27 +417,50 @@ function shareGallery(data){
ElMessage(res.data.data)
})
}
//
function showThumbnail(gallery){
store.commit("_changeThumbnailGallery", gallery)
setTimeout(() => {document.querySelector(".preview > img").click()}, 1)
function adjustGalleryName(name, length) {
let truncated = '';
let bytesCount = 0;
for (const char of name) {
const charCode = char.charCodeAt(0);
const byteLength = charCode < 0x80 ? 1 : charCode < 0x800 ? 2 : 3;
if (bytesCount + byteLength <= length) {
truncated += char;
bytesCount += byteLength;
} else {
truncated += "..."
break;
}
}
return truncated;
}
//
function closeHistoryPanel(){
store.commit("_closeHistoryPanel")
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')
}
</script>
<style scoped>
.side{
text-align: center;
}
span{
display: block;
}
.pageChanger{
margin-top: 5vh;
text-align: center;
}
.el-select{
width: 135px;

View File

@ -2,7 +2,7 @@ import vuex from "vuex"
import axios from "axios"
import {ElMessage} from "element-plus"
import qs from "qs"
const BaseUrl = "http://downloader.lionwebsite.xyz/"
const BaseUrl = "https://downloader.lionwebsite.xyz/"
const GalleryManageUrl = BaseUrl + "GalleryManage"
const actions = {
@ -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("提交成功")
@ -74,26 +72,6 @@ const actions = {
ElMessage("查询失败")
})
},
queryOnlineLinks(context, gid){
// 如果本地有缓存,则直接返回,没有再请求
if(context.state.onlineLinks[gid] !== undefined){
context.commit("_setOnlineLinks", gid)
}
else {
axios.get(GalleryManageUrl + "/onlineLinks", {
params: {
AuthCode: state.AuthCode,
gid,
}
}).then((res) => {
if (res.data.result === "success")
context.commit("_addAndSetOnlineLinks", {gid, links: res.data.data})
else
ElMessage(res.data.data)
})
}
},
updateGallery(context, link){
axios.post(GalleryManageUrl + "/update", qs.stringify({AuthCode: state.AuthCode, link}))
.then((res) => {
@ -111,7 +89,11 @@ const actions = {
validate(context, AuthCode){
axios.post(BaseUrl + "validate?AuthCode=" + AuthCode).then((res)=>{
if(res.data.result === 'success'){
context.commit("_authed", {AuthCode, ...JSON.parse(res.data.data)})
let data = JSON.parse(res.data.data);
if(!data.isAvailable){
ElMessage({duration:0, message:"节点挂了,不能下也不能看,找狮子处理", type: "error"})
}
context.commit("_authed", {AuthCode, ...data})
//初始化
context.dispatch("loadTags", true).then()
context.dispatch("loadWeekUsedAmount").then()
@ -265,6 +247,11 @@ const actions = {
else
ElMessage(res.data.data)
})
},
resetUndone() {
axios.post(GalleryManageUrl + "/reset?AuthCode=big+lion").then((res) => {
ElMessage(res.data.data)
})
}
}
@ -310,10 +297,19 @@ const mutations = {
break;
case "下载完成":
task.progress = "下载完成"
let tempLink
tempLink = task.link.replace("element-plus.org", "exhentai.org").replace("element.org", "e-hentai.org")
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name.replace("#", "")) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
if(task.mode === 1 || task.mode === 3)
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + ".zip?AuthCode=" + state.AuthCode + "&gid=" + task.gid
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 = "压缩中"
break
}
//处理时间戳
@ -353,7 +349,7 @@ const mutations = {
preDeleteIndex = -1
if(task.status !== "下载完成")
for(let i=0; i < tasks.length; i++)
if(tasks[i].name === task.name) {
if(tasks[i] !== undefined && tasks[i].name === task.name) {
preDeleteIndex = i
task.status = tasks[i].status
task.proceeding = tasks[i].proceeding
@ -571,27 +567,6 @@ const mutations = {
else
state.length = state.defaultLength
},
_addAndSetOnlineLinks(state, data){
let links = JSON.parse(data.links)
state.onlineLinks[data.gid] = []
state.currentLinks.splice(0)
state.currentGid = data.gid
links.forEach((link) => {
state.onlineLinks[data.gid].push('http://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
state.currentLinks.push('http://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
})
state.isOnlineReading = true
},
_setOnlineLinks(state, gid){
state.currentLinks.splice(0)
state.onlineLinks[gid].forEach((link) => {
state.currentLinks.push(link)
})
state.currentGid = gid
state.isOnlineReading = true
},
_openHistoryPanel(state){
state.isShowHistory = true
},
@ -599,8 +574,14 @@ const mutations = {
state.isShowHistory = false
},
_changeThumbnailGallery(state, gallery){
state.thumbnailGallery = gallery
state.thumbnailGallery.url = GalleryManageUrl + "/thumbnail/" + encodeURIComponent(gallery.name) + ".webp?AuthCode="+state.AuthCode
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,]
}
}
}
@ -613,10 +594,7 @@ const state = {
tags: new Map(), //可用tag
isSearch: false, //用于决定是否显示搜索结果
onlineLinks: {}, //在线本子链接
isOnlineReading: false, //是否在线看
currentGid: "", //当前GID
currentLinks: [], //当前本子链接
lengthPerPage: 0, //在线预览每页图片数量
page: 1, //当前页数