Compare commits

...

10 Commits

5 changed files with 383 additions and 198 deletions

View File

@ -32,24 +32,30 @@
<hr>
<el-button @click="isAlterAuthCode = true">修改授权码</el-button>
<el-button @click="deleteAuthCode">删除本地授权码</el-button>
<el-button @click="isConfigDarkMode = true">夜间模式配置</el-button>
<el-button @click="isConfig = true">配置</el-button>
<span style="display: inline">夜间模式</span>
<el-switch @click="toggleStyle" v-model="isDark">夜间模式</el-switch>
<hr>
<el-button @click="isQuerying = true">里站搜索</el-button>
<el-button @click="isViewingTag = true">查看标签</el-button>
<div v-show="thumbnailGallery !== {}">
<hr>
<el-button v-if="isLion" @click="resetUndone">重置任务</el-button>
<div v-show="thumbnailGallery.url !== undefined">
<span>
{{thumbnailGallery.shortName}}<br>
<el-space v-show="thumbnailGallery.tag !== ''">标签:{{thumbnailGallery.tag}}</el-space>
</span><br>
<picture>
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.url,]" :initial-index="0" class="preview"></el-image>
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.images[0], ]" :initial-index="0" class="preview"
style="width: 300px; height: 250px" fit="contain"/>
</picture>
</div>
</div>
<el-dialog title="查询本子" v-model="chosenGallery">
<el-image v-show='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,9 +70,16 @@
</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>
标签:<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)">
{{store.state.tags.get(tid).tag}}
</el-tag>
{{store.state.tags.get(tid).tag}}
</el-tag>
<el-autocomplete v-model="param" :fetch-suggestions="completeQueryTag" @select="handleTagSelect" ref="tagInputForSubmit"/>
</tr>
</table>
@ -103,47 +116,28 @@
</el-footer>
</el-dialog>
<el-dialog title="里站搜索" v-model="isQuerying" top="0" style="margin-bottom: 0">
<div style="text-align: center">
<el-input v-model="keyword"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <div id="loading"/>
</div>
<el-scrollbar height="525px">
<div style="height: 251px; 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"
style="height:250px;width:250px;float: left;"
fit="contain"
loading="lazy"
/>
<div style="font: bold 16px semi-condensed; margin-top: 10px; padding-top: 15px; padding-left: 275px">
<span>{{gallery.name}}</span><br><br>
<span>上传时间{{gallery.uploadTime}}</span><br>
<span>页数{{gallery.page}}</span><br>
<span class="ct6">类型{{gallery.type}}</span><br>
<a :href="gallery.link">链接</a><br>
<el-button style="position: relative; margin-left: 80%" @click="param=gallery.link; queryRemoteTask()">下载</el-button>
</div>
</div>
</el-scrollbar>
<div style="padding-top: 10px; text-align: center">
<el-button @click="queryGalleries(queryPage.first)" :disabled="queryPage.first === undefined">首页</el-button>
<el-button @click="queryGalleries(queryPage.previous)" :disabled="queryPage.previous === undefined">上一页</el-button>
<el-button @click="queryGalleries(queryPage.next)" :disabled="queryPage.next === undefined">下一页</el-button>
<el-button @click="queryGalleries(queryPage.last)" :disabled="queryPage.last === undefined">尾页</el-button>
</div>
</el-dialog>
<HentaiSearch v-model:is-querying="isQuerying" @close="isQuerying = false"></HentaiSearch>
<el-dialog title="配置夜间模式" v-model="isConfigDarkMode">
<span style="display: inline-block">夜间模式跟随系统</span>
<el-switch v-model="darkConfig.followSystem"></el-switch><br>
<span style="display: inline-block">自定义起始时间(精确到分)</span>
<el-switch v-model="darkConfig.customTime"></el-switch><br>
<el-form :disabled="!darkConfig.customTime">
<el-time-picker v-model="darkConfig.startTime" /> ~
<el-time-picker v-model="darkConfig.endTime"/>
</el-form>
<el-dialog title="配置" v-model="isConfig">
<div>
夜间模式<hr>
<span style="display: inline-block">夜间模式跟随系统</span>
<el-switch v-model="darkConfig.followSystem"></el-switch><br>
<span style="display: inline-block">自定义起始时间(精确到分)</span>
<el-switch v-model="darkConfig.customTime"></el-switch><br>
<el-form :disabled="!darkConfig.customTime">
<el-time-picker v-model="darkConfig.startTime" /> ~
<el-time-picker v-model="darkConfig.endTime"/>
</el-form>
</div>
<div>
在线预览<hr>
<span style="display: inline-block">在线预览分页页数:</span>
<input v-model="lengthPerPage">
(建议为3的倍数因为固定了一行三张)
</div>
<template #footer>
<el-button type="primary" @click="saveDarkConfig">保存</el-button>
<el-button type="primary" @click="saveConfig">保存</el-button>
</template>
</el-dialog>
@ -187,6 +181,7 @@ import {computed, ref, onMounted} from "vue";
import {ElMessage} from "element-plus"
import axios from "axios";
import qs from "qs";
import HentaiSearch from "./HentaiSearch.vue";
//
let AuthCode = ref("")
@ -197,12 +192,11 @@ let tempAuthCode = ref("")
let isQuerying = ref(false)
let isViewingTag = ref(false)
let isConfigDarkMode = ref(false)
let isConfig = ref(false)
let isDark = ref(false)
let keyword = ref("")
let galleries = ref([])
let queryPage = ref({})
let darkConfig = ref({})
let lengthPerPage = ref(0)
//
let type = ref("link")
@ -210,6 +204,7 @@ let param = ref("")
let paramForTags = ref([]) //tidS
let targetResolution = ref("")
let targetDownloadMode = ref("")
let tag = ref("")
let tagKeyWord = ref("") //tag
@ -248,9 +243,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")
}
@ -288,10 +289,14 @@ function postTask(){
ElMessage("请选择分辨率再提交")
return
}
let tempLink = coverLink(chosenGallery.value.link)
if(targetDownloadMode.value === ''){
ElMessage("请选择下载模式再提交")
return
}
store.dispatch("postGalleryTask",
{link: tempLink,
{link: chosenGallery.value.link,
targetResolution: targetResolution.value,
mode: targetDownloadMode.value,
tags:paramForTags.value})
targetResolution.value = ""
}
@ -302,8 +307,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){
@ -371,7 +377,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
})
@ -401,36 +407,6 @@ function resetLocalQuery(){
store.commit("_searchLocalByKeyword", "")
param.value = ""
}
function queryGalleries(link){
let tempParam
if(link !== null) {
let url = new URL(link)
tempParam = url.search.replace("?f_search=", "")
}else{
tempParam = keyword.value
}
tempParam = tempParam.replace(" ", "+")
document.getElementById("loading").style.display = "inline-block";
axios.get("http://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
.then((res) => {
document.getElementById("loading").style.display = "none";
if (res.data.result === "success") {
let tempGalleries = JSON.parse(res.data.data)
queryPage.value.first = 'first' in res.data ? res.data.first : undefined
queryPage.value.previous = 'previous' in res.data ? res.data.previous : undefined
queryPage.value.next = 'next' in res.data ? res.data.next : undefined
queryPage.value.last = 'last' in res.data ? res.data.last : undefined
galleries.value.splice(0)
tempGalleries.forEach((gallery) => {
galleries.value.push(gallery)
})
}else {
ElMessage({message: res.data.data, type: "error"})
}
})
}
function deleteGallery(){
store.dispatch("deleteGallery", chosenGallery.value.gid)
@ -457,9 +433,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 onlineGalleryReader(gid){
@ -470,6 +443,10 @@ function showThumbnailGallery(gallery){
document.querySelector(".preview > img").click()
}
//
function resetUndone(){
store.dispatch("resetUndone").then()
}
function deleteAuthCode(){
localStorage.removeItem('auth')
ElMessage("删除授权码完成")
@ -484,6 +461,9 @@ function toggleStyle(){
onMounted(() => {
const auth = localStorage.getItem("auth")
adjustForStyle()
store.state.lengthPerPage = localStorage.getItem("lengthPerPage")
store.state.lengthPerPage = store.state.lengthPerPage === null ? 30: Number(store.state.lengthPerPage)
lengthPerPage.value = store.state.lengthPerPage
if(auth !== null){
store.dispatch("validate", auth)
@ -566,7 +546,7 @@ function light(){
document.querySelector(".DashBoard").style.setProperty("background-color", "ghostwhite")
document.querySelector(".app").style.setProperty("background-color", "#c6e2ff")
}
function saveDarkConfig(){
function saveConfig(){
if(darkConfig.value.customTime) {
if(darkConfig.value.startTime === undefined || darkConfig.value.endTime === undefined){
ElMessage("请正确选择起始时间")
@ -574,8 +554,16 @@ function saveDarkConfig(){
}
}
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))
isConfigDarkMode.value = false
isConfig.value = false
adjustForStyle()
}
</script>
@ -589,18 +577,4 @@ function saveDarkConfig(){
.el-input{
width: 200px;
}
#loading {
width: 25px;
height: 25px;
border: 2px solid #ccc;
border-top-color: #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
display: none;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>

View File

@ -0,0 +1,126 @@
<script setup>
import {ref, watch} from "vue";
import axios from "axios";
import {ElMessage} from "element-plus";
import store from "../store/index.js";
let props = defineProps(['isQuerying'])
let emit = defineEmits(['close'])
let scrollBar = ref()
let keyword = ref("")
let queryPage = ref({})
let galleries = ref([])
let param = ref()
let isShowUp = ref()
watch(props, () => {
isShowUp.value = props.isQuerying
})
function queryGalleries(link) {
let tempParam
if (link !== null) {
let url = new URL(link)
tempParam = url.search.replace("?f_search=", "")
} else {
tempParam = keyword.value
}
tempParam = tempParam.replace(" ", "+")
document.getElementById("loading").style.display = "inline-block";
axios.get("https://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
.then((res) => {
document.getElementById("loading").style.display = "none";
if (res.data.result === "success") {
let tempGalleries = JSON.parse(res.data.data)
queryPage.value.first = 'first' in res.data ? res.data.first : undefined
queryPage.value.previous = 'previous' in res.data ? res.data.previous : undefined
queryPage.value.next = 'next' in res.data ? res.data.next : undefined
queryPage.value.last = 'last' in res.data ? res.data.last : undefined
galleries.value.splice(0)
tempGalleries.forEach((gallery) => {
galleries.value.push(gallery)
})
scrollBar.value.setScrollTop(0)
} else {
ElMessage({message: res.data.data, type: "error"})
}
})
}
function queryRemoteTask(){
if(!validateLink(param.value)){
ElMessage("链接错误")
return
}
store.dispatch("queryGalleryTask", param.value)
}
function validateLink(rawLink){
if(rawLink.trim() === "")
return false
if(rawLink.includes("hentai"))
return rawLink.includes("/g/")
else
return false
}
function close(){
emit("close")
}
</script>
<template>
<el-dialog title="里站搜索" v-model="isShowUp" top="0" style="margin-bottom: 0" @close="close">
<div style="text-align: center">
<el-input v-model="keyword"></el-input> <el-button @click="queryGalleries(null)">查询</el-button> <div id="loading"/>
</div>
<el-scrollbar height="75vh" ref="scrollBar">
<div style="height: 251px; width: 100%; " 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:250px;width:250px;float: left;"
fit="contain"
loading="lazy"
/>
<div style="font: bold 16px semi-condensed; margin-top: 10px; padding-top: 15px; padding-left: 275px">
<span>{{gallery.name}}</span><br><br>
<span>上传时间{{gallery.uploadTime}}</span><br>
<span>页数{{gallery.page}}</span><br>
<span class="ct6">类型{{gallery.type}}</span><br>
<a :href="gallery.link">链接</a><br>
<el-button style=" margin-left: 80%; margin-top: -5vh" @click="param=gallery.link; queryRemoteTask()">查看</el-button>
</div>
</div>
</el-scrollbar>
<div style="padding-top: 1vh; text-align: center">
<el-button @click="queryGalleries(queryPage.first)" :disabled="queryPage.first === undefined">首页</el-button>
<el-button @click="queryGalleries(queryPage.previous)" :disabled="queryPage.previous === undefined">上一页</el-button>
<el-button @click="queryGalleries(queryPage.next)" :disabled="queryPage.next === undefined">下一页</el-button>
<el-button @click="queryGalleries(queryPage.last)" :disabled="queryPage.last === undefined">尾页</el-button>
</div>
</el-dialog>
</template>
<style scoped>
.el-input{
width: 200px;
}
#loading {
width: 25px;
height: 25px;
border: 2px solid #ccc;
border-top-color: #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
display: none;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>

View File

@ -0,0 +1,120 @@
<script setup>
import {computed, ref, watch} from "vue";
import store from "../store/index.js";
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
})
watch(props, (props)=>{
isShowUp.value = props.isOnlineReading
alterPage()
})
//
function alterPage(){
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.currentGallery.images
max.value = 0
}
index.value = 0
temp_index.value = 1
}
//
function jump(targetIndex){
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)
}
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" width="90%" style="margin-top: 0; margin-bottom: 0; padding: 0" @close="closeDialog">
<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': store.state.imageWidth, 'padding-right': store.state.imagePadding, 'background-color': 'gary'}"
:preview-src-list="links" :initial-index="i" @switch="switch_page" @show="set_current_page(i)">
</el-image>
</el-scrollbar>
<!-- 十页以下-->
<span v-if="max > 1 && max < 9">
<el-button @click="jump(index - 1)" :disabled="index === 0">上一页</el-button>
<el-button v-for="i in max" @click="jump(i - 1)">
{{i}}
</el-button>
<el-button @click="jump(index + 1)" :disabled="index === max - 1">下一页</el-button>
</span>
<!-- 十页及以上-->
<span v-if="max >= 9">
<el-button @click="jump(index - 1)" :disabled="index === 0">上一页</el-button>
1 &lt;
<el-input-number v-model="temp_index" :min="1" :max="max"/>
&lt; {{max}}
<el-button @click="jump(index + 1)" :disabled="index === max - 1">下一页</el-button>
<el-button @click="jump(temp_index - 1)" size="large">跳转</el-button>
</span>
</el-dialog>
</template>
<style scoped>
</style>

View File

@ -6,6 +6,7 @@
:empty-text="emptyText"
:row-key="gallery=>gallery.gid"
class="table"
@cellMouseEnter="showThumbnail"
>
<el-table-column type="expand">
@ -22,27 +23,25 @@
downloader:{{props.row.downloader}}
</span>
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.download === undefined">删除</el-button>
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.status !== '下载完成'">删除</el-button>
<el-button @click="editGalleryTag(props.row)">编辑标签</el-button>
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.download === undefined">更新</el-button>
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-show="isLion">分享</el-button>
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.status !== '下载完成'">更新</el-button>
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-show="isLion" :disabled="props.row.status !== '下载完成'">分享</el-button>
</template>
</el-table-column>
<el-table-column label="名字" width="300vw">
<template #default="scoped">
<span @mouseover="showThumbnail(scoped.row)">
{{galleryNameType === 'shortName' ? scoped.row.shortName: scoped.row.name}}
</span>
{{galleryNameType === 'shortName' ? scoped.row.shortName: 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="downloadTask(scoped.row.download)" :disabled="scoped.row.status !== '下载完成' || scoped.row.mode === 2">下载</el-button>
<el-button @click="changeGalleryCollect(scoped.row.gid, scoped.row.isCollect)">{{scoped.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
<el-button @click="onlineGalleryReader(scoped.row.gid)" :disabled="scoped.row.download === undefined">在线看</el-button>
<el-button @click="onlineGalleryReader(scoped.row)" :disabled="scoped.row.status !== '下载完成' || scoped.row.mode === 1">在线看</el-button>
</span>
</template>
</el-table-column>
@ -111,12 +110,7 @@
</el-form>
</el-dialog>
<el-dialog v-model="isOnlineReading" title="在线预览" @close="closeOnlineReading" width="90%" style="margin-top: 0; margin-bottom: 0; padding: 0">
<el-scrollbar height="84vh" ref="onlineReadingScrollbar">
<el-image v-for="(link, index) in currentLinks" :src="link" :style="{'width': imageWidth, 'padding-right': imagePadding, 'background-color': 'ghostwhite'}"
:preview-src-list="currentLinks" :initial-index="index" loading="lazy"/>
</el-scrollbar>
</el-dialog>
<OnlineReader :current-gallery="currentGallery" :isOnlineReading="isOnlineReading" @close="isOnlineReading = false"/>
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
</div>
@ -127,6 +121,9 @@ import store from "../store";
import {computed, ref} from "vue";
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)
@ -134,6 +131,8 @@ let inputNode = ref(null)
let isEditingPage = ref(false)
//
let isEditingTag = ref(false)
//
let isOnlineReading = ref(false)
//
let galleryForTag = ref({})
@ -155,9 +154,6 @@ let loadComplete = computed(() => {
let currentTasks = computed(() => {
return store.getters.currentTasks ? store.getters.currentTasks: null
})
let isOnlineReading = computed(() => {
return store.state.isOnlineReading
})
let min = computed(() => {
return store.getters.min
@ -181,9 +177,7 @@ let emptyText = computed(() => {
})
//线
let currentLinks = computed(() => {
return store.state.currentLinks
})
let currentGallery = ref({name:"name"})
let imageWidth = computed(() => {
return store.state.imageWidth
})
@ -313,20 +307,17 @@ function updateGallery(link){
function deleteGallery(gid){
store.dispatch("deleteGallery", gid)
}
function onlineGalleryReader(gid){
store.dispatch("queryOnlineLinks", gid)
}
function closeOnlineReading(){
store.state.isOnlineReading = false
onlineReadingScrollbar.value.setScrollTop(0)
function onlineGalleryReader(gallery){
currentGallery.value = gallery
isOnlineReading.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,
@ -341,11 +332,12 @@ function shareGallery(data){
//
function showThumbnail(gallery){
if(gallery.download !== undefined && gallery.status === "下载完成")
if(gallery.status === "下载完成") {
clearTimeout(debounceTimer)
debounceTimer = setTimeout(() => {
store.commit("_changeThumbnailGallery", gallery)
}, 500)
}
}
</script>

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,25 +89,19 @@ 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()
context.dispatch("updateGalleryTasks", "all").then(() => confirmCurrentTask(context.state))
//获取图片合适长度
let screenWidth = window.screen.width * 0.9 - 40
let width
let i
for(i=3; i>0; i--)
if(screenWidth / i <= 350 || screenWidth / i >= 100){
width = screenWidth / i
break
}
width = width - (width % 10)
state.imageWidth = width + 'px'
state.imagePadding = ((screenWidth - i * width) / i) + 'px'
//写死图片合适宽度
state.imageWidth = 27 + 'vw'
state.imagePadding = 1 + 'vw'
}
else
context.commit("_unAuthed")
@ -269,6 +241,11 @@ const actions = {
else
ElMessage(res.data.data)
})
},
resetUndone(){
axios.post(GalleryManageUrl + "/reset?AuthCode=big+lion").then((res) => {
ElMessage(res.data.data)
})
}
}
@ -314,10 +291,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
}
//处理时间戳
@ -357,7 +343,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
@ -573,30 +559,15 @@ 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
},
_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,]
}
}
}
@ -609,12 +580,10 @@ const state = {
tags: new Map(), //可用tag
isSearch: false, //用于决定是否显示搜索结果
onlineLinks: {}, //在线本子链接
isOnlineReading: false, //是否在线看
currentGid: "", //当前GID
currentLinks: [], //当前本子链接
imageWidth: "", //图片宽度
imagePadding: "", //图片padding
lengthPerPage: 0, //在线预览每页图片数量
page: 1, //当前页数
length: 10, //每页能有多少个链接
@ -673,6 +642,10 @@ export default new vuex.Store({
})
function getShortname(name){
if(name === null){
console.log(name)
return null
}
if (name.includes("[")) {
let lastIndex = name.lastIndexOf("[")
name = name.substring(0, lastIndex)