Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea4bfcdbc | ||
|
|
dfee73b3f9 | ||
|
|
c9af72dc85 | ||
|
|
dc39e468bb | ||
|
|
3a39677bb3 | ||
|
|
abb1cdb952 |
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/asserts/favicon.ico" />
|
<link rel="icon" href="/asserts/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
|
||||||
<title>LionWebsite</title>
|
<title>LionWebsite</title>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Generated
+86
-78
@@ -10,15 +10,19 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.0.0",
|
"axios": "^1.0.0",
|
||||||
"element-plus": "^2.2.15",
|
"element-plus": "^2.2.15",
|
||||||
|
"lionwebsite-frontend-shared": "file:../lionwebsite-frontend-shared",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
"vuex": "^4.0.2"
|
"vuex": "^4.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "6.0.9",
|
"@vitejs/plugin-vue": "6.0.9",
|
||||||
"vite": "8.3.0"
|
"vite": "8.3.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../lionwebsite-frontend-shared": {
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
"node_modules/@babel/helper-string-parser": {
|
"node_modules/@babel/helper-string-parser": {
|
||||||
"version": "7.29.7",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
|
||||||
@@ -115,9 +119,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@oxc-project/types": {
|
"node_modules/@oxc-project/types": {
|
||||||
"version": "0.150.0",
|
"version": "0.155.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.150.0.tgz",
|
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz",
|
||||||
"integrity": "sha512-rDS5/31E9HfPl/CIzGrn0DOlvBbXFseQ5URJ9sYMfstbKLD/c6Gm9vmRzRGDdAXyOIL4zmO37lc9RIwYqVruZw==",
|
"integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
@@ -136,9 +140,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-android-arm-eabi": {
|
"node_modules/@rolldown/binding-android-arm-eabi": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz",
|
||||||
"integrity": "sha512-tNISae1QEf/vkb3xkRcjV5SEdzPE97We5IVaa2Z8jSszQPZ8U60B/YCYpw4QI7VidYsBtKavczXf+DyDs9WGxw==",
|
"integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -153,9 +157,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-android-arm64": {
|
"node_modules/@rolldown/binding-android-arm64": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz",
|
||||||
"integrity": "sha512-YC8YsI30o606GTZi0VyzYlsDKFP8W61i/QzayHDkLbNEz/IShqAmTa+hsJRj13xTHA0H+6fk4b2UmGn+Q/cMlg==",
|
"integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -170,9 +174,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz",
|
||||||
"integrity": "sha512-IwhlH3qK5urrY8hZiEgGkHKEFN901p/p2bjxCxJlr4GyNnF7wYpUvK+Y43uaRYuC4hpfjzbR3SJC3arX1jGvmw==",
|
"integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -187,9 +191,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-darwin-x64": {
|
"node_modules/@rolldown/binding-darwin-x64": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz",
|
||||||
"integrity": "sha512-XxpJfVzFh+jilRxIXUqcfYAYcunIc/XEzIizsOL1fcJee5Sf7H3mH8WlLmfHfluz5amqR88QQo9izKtmMlavAw==",
|
"integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -204,9 +208,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz",
|
||||||
"integrity": "sha512-kSfvhmgeWyfkbT3p/1s5vSgboogoah2zkm9fX2zjg2hHxSV7T4KhMWRUUaRk4OXNqoD3QAUeRqLcs1aZOK4U1g==",
|
"integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -221,9 +225,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz",
|
||||||
"integrity": "sha512-1RVzG17pxqbTfYLC352JlLt6kKLG+6Hr30n8DlIJqsnV5luUDd2Qdx9Ayw1Cabfyb1K9k0jXEZ7evxkRoT+uiw==",
|
"integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -238,9 +242,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz",
|
||||||
"integrity": "sha512-BXqPvZ2drqVD+/Z8UpKwcs4Mp7grM+eGFku4CAEKrEtcbAsUpzREphK1sogCRZGreVPiMkiiBtw0n3TPteuqvw==",
|
"integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -258,9 +262,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz",
|
||||||
"integrity": "sha512-11vWvo8YDwLzukt27J3aYDWU+gg2P7J+ZOmiJ0hkF5BXZDW7pVya7r40MXDy6ya0i9KamoENSVKIugvJNgFXIA==",
|
"integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -278,9 +282,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz",
|
||||||
"integrity": "sha512-a1tijMkdwsIARtc0F39ApURROkf3NwqinI6TOiSSWCTR7dT96dffNvMUtDHnq64wKNTIZOIlzKrFvvFUznJiyw==",
|
"integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
@@ -298,9 +302,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz",
|
||||||
"integrity": "sha512-x6SQNdAvv4c3hWqTMaWuawzMX9myaCs/yEmlGsxJzkdClnHW7FbrjQuSiRDhuSYzEYoEMhsaJy9qHG/XNemJPQ==",
|
"integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
@@ -318,9 +322,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz",
|
||||||
"integrity": "sha512-9s0AZ8BFK5/n7B/TBoa2yJE3gI3KURrbXcPBlsAsvjU4VeJKgE90y1YtNxyEUIcHPQkg6/yfF3qihUrcM/Kf0Q==",
|
"integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -338,9 +342,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz",
|
||||||
"integrity": "sha512-P7VWAmV+WdJluH7ovnRGoiv2i8To7GAZ+kGzfGup635cyL7SyYl3lSUaA3Gp5THf0n/Co5EyEqb2zbqq+nMOHQ==",
|
"integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -358,9 +362,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz",
|
||||||
"integrity": "sha512-1qixtsE4BK8h+yS3BfmZ09UhA7O/N4IACva6YBr7EBvCJraByTuRcgOTaiA62Tm0vey3UcKXLOaoGHtYmNGEVg==",
|
"integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -375,9 +379,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz",
|
||||||
"integrity": "sha512-ok8IQjcEPs1AKZfuEUznVBrJw+gK4soq+bx8b1X2XoMqVClarc1q5JDmVtWXY1xfr6ZuHTAsPXHTgTrqKTZeww==",
|
"integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -392,9 +396,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz",
|
||||||
"integrity": "sha512-Ip2mXoU0hM0boq3Rf+ekuT653OROSo6aSYcPT1VHE4q52KvyxgFkQgrgb/IEsxOuvQ2fZZbs8khJAyCEPM24/g==",
|
"integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -848,9 +852,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.16.0",
|
"version": "1.16.1",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.1.tgz",
|
||||||
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
|
"integrity": "sha512-FNvFGzoMLWmE6Yj9spb/zjd7yiNCHiAW9/Tg9CXrQ8wuu32HtlJOwWO11OJafl5FfY3DxTdQ0vj42zU1kvv5jg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
@@ -1281,6 +1285,10 @@
|
|||||||
"url": "https://opencollective.com/parcel"
|
"url": "https://opencollective.com/parcel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lionwebsite-frontend-shared": {
|
||||||
|
"resolved": "../lionwebsite-frontend-shared",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.18.1",
|
"version": "4.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
||||||
@@ -1461,13 +1469,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rolldown": {
|
"node_modules/rolldown": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz",
|
||||||
"integrity": "sha512-hx/Pv0N1haXRb11qkfnK5MXB/iqr7i0yjWQqmO9uHqZpBgQSqzc8UsSnEpalsh+j1I8qQ2CkXAkJC8Br3dKSlg==",
|
"integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oxc-project/types": "=0.150.0",
|
"@oxc-project/types": "=0.155.0",
|
||||||
"@rolldown/pluginutils": "^1.0.0"
|
"@rolldown/pluginutils": "^1.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1477,21 +1485,21 @@
|
|||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rolldown/binding-android-arm-eabi": "1.2.9",
|
"@rolldown/binding-android-arm-eabi": "1.2.15",
|
||||||
"@rolldown/binding-android-arm64": "1.2.9",
|
"@rolldown/binding-android-arm64": "1.2.15",
|
||||||
"@rolldown/binding-darwin-arm64": "1.2.9",
|
"@rolldown/binding-darwin-arm64": "1.2.15",
|
||||||
"@rolldown/binding-darwin-x64": "1.2.9",
|
"@rolldown/binding-darwin-x64": "1.2.15",
|
||||||
"@rolldown/binding-freebsd-x64": "1.2.9",
|
"@rolldown/binding-freebsd-x64": "1.2.15",
|
||||||
"@rolldown/binding-linux-arm-gnueabihf": "1.2.9",
|
"@rolldown/binding-linux-arm-gnueabihf": "1.2.15",
|
||||||
"@rolldown/binding-linux-arm64-gnu": "1.2.9",
|
"@rolldown/binding-linux-arm64-gnu": "1.2.15",
|
||||||
"@rolldown/binding-linux-arm64-musl": "1.2.9",
|
"@rolldown/binding-linux-arm64-musl": "1.2.15",
|
||||||
"@rolldown/binding-linux-ppc64-gnu": "1.2.9",
|
"@rolldown/binding-linux-ppc64-gnu": "1.2.15",
|
||||||
"@rolldown/binding-linux-s390x-gnu": "1.2.9",
|
"@rolldown/binding-linux-s390x-gnu": "1.2.15",
|
||||||
"@rolldown/binding-linux-x64-gnu": "1.2.9",
|
"@rolldown/binding-linux-x64-gnu": "1.2.15",
|
||||||
"@rolldown/binding-linux-x64-musl": "1.2.9",
|
"@rolldown/binding-linux-x64-musl": "1.2.15",
|
||||||
"@rolldown/binding-openharmony-arm64": "1.2.9",
|
"@rolldown/binding-openharmony-arm64": "1.2.15",
|
||||||
"@rolldown/binding-win32-arm64-msvc": "1.2.9",
|
"@rolldown/binding-win32-arm64-msvc": "1.2.15",
|
||||||
"@rolldown/binding-win32-x64-msvc": "1.2.9"
|
"@rolldown/binding-win32-x64-msvc": "1.2.15"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/side-channel": {
|
"node_modules/side-channel": {
|
||||||
@@ -1567,9 +1575,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
|
||||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@@ -1593,16 +1601,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "8.3.0",
|
"version": "8.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.3.tgz",
|
||||||
"integrity": "sha512-lhZBVvEHefgE+HQZC9O7EBJgCU/nVzFNl7vkS4RE0APtWLP02/8QVIkQtzBxPquh7lq5/78NHipTj7ODQ6XuyQ==",
|
"integrity": "sha512-cTAldKPImjg6c+gk48U19POPn3GCBzZwpdsN8ZMEEcbpes+6/wvfqUd0C2y3qYY4wsj8PwgFwrZ/1jBPVttMSg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lightningcss": "^1.33.0",
|
"lightningcss": "^1.33.0",
|
||||||
"picomatch": "^4.0.7",
|
"picomatch": "^4.0.7",
|
||||||
"postcss": "^8.5.28",
|
"postcss": "^8.5.28",
|
||||||
"rolldown": "~1.2.6",
|
"rolldown": "~1.2.11",
|
||||||
"tinyglobby": "^0.2.17"
|
"tinyglobby": "^0.2.17"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
+3
-2
@@ -14,10 +14,11 @@
|
|||||||
"element-plus": "^2.2.15",
|
"element-plus": "^2.2.15",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
"vuex": "^4.0.2"
|
"vuex": "^4.0.2",
|
||||||
|
"lionwebsite-frontend-shared": "file:../lionwebsite-frontend-shared"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "6.0.9",
|
"@vitejs/plugin-vue": "6.0.9",
|
||||||
"vite": "8.3.0"
|
"vite": "8.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+55
-26
@@ -1,42 +1,71 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, onBeforeUnmount} from "vue";
|
import {computed, onBeforeUnmount, onMounted} from "vue";
|
||||||
import store from "./store/index.js";
|
import store from "./store/index.js";
|
||||||
import Side from "./components/Side.vue";
|
import TaskView from "./components/TaskView.vue";
|
||||||
import DashBoard from "./components/DashBoard.vue";
|
import SearchView from "./components/SearchView.vue";
|
||||||
|
import SettingsView from "./components/SettingsView.vue";
|
||||||
|
import TabBar from "./components/TabBar.vue";
|
||||||
|
import AuthScreen from "./components/AuthScreen.vue";
|
||||||
|
import TaskDetailSheet from "./components/TaskDetailSheet.vue";
|
||||||
|
import OnlineReader from "./components/OnlineReader.vue";
|
||||||
|
|
||||||
|
const activeTab = computed(() => store.state.activeTab);
|
||||||
|
|
||||||
|
function isSystemDark() {
|
||||||
|
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Theme is a single class on <html>; colours come from the CSS variables.
|
||||||
|
function adjustForStyle() {
|
||||||
|
const stored = localStorage.getItem("darkConfig");
|
||||||
|
if (stored !== null) {
|
||||||
|
const darkConfig = JSON.parse(stored);
|
||||||
|
document.documentElement.classList.toggle("dark", Boolean(darkConfig.followSystem) && isSystemDark());
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove("dark");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const resumeProgress = () => {
|
const resumeProgress = () => {
|
||||||
if (store.state.isAuth && document.visibilityState === 'visible') store.dispatch("initWebsocket");
|
if (store.state.isAuth && document.visibilityState === "visible") store.dispatch("initWebsocket");
|
||||||
};
|
};
|
||||||
const pauseProgress = () => store.dispatch("disconnectWebsocket");
|
const pauseProgress = () => store.dispatch("disconnectWebsocket");
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('online', resumeProgress);
|
adjustForStyle();
|
||||||
window.addEventListener('pageshow', resumeProgress);
|
store.state.lengthPerPage = Number(localStorage.getItem("lengthPerPage")) || 30;
|
||||||
window.addEventListener('pagehide', pauseProgress);
|
store.commit("_setCategory", localStorage.getItem("category") ?? "myDownload");
|
||||||
document.addEventListener('visibilitychange', resumeProgress);
|
store.commit("_setSortType", localStorage.getItem("sortType") ?? "createTime");
|
||||||
});
|
store.commit("_setGalleryNameType", localStorage.getItem("galleryNameType") ?? "shortName");
|
||||||
onBeforeUnmount(() => {
|
|
||||||
window.removeEventListener('online', resumeProgress);
|
const auth = localStorage.getItem("auth");
|
||||||
window.removeEventListener('pageshow', resumeProgress);
|
if (auth !== null) store.dispatch("validate", auth);
|
||||||
window.removeEventListener('pagehide', pauseProgress);
|
|
||||||
document.removeEventListener('visibilitychange', resumeProgress);
|
window.addEventListener("online", resumeProgress);
|
||||||
pauseProgress();
|
window.addEventListener("pageshow", resumeProgress);
|
||||||
|
window.addEventListener("pagehide", pauseProgress);
|
||||||
|
document.addEventListener("visibilitychange", resumeProgress);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener("online", resumeProgress);
|
||||||
|
window.removeEventListener("pageshow", resumeProgress);
|
||||||
|
window.removeEventListener("pagehide", pauseProgress);
|
||||||
|
document.removeEventListener("visibilitychange", resumeProgress);
|
||||||
|
pauseProgress();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<el-container>
|
<main class="app-views">
|
||||||
<DashBoard/>
|
<TaskView v-show="activeTab === 'tasks'"/>
|
||||||
<main>
|
<SearchView v-show="activeTab === 'search'"/>
|
||||||
<Side/>
|
<SettingsView v-show="activeTab === 'settings'"/>
|
||||||
</main>
|
</main>
|
||||||
</el-container>
|
<TabBar/>
|
||||||
|
<TaskDetailSheet/>
|
||||||
|
<OnlineReader/>
|
||||||
|
<AuthScreen/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
.app{
|
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<script setup>
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
|
||||||
|
const AuthCode = ref("");
|
||||||
|
const isRemember = ref(false);
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
if (AuthCode.value.trim() === "") {
|
||||||
|
ElMessage("请输入授权码后再验证");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.dispatch("validate", AuthCode.value);
|
||||||
|
if (isRemember.value) localStorage.setItem("auth", AuthCode.value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="auth-screen" v-show="!store.state.loadComplete">
|
||||||
|
<div class="auth-card">
|
||||||
|
<div class="auth-brand">
|
||||||
|
<span class="auth-mark" aria-hidden="true">L</span>
|
||||||
|
<span class="auth-name">LionWebsite</span>
|
||||||
|
</div>
|
||||||
|
<h1>下载管理器</h1>
|
||||||
|
<p class="auth-subtitle">输入授权码以继续</p>
|
||||||
|
<div class="auth-form">
|
||||||
|
<el-input v-model="AuthCode"
|
||||||
|
placeholder="请输入授权码"
|
||||||
|
size="large"
|
||||||
|
show-password
|
||||||
|
@keydown.enter="validate"/>
|
||||||
|
<el-checkbox v-model="isRemember">记住授权码</el-checkbox>
|
||||||
|
<el-button @click="validate" type="primary" size="large">验证</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,384 +0,0 @@
|
|||||||
<template>
|
|
||||||
<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-input style="width: 200px;" v-model="param">
|
|
||||||
<template #prepend>
|
|
||||||
链接:
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
<el-button @click="queryRemoteTask" v-show="type === 'link'">解析链接</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<hr>
|
|
||||||
<el-button @click="isQuerying = true">在线搜索</el-button>
|
|
||||||
<el-button @click="reconnect">重连节点</el-button>
|
|
||||||
<el-button @click="isAlterAuthCode = true">修改授权码</el-button>
|
|
||||||
<el-button @click="deleteAuthCode">删除本地授权码</el-button>
|
|
||||||
<el-button @click="isConfig = true">配置</el-button><br>
|
|
||||||
<span style="display: inline">夜间模式</span>
|
|
||||||
<el-switch @click="toggleStyle" v-model="isDark">夜间模式</el-switch>
|
|
||||||
<br>
|
|
||||||
<el-button v-if="isLion" @click="resetUndone">重置任务</el-button>
|
|
||||||
</el-drawer>
|
|
||||||
|
|
||||||
<el-dialog title="查询" v-model="chosenGallery" width="100%">
|
|
||||||
<el-image v-show='chosenGallery.thumb_link !== undefined' style="float: right; width: 250px; height: 250px" fit="contain"
|
|
||||||
:src="chosenGallery.thumb_link !== undefined ? thumbnailUrl(chosenGallery.thumb_link) : ''"/>
|
|
||||||
<table>
|
|
||||||
<tr>名字:{{chosenGallery.name}}</tr>
|
|
||||||
<tr>页数:{{chosenGallery.pages}}</tr>
|
|
||||||
<tr>语言:{{chosenGallery.language}}</tr>
|
|
||||||
<tr>大小:{{chosenGallery.fileSize}}</tr>
|
|
||||||
<tr>状态:{{chosenGallery.status}}</tr>
|
|
||||||
<tr v-if="chosenGallery.availableResolution">
|
|
||||||
目标分辨率:<el-select v-model="targetResolution">
|
|
||||||
<el-option v-for="(fileSize, resolution) in chosenGallery.availableResolution" :value="resolution"
|
|
||||||
:label="resolution + ' ' + fileSize">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
|
|
||||||
<el-button @click="downloadChosenGallery" v-else-if="chosenGallery.status === '下载完成'">下载文件</el-button>
|
|
||||||
<el-button @click="onlineGalleryReader(chosenGallery)">在线预览</el-button>
|
|
||||||
<el-button v-if="chosenGallery.status === '下载完成'" @click="deleteGallery">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<HentaiSearch :is-querying="isQuerying" @close="isQuerying = false"></HentaiSearch>
|
|
||||||
|
|
||||||
<el-dialog title="修改授权码" v-model="isAlterAuthCode" width="100%">
|
|
||||||
<el-form>
|
|
||||||
<el-form-item>
|
|
||||||
<template #label>当前授权码</template>
|
|
||||||
<template #default>{{realAuthCode}}</template>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<template #label>新的授权码</template>
|
|
||||||
<template #default>
|
|
||||||
<el-input v-model="newAuthCode"></el-input>
|
|
||||||
</template>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<template #label>再次输入授权码</template>
|
|
||||||
<template #default>
|
|
||||||
<el-input v-model="tempAuthCode"></el-input>
|
|
||||||
</template>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-footer>
|
|
||||||
<el-button @click="alterAuthCode">提交</el-button>
|
|
||||||
</el-footer>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<el-dialog title="配置" v-model="isConfig" width="100%">
|
|
||||||
<div>
|
|
||||||
夜间模式<br>
|
|
||||||
<span style="display: inline-block">夜间模式跟随系统</span>
|
|
||||||
<el-switch v-model="darkConfig.followSystem"></el-switch><hr>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
在线预览<br>
|
|
||||||
<span style="display: inline-block">在线预览分页页数:</span>
|
|
||||||
<input v-model="lengthPerPage"><hr>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
默认设置<br>
|
|
||||||
<span style="display: inline-block">分类:</span>
|
|
||||||
<el-select v-model="category" default-first-option>
|
|
||||||
<el-option label="全部" value="total"/>
|
|
||||||
<el-option label="我的下载" value="myDownload"/>
|
|
||||||
<el-option label="我的收藏" value="myCollect"/>
|
|
||||||
</el-select> <br>
|
|
||||||
<span style="display: inline-block">排序方式:</span>
|
|
||||||
<el-select v-model="sortType" default-first-option>
|
|
||||||
<el-option label="名字" value="name"/>
|
|
||||||
<el-option label="简洁名字" value="shortName"/>
|
|
||||||
<el-option label="任务创建时间" value="createTime"/>
|
|
||||||
</el-select> <br>
|
|
||||||
<span style="display: inline-block">显示类型:</span>
|
|
||||||
<el-select v-model="galleryNameType" default-first-option>
|
|
||||||
<el-option label="名字" value="name"/>
|
|
||||||
<el-option label="简洁名字" value="shortName"/>
|
|
||||||
</el-select> <br>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<el-button type="primary" @click="saveConfig">保存</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<div class="DashBoard" v-show="!loadComplete">
|
|
||||||
<div class="validate">
|
|
||||||
<el-input v-model="AuthCode" placeholder="请输入授权码" />
|
|
||||||
<el-checkbox v-model="isRemember" >是否记住授权码</el-checkbox><br>
|
|
||||||
<el-button @click="validate" type="primary" @keydown.enter="validate">验证</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import store from "../store";
|
|
||||||
import {computed, ref, onMounted, watch} from "vue";
|
|
||||||
import {ElMessage} from "element-plus"
|
|
||||||
import HentaiSearch from "./HentaiSearch.vue";
|
|
||||||
import {validateLink} from "../utils/validate.js";
|
|
||||||
|
|
||||||
//授权码相关
|
|
||||||
let AuthCode = ref("")
|
|
||||||
let isRemember = ref(false)
|
|
||||||
let isAlterAuthCode = ref(false)
|
|
||||||
let newAuthCode = ref("")
|
|
||||||
let tempAuthCode = ref("")
|
|
||||||
|
|
||||||
let isQuerying = ref(false)
|
|
||||||
let isConfig = ref(false)
|
|
||||||
let isDark = ref(false)
|
|
||||||
let keyword = ref("furry yaoi")
|
|
||||||
let darkConfig = ref({})
|
|
||||||
let lengthPerPage = ref(0)
|
|
||||||
let category = ref("")
|
|
||||||
let sortType = ref("")
|
|
||||||
let galleryNameType = ref("")
|
|
||||||
|
|
||||||
//查询相关
|
|
||||||
let type = ref("link")
|
|
||||||
let param = ref("")
|
|
||||||
|
|
||||||
let targetResolution = ref("")
|
|
||||||
|
|
||||||
let realAuthCode = computed(() => {
|
|
||||||
return store.state.AuthCode
|
|
||||||
})
|
|
||||||
|
|
||||||
let chosenGallery = computed(() => {
|
|
||||||
return store.state.chosenGallery
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(chosenGallery, () => {
|
|
||||||
param.value = ''
|
|
||||||
targetResolution.value = ''
|
|
||||||
})
|
|
||||||
|
|
||||||
let loadComplete = computed(() => {
|
|
||||||
return store.state.loadComplete
|
|
||||||
})
|
|
||||||
|
|
||||||
let weekUsed = computed(() => {
|
|
||||||
return store.state.weekUsed
|
|
||||||
})
|
|
||||||
|
|
||||||
let thumbnailGallery = computed(() => {
|
|
||||||
return store.state.thumbnailGallery
|
|
||||||
})
|
|
||||||
|
|
||||||
let isLion = computed(() => {
|
|
||||||
return store.state.userId === 3
|
|
||||||
})
|
|
||||||
|
|
||||||
//重连节点
|
|
||||||
function reconnect(){
|
|
||||||
store.dispatch("reconnect")
|
|
||||||
}
|
|
||||||
|
|
||||||
//修改授权码
|
|
||||||
function alterAuthCode(){
|
|
||||||
if(newAuthCode.value.trim() === "" || tempAuthCode.value.trim() === "" || newAuthCode.value !== tempAuthCode.value)
|
|
||||||
ElMessage("请检查授权码输入是否错误")
|
|
||||||
else {
|
|
||||||
store.dispatch("alterAuthCode", newAuthCode.value)
|
|
||||||
isAlterAuthCode.value = false
|
|
||||||
newAuthCode.value = ""
|
|
||||||
tempAuthCode.value = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询用量
|
|
||||||
function queryWeekUsedAmount(){
|
|
||||||
store.dispatch("loadWeekUsedAmount")
|
|
||||||
}
|
|
||||||
|
|
||||||
function postTask(){
|
|
||||||
if(!validateLink(chosenGallery.value.link)){
|
|
||||||
ElMessage("链接错误")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(targetResolution.value === ''){
|
|
||||||
ElMessage("请选择分辨率再提交")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
store.dispatch("postGalleryTask",
|
|
||||||
{link: chosenGallery.value.link,
|
|
||||||
targetResolution: targetResolution.value})
|
|
||||||
targetResolution.value = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询任务
|
|
||||||
function queryRemoteTask(){
|
|
||||||
if(!validateLink(param.value)){
|
|
||||||
ElMessage("链接错误")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(param.value.includes("e-hentai"))
|
|
||||||
param.value = param.value.replace("e-hentai", "exhentai")
|
|
||||||
store.dispatch("queryGalleryTask", param.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除任务
|
|
||||||
function deleteGallery(){
|
|
||||||
store.dispatch("deleteGallery", chosenGallery.value.gid)
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadChosenGallery(){
|
|
||||||
if(chosenGallery.value.download)
|
|
||||||
window.open(chosenGallery.value.download)
|
|
||||||
else
|
|
||||||
ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"})
|
|
||||||
}
|
|
||||||
|
|
||||||
//验证授权码
|
|
||||||
function validate(){
|
|
||||||
if(AuthCode.value.trim() === ""){
|
|
||||||
ElMessage("请输入授权码后再验证")
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
store.dispatch("validate", AuthCode.value)
|
|
||||||
if(isRemember.value)
|
|
||||||
localStorage.setItem("auth", AuthCode.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//打开面板以及在线阅读
|
|
||||||
function onlineGalleryReader(gallery){
|
|
||||||
store.dispatch("readOnlineGallery", gallery)
|
|
||||||
}
|
|
||||||
|
|
||||||
function thumbnailUrl(path) {
|
|
||||||
return "https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?" + new URLSearchParams({
|
|
||||||
path,
|
|
||||||
AuthCode: store.state.AuthCode
|
|
||||||
}).toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
//重新给节点发送未完成任务
|
|
||||||
function resetUndone(){
|
|
||||||
store.dispatch("resetUndone").then()
|
|
||||||
}
|
|
||||||
function deleteAuthCode(){
|
|
||||||
localStorage.removeItem('auth')
|
|
||||||
ElMessage("删除授权码完成")
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleStyle(){
|
|
||||||
if(isDark.value)
|
|
||||||
dark()
|
|
||||||
else
|
|
||||||
light()
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
category.value = store.state.category = localStorage.getItem("category") === null ? "myDownload" : localStorage.getItem("category")
|
|
||||||
sortType.value = store.state.sortType = localStorage.getItem("sortType") === null ? "createTime" : localStorage.getItem("sortType")
|
|
||||||
galleryNameType.value = store.state.galleryNameType = localStorage.getItem("galleryNameType") === null ? "shortName" : localStorage.getItem("galleryNameType")
|
|
||||||
lengthPerPage.value = store.state.lengthPerPage
|
|
||||||
|
|
||||||
if(auth !== null){
|
|
||||||
store.dispatch("validate", auth)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
function adjustForStyle(){
|
|
||||||
let darkConfigStr = localStorage.getItem("darkConfig")
|
|
||||||
if(darkConfigStr !== null) {
|
|
||||||
darkConfig.value = JSON.parse(darkConfigStr)
|
|
||||||
if (darkConfig.value.followSystem && isSystemDark())
|
|
||||||
dark()
|
|
||||||
else
|
|
||||||
light()
|
|
||||||
}else {
|
|
||||||
light()
|
|
||||||
darkConfig.value = {'followSystem': false}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function isSystemDark(){
|
|
||||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
||||||
}
|
|
||||||
function dark(){
|
|
||||||
isDark.value = true
|
|
||||||
let html = document.querySelector("html")
|
|
||||||
if(!html.classList.contains("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(){
|
|
||||||
isDark.value = false
|
|
||||||
let html = document.querySelector("html")
|
|
||||||
if(html.classList.contains("dark"))
|
|
||||||
html.classList.remove('dark')
|
|
||||||
|
|
||||||
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(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))
|
|
||||||
localStorage.setItem("category", category.value)
|
|
||||||
localStorage.setItem("sortType", sortType.value)
|
|
||||||
localStorage.setItem("galleryNameType", galleryNameType.value)
|
|
||||||
|
|
||||||
store.commit("_setCategory", category.value)
|
|
||||||
store.commit("_setSortType", sortType.value)
|
|
||||||
store.commit("_setGalleryNameType", galleryNameType.value)
|
|
||||||
|
|
||||||
isConfig.value = false
|
|
||||||
adjustForStyle()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.DashBoard{
|
|
||||||
width: auto;
|
|
||||||
height: 90vh;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.validate{
|
|
||||||
width: 50vw;
|
|
||||||
display: block;
|
|
||||||
padding-top: 200px;
|
|
||||||
padding-left: 20vw;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.el-input{
|
|
||||||
width: 25vw;
|
|
||||||
}
|
|
||||||
.el-dialogClass .el-dialog__body{
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
|
|
||||||
import {ref, watch} from "vue";
|
|
||||||
import axios from "axios";
|
|
||||||
import {ElMessage} from "element-plus";
|
|
||||||
import store from "../store/index.js";
|
|
||||||
import {validateLink} from "../utils/validate.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()
|
|
||||||
let isLoading = ref(false)
|
|
||||||
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(" ", "+")
|
|
||||||
isLoading.value = true
|
|
||||||
|
|
||||||
axios.get("https://downloader.lionwebsite.xyz/query?keyword=" + tempParam)
|
|
||||||
.then((res) => {
|
|
||||||
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"})
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
isLoading.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function queryRemoteTask(){
|
|
||||||
if(!validateLink(param.value)){
|
|
||||||
ElMessage("链接错误")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
store.dispatch("queryGalleryTask", param.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function close(){
|
|
||||||
emit("close")
|
|
||||||
}
|
|
||||||
|
|
||||||
function thumbnailUrl(path) {
|
|
||||||
return "https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?" + new URLSearchParams({
|
|
||||||
path,
|
|
||||||
AuthCode: store.state.AuthCode
|
|
||||||
}).toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
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" 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 class="loading" v-show="isLoading"/>
|
|
||||||
</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="[thumbnailUrl(gallery.thumbnailUrl)]"
|
|
||||||
:src="thumbnailUrl(gallery.thumbnailUrl)"
|
|
||||||
style="height:20vh;width:35vw;float: left;"
|
|
||||||
fit="contain"
|
|
||||||
loading="lazy"
|
|
||||||
/>
|
|
||||||
<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>
|
|
||||||
<a :href="gallery.link">链接</a><br>
|
|
||||||
<el-button-group style=" margin-left: 50%; margin-top: -5vh">
|
|
||||||
<el-button @click="store.dispatch('readOnlineGallery', gallery)">在线看</el-button>
|
|
||||||
<el-button @click="param=gallery.link; queryRemoteTask()">查看详情</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
</div>
|
|
||||||
</div><br>
|
|
||||||
</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>
|
|
||||||
</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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-dialogClass .el-dialog__body{
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {computed, ref, watch, onBeforeUnmount} from "vue";
|
import {computed, ref, watch, onBeforeUnmount} from "vue";
|
||||||
import {startImages, settleImage, retryImage} from "../utils/progressiveImages.js";
|
import {startImages, settleImage, retryImage} from "lionwebsite-frontend-shared";
|
||||||
import store from "../store/index.js";
|
import store from "../store/index.js";
|
||||||
let onlineReadingScrollbar = ref()
|
let onlineReadingScrollbar = ref()
|
||||||
let links = ref()
|
let links = ref()
|
||||||
|
|||||||
@@ -0,0 +1,191 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, ref} from "vue";
|
||||||
|
import axios from "axios";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
import TaskRow from "./TaskRow.vue";
|
||||||
|
import {fetchGalleries, validateLink} from "lionwebsite-frontend-shared";
|
||||||
|
import {ehThumbnailUrl} from "lionwebsite-frontend-shared";
|
||||||
|
|
||||||
|
const mode = ref("local");
|
||||||
|
const localMode = ref("keyword");
|
||||||
|
const localKeyword = ref("");
|
||||||
|
const linkParam = ref("");
|
||||||
|
|
||||||
|
const remoteKeyword = ref("");
|
||||||
|
const remoteGalleries = ref([]);
|
||||||
|
const remotePage = ref({});
|
||||||
|
const remoteLoading = ref(false);
|
||||||
|
const retryingGids = ref(new Set());
|
||||||
|
|
||||||
|
const searchResults = computed(() => store.getters.searchResults);
|
||||||
|
const searchTotal = computed(() => store.state.searchTask.length);
|
||||||
|
const searchRemaining = computed(() =>
|
||||||
|
Math.max(0, searchTotal.value - store.state.visiblePages * store.state.length));
|
||||||
|
|
||||||
|
function runLocalSearch() {
|
||||||
|
if (localKeyword.value.trim() === "") {
|
||||||
|
ElMessage("请输入查询内容");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (localMode.value === "link") store.commit("_searchLocalByLink", localKeyword.value);
|
||||||
|
else store.commit("_searchLocalByKeyword", localKeyword.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearLocalSearch() {
|
||||||
|
store.commit("_searchLocalByKeyword", "");
|
||||||
|
localKeyword.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function openTask(gallery) {
|
||||||
|
store.commit("_setDetailGallery", gallery);
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadTask(gallery) {
|
||||||
|
if (gallery.download) window.open(gallery.download);
|
||||||
|
else ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retryGallery(gallery) {
|
||||||
|
if (retryingGids.value.has(gallery.gid)) return;
|
||||||
|
retryingGids.value.add(gallery.gid);
|
||||||
|
try {
|
||||||
|
await store.dispatch("retryGallery", gallery.gid);
|
||||||
|
} finally {
|
||||||
|
retryingGids.value.delete(gallery.gid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// direction 为 "next"/"prev" 时使用后端返回的翻页游标;href 为空表示新关键词。
|
||||||
|
function queryGalleries(href, direction = null) {
|
||||||
|
if (href == null && remoteKeyword.value.trim() === "") {
|
||||||
|
ElMessage("请输入搜索关键词")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
remoteLoading.value = true
|
||||||
|
fetchGalleries(axios, {keyword: remoteKeyword.value, direction, href: href || ""})
|
||||||
|
.then(({galleries, pagination}) => {
|
||||||
|
remotePage.value = pagination
|
||||||
|
remoteGalleries.value.splice(0, remoteGalleries.value.length, ...galleries)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
ElMessage({message: error.payload || error.message || "搜索失败", type: "error"})
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
remoteLoading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function remoteThumbnail(path) {
|
||||||
|
return ehThumbnailUrl(path, store.state.AuthCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hand the remote gallery to the shared sheet so the resolution can be picked.
|
||||||
|
function submitRemote(gallery) {
|
||||||
|
store.dispatch("queryGalleryTask", gallery.link);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preview a remote gallery without submitting it first.
|
||||||
|
function previewRemote(gallery) {
|
||||||
|
store.dispatch("readOnlineGallery", gallery);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseLink() {
|
||||||
|
let link = linkParam.value;
|
||||||
|
if (!validateLink(link)) {
|
||||||
|
ElMessage("链接错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (link.includes("e-hentai")) link = link.replace("e-hentai", "exhentai");
|
||||||
|
store.dispatch("queryGalleryTask", link);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="view">
|
||||||
|
<header class="app-bar">
|
||||||
|
<h1>搜索</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="segmented" role="group" aria-label="搜索来源">
|
||||||
|
<button type="button" :aria-pressed="mode === 'local'" @click="mode = 'local'">本地</button>
|
||||||
|
<button type="button" :aria-pressed="mode === 'ehentai'" @click="mode = 'ehentai'">E站搜索</button>
|
||||||
|
<button type="button" :aria-pressed="mode === 'link'" @click="mode = 'link'">解析链接</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-scroll" v-show="mode === 'local'">
|
||||||
|
<div class="segmented is-sub" role="group" aria-label="本地查询方式">
|
||||||
|
<button type="button" :aria-pressed="localMode === 'keyword'" @click="localMode = 'keyword'">关键字</button>
|
||||||
|
<button type="button" :aria-pressed="localMode === 'link'" @click="localMode = 'link'">链接</button>
|
||||||
|
</div>
|
||||||
|
<div class="search-bar">
|
||||||
|
<input v-model="localKeyword"
|
||||||
|
type="search"
|
||||||
|
:placeholder="localMode === 'keyword' ? '在我的下载里搜索' : '粘贴已下载任务的链接'"
|
||||||
|
@keydown.enter="runLocalSearch">
|
||||||
|
<button type="button" @click="runLocalSearch">搜索</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="store.state.isSearch">
|
||||||
|
<p class="hint">
|
||||||
|
匹配到 {{ searchTotal }} 项
|
||||||
|
<button type="button" class="hint-action" @click="clearLocalSearch">清除</button>
|
||||||
|
</p>
|
||||||
|
<TaskRow v-for="gallery in searchResults"
|
||||||
|
:key="gallery.gid"
|
||||||
|
:gallery="gallery"
|
||||||
|
:retrying="retryingGids.has(gallery.gid)"
|
||||||
|
@open="openTask"
|
||||||
|
@download="downloadTask"
|
||||||
|
@retry="retryGallery"/>
|
||||||
|
<button v-if="searchRemaining > 0" type="button" class="load-more"
|
||||||
|
@click="store.commit('_showMoreTasks')">
|
||||||
|
继续加载(还有 {{ searchRemaining }} 项)
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<p v-else class="empty-state">没有匹配的任务</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-scroll" v-show="mode === 'ehentai'">
|
||||||
|
<div class="search-bar">
|
||||||
|
<input v-model="remoteKeyword" type="search" placeholder="在 E站搜索画廊" @keydown.enter="queryGalleries(null)">
|
||||||
|
<button type="button" :disabled="remoteLoading" @click="queryGalleries(null)">
|
||||||
|
{{ remoteLoading ? "搜索中" : "搜索" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="hint" v-if="remoteGalleries.length">本页 {{ remoteGalleries.length }} 个结果</p>
|
||||||
|
|
||||||
|
<div class="remote-row" v-for="gallery in remoteGalleries" :key="gallery.link">
|
||||||
|
<button type="button" class="task-row-open" @click="submitRemote(gallery)">
|
||||||
|
<span class="task-thumb">
|
||||||
|
<img :src="remoteThumbnail(gallery.thumbnailUrl)" alt="" loading="lazy">
|
||||||
|
</span>
|
||||||
|
<span class="task-body">
|
||||||
|
<span class="task-title">{{ gallery.name }}</span>
|
||||||
|
<span class="task-meta">{{ gallery.page }} 页 · {{ gallery.type }} · {{ (gallery.uploadTime || "").split(" ")[0] }}</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="task-side task-side-muted" aria-label="在线看" @click="previewRemote(gallery)">在线看</button>
|
||||||
|
<button type="button" class="task-side task-side-act" aria-label="提交下载" @click="submitRemote(gallery)">提交</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="!remoteGalleries.length && !remoteLoading" class="empty-state">没有搜索结果</p>
|
||||||
|
|
||||||
|
<div class="pager-row" v-if="remoteGalleries.length">
|
||||||
|
<button type="button" :disabled="remotePage.first === undefined" @click="queryGalleries(remotePage.first)">首页</button>
|
||||||
|
<button type="button" :disabled="remotePage.previous === undefined" @click="queryGalleries(remotePage.previous, 'prev')">上一页</button>
|
||||||
|
<button type="button" :disabled="remotePage.next === undefined" @click="queryGalleries(remotePage.next, 'next')">下一页</button>
|
||||||
|
<button type="button" :disabled="remotePage.last === undefined" @click="queryGalleries(remotePage.last)">尾页</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-scroll" v-show="mode === 'link'">
|
||||||
|
<div class="search-bar">
|
||||||
|
<input v-model="linkParam" type="search" placeholder="粘贴 e-hentai 画廊链接" @keydown.enter="parseLink">
|
||||||
|
<button type="button" @click="parseLink">解析</button>
|
||||||
|
</div>
|
||||||
|
<p class="hint">解析成功后可直接选分辨率提交下载</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, onMounted, ref} from "vue";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
|
||||||
|
const isAlterAuthCode = ref(false);
|
||||||
|
const newAuthCode = ref("");
|
||||||
|
const tempAuthCode = ref("");
|
||||||
|
const isConfig = ref(false);
|
||||||
|
const isDark = ref(false);
|
||||||
|
const darkConfig = ref({followSystem: false});
|
||||||
|
const lengthPerPage = ref(30);
|
||||||
|
const category = ref("myDownload");
|
||||||
|
const sortType = ref("createTime");
|
||||||
|
const galleryNameType = ref("shortName");
|
||||||
|
|
||||||
|
const realAuthCode = computed(() => store.state.AuthCode);
|
||||||
|
const weekUsed = computed(() => store.state.weekUsed);
|
||||||
|
const isAdmin = computed(() => store.state.isAdmin);
|
||||||
|
|
||||||
|
const connectionText = computed(() => ({
|
||||||
|
connected: "已连接",
|
||||||
|
connecting: "连接中",
|
||||||
|
reconnecting: "重连中",
|
||||||
|
disconnected: "已断开",
|
||||||
|
})[store.state.connectionStatus]);
|
||||||
|
|
||||||
|
function isSystemDark() {
|
||||||
|
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyTheme(dark) {
|
||||||
|
document.documentElement.classList.toggle("dark", dark);
|
||||||
|
isDark.value = dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleDark(value) {
|
||||||
|
darkConfig.value.followSystem = false;
|
||||||
|
applyTheme(value);
|
||||||
|
localStorage.setItem("darkConfig", JSON.stringify(darkConfig.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleFollowSystem(value) {
|
||||||
|
darkConfig.value.followSystem = value;
|
||||||
|
applyTheme(value && isSystemDark());
|
||||||
|
localStorage.setItem("darkConfig", JSON.stringify(darkConfig.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
function alterAuthCode() {
|
||||||
|
if (newAuthCode.value.trim() === "" || tempAuthCode.value.trim() === "" || newAuthCode.value !== tempAuthCode.value)
|
||||||
|
ElMessage("请检查授权码输入是否错误");
|
||||||
|
else {
|
||||||
|
store.dispatch("alterAuthCode", newAuthCode.value);
|
||||||
|
isAlterAuthCode.value = false;
|
||||||
|
newAuthCode.value = "";
|
||||||
|
tempAuthCode.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteAuthCode() {
|
||||||
|
localStorage.removeItem("auth");
|
||||||
|
ElMessage("删除授权码完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveConfig() {
|
||||||
|
const length = Number(lengthPerPage.value);
|
||||||
|
if (!Number.isFinite(length) || length < 1 || length > 30) {
|
||||||
|
ElMessage("分页页数设置错误,范围1~30");
|
||||||
|
lengthPerPage.value = 30;
|
||||||
|
} else {
|
||||||
|
store.state.lengthPerPage = length;
|
||||||
|
localStorage.setItem("lengthPerPage", String(length));
|
||||||
|
}
|
||||||
|
localStorage.setItem("darkConfig", JSON.stringify(darkConfig.value));
|
||||||
|
localStorage.setItem("category", category.value);
|
||||||
|
localStorage.setItem("sortType", sortType.value);
|
||||||
|
localStorage.setItem("galleryNameType", galleryNameType.value);
|
||||||
|
|
||||||
|
store.commit("_setCategory", category.value);
|
||||||
|
store.commit("_setSortType", sortType.value);
|
||||||
|
store.commit("_setGalleryNameType", galleryNameType.value);
|
||||||
|
|
||||||
|
isConfig.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const stored = localStorage.getItem("darkConfig");
|
||||||
|
darkConfig.value = stored === null ? {followSystem: false} : JSON.parse(stored);
|
||||||
|
isDark.value = document.documentElement.classList.contains("dark");
|
||||||
|
lengthPerPage.value = store.state.lengthPerPage || 30;
|
||||||
|
category.value = store.state.category;
|
||||||
|
sortType.value = store.state.sortType;
|
||||||
|
galleryNameType.value = store.state.galleryNameType;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="view">
|
||||||
|
<header class="app-bar">
|
||||||
|
<h1>设置</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="list-scroll settings-scroll">
|
||||||
|
<p class="group-label">本周用量</p>
|
||||||
|
<section class="group">
|
||||||
|
<div class="setting-row">
|
||||||
|
<span class="setting-label">已用流量</span>
|
||||||
|
<span class="usage-value">
|
||||||
|
<strong>{{ weekUsed.weekUsedAmount ?? "—" }}</strong>
|
||||||
|
<small>上次重置 {{ weekUsed.lastResetAmountTime ?? "—" }}</small>
|
||||||
|
</span>
|
||||||
|
<button type="button" class="mini-button" @click="store.dispatch('loadWeekUsedAmount')">刷新</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="group-label">节点</p>
|
||||||
|
<section class="group">
|
||||||
|
<div class="setting-row">
|
||||||
|
<span class="setting-label">进度连接</span>
|
||||||
|
<span class="connection" :class="{'is-connected': store.state.connectionStatus === 'connected'}">
|
||||||
|
<i class="connection-dot"></i>{{ connectionText }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="setting-row is-button" @click="store.dispatch('reconnect')">
|
||||||
|
<span class="setting-label">重连节点</span>
|
||||||
|
<span class="chevron">›</span>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="group-label">账户</p>
|
||||||
|
<section class="group">
|
||||||
|
<button type="button" class="setting-row is-button" @click="isAlterAuthCode = true">
|
||||||
|
<span class="setting-label">修改授权码</span>
|
||||||
|
<span class="chevron">›</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="setting-row is-button" @click="deleteAuthCode">
|
||||||
|
<span class="setting-label">删除本地授权码</span>
|
||||||
|
<span class="chevron">›</span>
|
||||||
|
</button>
|
||||||
|
<button v-if="isAdmin" type="button" class="setting-row is-button is-danger"
|
||||||
|
@click="store.dispatch('resetUndone')">
|
||||||
|
<span class="setting-label">重置未完成任务</span>
|
||||||
|
<span class="chevron">›</span>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="group-label">外观</p>
|
||||||
|
<section class="group">
|
||||||
|
<div class="setting-row">
|
||||||
|
<span class="setting-label">夜间模式</span>
|
||||||
|
<el-switch v-model="isDark" @change="toggleDark"/>
|
||||||
|
</div>
|
||||||
|
<div class="setting-row">
|
||||||
|
<span class="setting-label">跟随系统</span>
|
||||||
|
<el-switch v-model="darkConfig.followSystem" @change="toggleFollowSystem"/>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="setting-row is-button" @click="isConfig = true">
|
||||||
|
<span class="setting-label">默认设置</span>
|
||||||
|
<span class="setting-value">{{ category === "myDownload" ? "我的下载" : category === "myCollect" ? "我的收藏" : "全部" }}</span>
|
||||||
|
<span class="chevron">›</span>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog title="修改授权码" v-model="isAlterAuthCode" width="100%">
|
||||||
|
<el-form label-position="top">
|
||||||
|
<el-form-item label="当前授权码">
|
||||||
|
<span class="mono-value">{{ realAuthCode }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新的授权码">
|
||||||
|
<el-input v-model="newAuthCode" show-password></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="再次输入授权码">
|
||||||
|
<el-input v-model="tempAuthCode" show-password></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="isAlterAuthCode = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="alterAuthCode">提交</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="默认设置" v-model="isConfig" width="100%">
|
||||||
|
<el-form label-position="top" class="config-form">
|
||||||
|
<h4 class="section-title">在线预览</h4>
|
||||||
|
<el-form-item label="每页图片数量">
|
||||||
|
<el-input-number v-model="lengthPerPage" :min="1" :max="30" :step="1" style="width: 100%"/>
|
||||||
|
<span class="field-hint">1 – 30</span>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<h4 class="section-title">列表默认值</h4>
|
||||||
|
<el-form-item label="分类">
|
||||||
|
<el-select v-model="category" default-first-option style="width: 100%">
|
||||||
|
<el-option label="全部" value="total"/>
|
||||||
|
<el-option label="我的下载" value="myDownload"/>
|
||||||
|
<el-option label="我的收藏" value="myCollect"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序方式">
|
||||||
|
<el-select v-model="sortType" default-first-option style="width: 100%">
|
||||||
|
<el-option label="名字" value="name"/>
|
||||||
|
<el-option label="简洁名字" value="shortName"/>
|
||||||
|
<el-option label="任务创建时间" value="createTime"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示类型">
|
||||||
|
<el-select v-model="galleryNameType" default-first-option style="width: 100%">
|
||||||
|
<el-option label="名字" value="name"/>
|
||||||
|
<el-option label="简洁名字" value="shortName"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button type="primary" @click="saveConfig">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="side">
|
|
||||||
<div v-show="loadComplete" class="load_complete">
|
|
||||||
<el-tag :type="store.state.connectionStatus === 'connected' ? 'success' : 'warning'" role="status">
|
|
||||||
{{ {connected: '进度已连接', connecting: '正在连接进度', reconnecting: '连接中断,正在重连', disconnected: '进度连接已断开'}[store.state.connectionStatus] }}
|
|
||||||
</el-tag>
|
|
||||||
<el-scrollbar max-height="80vh">
|
|
||||||
<div v-if="currentTasks.length === 0">
|
|
||||||
{{emptyText}}
|
|
||||||
</div>
|
|
||||||
<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="gallery.thumb_link"
|
|
||||||
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>
|
|
||||||
</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="link" label="链接"/>
|
|
||||||
<el-option value="keyword" label="关键字"/>
|
|
||||||
</el-select>
|
|
||||||
<el-input style="width: 60vw" v-model="param" placeholder="搜索">
|
|
||||||
<template #append>
|
|
||||||
<el-button @click="queryLocalTask">搜索</el-button>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-row class="pageChanger">
|
|
||||||
<el-col v-if="username !== 'test'">
|
|
||||||
<el-select v-model="category" @change="changeCategory">
|
|
||||||
<template #prefix>
|
|
||||||
分类
|
|
||||||
</template>
|
|
||||||
<el-option value="myCollect" label="我的收藏"/>
|
|
||||||
<el-option value="myDownload" label="我的下载"/>
|
|
||||||
<el-option value="total" label="全部"/>
|
|
||||||
</el-select>
|
|
||||||
<el-select v-model="sortType" @change="changeSortType" style="width: 165px">
|
|
||||||
<template #prefix>
|
|
||||||
排序
|
|
||||||
</template>
|
|
||||||
<el-option value="name" label="名字"/>
|
|
||||||
<el-option value="shortName" label="简洁名字"/>
|
|
||||||
<el-option value="createTime" label="任务创建时间"/>
|
|
||||||
</el-select>
|
|
||||||
<el-select v-model="galleryNameType" @change="changeGalleryNameType">
|
|
||||||
<template #prefix>
|
|
||||||
显示
|
|
||||||
</template>
|
|
||||||
<el-option value="name" label="名字"/>
|
|
||||||
<el-option value="shortName" label="简洁名字"/>
|
|
||||||
</el-select>
|
|
||||||
</el-col>
|
|
||||||
<el-col>
|
|
||||||
<el-button @click="toMin">{{min}}</el-button>
|
|
||||||
<el-button @click="previous">-</el-button>
|
|
||||||
<el-input v-model="targetPage"
|
|
||||||
@change="changePage"
|
|
||||||
v-show="isEditingPage"
|
|
||||||
@blur="reverseEditMode"
|
|
||||||
class="page"
|
|
||||||
ref="inputNode"></el-input>
|
|
||||||
<span @click="reverseEditMode" v-show="!isEditingPage" class="page">{{page}}</span>
|
|
||||||
<el-button @click="next">+</el-button>
|
|
||||||
<el-button @click="toMax">{{max}}</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-dialog v-model="isViewing" width="100%" top="0" style="padding: 0">
|
|
||||||
<div style="height: 20vh; font: bold 16px semi-expanded">
|
|
||||||
<el-image :src="currentGallery.thumb_link"
|
|
||||||
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>
|
|
||||||
<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 !== '下载完成'" size="large">下载</el-button>
|
|
||||||
<el-button @click="deleteGallery(currentGallery.gid)" :disabled="currentGallery.status !== '下载完成'" size="large">删除</el-button>
|
|
||||||
<el-button @click="changeGalleryCollect(currentGallery.gid, currentGallery.isCollect)" :disabled="currentGallery.status !== '下载完成'"
|
|
||||||
size="large">{{currentGallery.isCollect ? '取消收藏' : '收藏'}}</el-button>
|
|
||||||
<el-button @click="readOnlineGallery(currentGallery)" size="large">在线看</el-button>
|
|
||||||
<el-button v-if="currentGallery.status !== '下载完成'"
|
|
||||||
@click="retryGallery(currentGallery.gid)"
|
|
||||||
:loading="retryingGids.has(currentGallery.gid)"
|
|
||||||
size="large">
|
|
||||||
重试
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<OnlineReader/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import store from "../store";
|
|
||||||
import {computed, ref} from "vue";
|
|
||||||
import OnlineReader from "./OnlineReader.vue";
|
|
||||||
|
|
||||||
//输入
|
|
||||||
let inputNode = ref(null)
|
|
||||||
//是否正在编辑页数
|
|
||||||
let isEditingPage = ref(false)
|
|
||||||
//是否查看详情
|
|
||||||
let isViewing = ref(false)
|
|
||||||
let retryingGids = ref(new Set())
|
|
||||||
|
|
||||||
let category = computed(() => {
|
|
||||||
return store.state.category
|
|
||||||
})
|
|
||||||
let galleryNameType = computed(() => {
|
|
||||||
return store.state.galleryNameType
|
|
||||||
})
|
|
||||||
let sortType = computed(() => {
|
|
||||||
return store.state.sortType
|
|
||||||
})
|
|
||||||
let targetPage = ref(1) // 当前页数
|
|
||||||
let username = computed(() => {
|
|
||||||
return store.state.username
|
|
||||||
})
|
|
||||||
|
|
||||||
//查询相关
|
|
||||||
let type = ref("keyword")
|
|
||||||
let param = ref("")
|
|
||||||
|
|
||||||
let loadComplete = computed(() => {
|
|
||||||
return store.state.loadComplete
|
|
||||||
})
|
|
||||||
|
|
||||||
let currentTasks = computed(() => {
|
|
||||||
return store.getters.currentTasks ? store.getters.currentTasks: null
|
|
||||||
})
|
|
||||||
|
|
||||||
let min = computed(() => {
|
|
||||||
return store.getters.min
|
|
||||||
})
|
|
||||||
let max = computed(() => {
|
|
||||||
if(targetPage.value > store.getters.max)
|
|
||||||
store.commit("_changePage", store.getters.max)
|
|
||||||
return store.getters.max
|
|
||||||
})
|
|
||||||
let page = computed(() => {
|
|
||||||
targetPage.value = store.state.page
|
|
||||||
return store.state.page
|
|
||||||
})
|
|
||||||
let isLion = computed(() => {
|
|
||||||
return store.state.userId === 3
|
|
||||||
})
|
|
||||||
|
|
||||||
let emptyText = computed(() => {
|
|
||||||
let action = category.value === 'myDownload' ? '下载': '收藏'
|
|
||||||
return '您未' + action + '过'
|
|
||||||
})
|
|
||||||
|
|
||||||
//查看详情
|
|
||||||
let currentGallery = ref({name:"name"})
|
|
||||||
|
|
||||||
//翻页
|
|
||||||
function next() {
|
|
||||||
if(targetPage.value < max.value) {
|
|
||||||
targetPage.value++
|
|
||||||
store.commit("_changePage", targetPage.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function previous() {
|
|
||||||
if(targetPage.value > min.value) {
|
|
||||||
targetPage.value--
|
|
||||||
store.commit("_changePage", targetPage.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function toMax() {
|
|
||||||
store.commit("_changePage", max.value)
|
|
||||||
targetPage.value = max.value
|
|
||||||
}
|
|
||||||
function toMin(){
|
|
||||||
store.commit("_changePage", min.value)
|
|
||||||
targetPage.value = min.value
|
|
||||||
}
|
|
||||||
function changePage(){
|
|
||||||
if(targetPage.value >= min.value && targetPage.value <= max.value)
|
|
||||||
store.commit("_changePage", targetPage.value)
|
|
||||||
}
|
|
||||||
function reverseEditMode(){
|
|
||||||
isEditingPage.value = !isEditingPage.value
|
|
||||||
if(isEditingPage.value){
|
|
||||||
inputNode.value.focus()
|
|
||||||
}
|
|
||||||
targetPage.value = page.value
|
|
||||||
}
|
|
||||||
|
|
||||||
//改变展示类型
|
|
||||||
function changeCategory(value){
|
|
||||||
store.commit("_setCategory", value)
|
|
||||||
}
|
|
||||||
function changeGalleryNameType(value){
|
|
||||||
store.commit("_setGalleryNameType", value)
|
|
||||||
}
|
|
||||||
function changeSortType(value){
|
|
||||||
store.commit("_setSortType", value)
|
|
||||||
}
|
|
||||||
|
|
||||||
//收藏
|
|
||||||
function changeGalleryCollect(gid, isCollect){
|
|
||||||
if(isCollect)
|
|
||||||
store.dispatch("disCollectGallery", gid)
|
|
||||||
else
|
|
||||||
store.dispatch("collectGallery", gid)
|
|
||||||
}
|
|
||||||
function queryLocalTask(){
|
|
||||||
switch (type.value){
|
|
||||||
case "link":
|
|
||||||
store.commit("_searchLocalByLink", param.value)
|
|
||||||
break
|
|
||||||
case "keyword":
|
|
||||||
store.commit("_searchLocalByKeyword", param.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//下载,删除,在线看
|
|
||||||
function downloadTask(link){
|
|
||||||
window.open(link)
|
|
||||||
}
|
|
||||||
function deleteGallery(gid){
|
|
||||||
store.dispatch("deleteGallery", gid).then(() => {
|
|
||||||
isViewing.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
async function retryGallery(gid){
|
|
||||||
if(retryingGids.value.has(gid))
|
|
||||||
return
|
|
||||||
retryingGids.value.add(gid)
|
|
||||||
try {
|
|
||||||
await store.dispatch("retryGallery", gid)
|
|
||||||
} finally {
|
|
||||||
retryingGids.value.delete(gid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function readOnlineGallery(gallery){
|
|
||||||
store.dispatch("readOnlineGallery", gallery)
|
|
||||||
}
|
|
||||||
function viewInfo(gallery){
|
|
||||||
currentGallery.value = gallery
|
|
||||||
isViewing.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 isDark(){
|
|
||||||
return document.querySelector('html').classList.contains('dark')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
span{
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.pageChanger{
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.el-select{
|
|
||||||
width: 135px;
|
|
||||||
}
|
|
||||||
.page{
|
|
||||||
display: inline-block;
|
|
||||||
width: 50px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<script setup>
|
||||||
|
import store from "../store/index.js";
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{key: "tasks", label: "任务"},
|
||||||
|
{key: "search", label: "搜索"},
|
||||||
|
{key: "settings", label: "设置"},
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<nav class="tab-bar" role="tablist" aria-label="主导航">
|
||||||
|
<button v-for="tab in tabs"
|
||||||
|
:key="tab.key"
|
||||||
|
type="button"
|
||||||
|
role="tab"
|
||||||
|
class="tab-item"
|
||||||
|
:class="{'is-active': store.state.activeTab === tab.key}"
|
||||||
|
:aria-selected="store.state.activeTab === tab.key"
|
||||||
|
@click="store.commit('_setActiveTab', tab.key)">
|
||||||
|
{{ tab.label }}
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, ref, watch} from "vue";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
import {ehThumbnailUrl, pickDefaultResolution} from "lionwebsite-frontend-shared";
|
||||||
|
|
||||||
|
// Two flows share this sheet: a task already in the list, and a remote gallery
|
||||||
|
// that was resolved from a link or from the online search.
|
||||||
|
const isOpen = ref(false);
|
||||||
|
const mode = ref("task");
|
||||||
|
const task = ref(null);
|
||||||
|
const targetResolution = ref("");
|
||||||
|
|
||||||
|
const chosenGallery = computed(() => store.state.chosenGallery);
|
||||||
|
const detailGallery = computed(() => store.state.detailGallery);
|
||||||
|
|
||||||
|
watch(chosenGallery, (gallery) => {
|
||||||
|
if (gallery) {
|
||||||
|
mode.value = "remote";
|
||||||
|
targetResolution.value = pickDefaultResolution(gallery.availableResolution);
|
||||||
|
isOpen.value = true;
|
||||||
|
} else if (mode.value === "remote") {
|
||||||
|
// The remote decision was withdrawn elsewhere: close instead of leaving a
|
||||||
|
// stale task/remote mix behind the same sheet.
|
||||||
|
mode.value = "task";
|
||||||
|
isOpen.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(detailGallery, (gallery) => {
|
||||||
|
if (gallery) {
|
||||||
|
mode.value = "task";
|
||||||
|
task.value = gallery;
|
||||||
|
isOpen.value = true;
|
||||||
|
} else if (mode.value === "task") {
|
||||||
|
// Only the task flow closes on an empty detail; clearing the detail while a
|
||||||
|
// remote gallery is on screen must not tear the remote sheet down.
|
||||||
|
task.value = null;
|
||||||
|
isOpen.value = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Admin-only fields come from the backend's isAdmin flag, not a hardcoded id.
|
||||||
|
const isAdmin = computed(() => store.state.isAdmin);
|
||||||
|
const isDone = computed(() => (task.value ? task.value.status === "下载完成" : false));
|
||||||
|
const isCollect = computed(() => Boolean(task.value && task.value.isCollect));
|
||||||
|
|
||||||
|
const resolutions = computed(() => {
|
||||||
|
const gallery = chosenGallery.value;
|
||||||
|
if (!gallery || !gallery.availableResolution) return [];
|
||||||
|
return Object.entries(gallery.availableResolution).map(([resolution, fileSize]) => ({
|
||||||
|
resolution,
|
||||||
|
fileSize,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
// A gallery resolved through queryGalleryTask already has its thumb_link proxied
|
||||||
|
// by normalizeTask; only a raw upstream path (thumbnailUrl) needs the proxy here.
|
||||||
|
const remoteThumb = computed(() => {
|
||||||
|
const gallery = chosenGallery.value;
|
||||||
|
if (!gallery) return "";
|
||||||
|
return gallery.thumb_link || ehThumbnailUrl(gallery.thumbnailUrl, store.state.AuthCode);
|
||||||
|
});
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
isOpen.value = false;
|
||||||
|
if (mode.value === "remote") store.commit("_setChosenGallery", {gallery: false});
|
||||||
|
else store.commit("_setDetailGallery", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadTask() {
|
||||||
|
if (!task.value) return;
|
||||||
|
if (task.value.download) window.open(task.value.download);
|
||||||
|
else ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"});
|
||||||
|
}
|
||||||
|
|
||||||
|
function readOnline(gallery) {
|
||||||
|
if (!gallery) return;
|
||||||
|
close();
|
||||||
|
store.dispatch("readOnlineGallery", gallery);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCollect() {
|
||||||
|
if (!task.value) return;
|
||||||
|
const gallery = task.value;
|
||||||
|
gallery.isCollect = !gallery.isCollect;
|
||||||
|
if (gallery.isCollect) store.dispatch("collectGallery", gallery.gid);
|
||||||
|
else store.dispatch("disCollectGallery", gallery.gid);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteTask() {
|
||||||
|
if (!task.value) return;
|
||||||
|
store.dispatch("deleteGallery", task.value.gid).then(close);
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitTask() {
|
||||||
|
const gallery = chosenGallery.value;
|
||||||
|
if (!gallery) return;
|
||||||
|
if (targetResolution.value === "") {
|
||||||
|
ElMessage("请选择分辨率再提交");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.dispatch("postGalleryTask", {
|
||||||
|
link: gallery.link,
|
||||||
|
targetResolution: targetResolution.value,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="sheet-layer" v-show="isOpen">
|
||||||
|
<button type="button" class="sheet-scrim" aria-label="关闭详情" @click="close"></button>
|
||||||
|
|
||||||
|
<section class="sheet" role="dialog" aria-modal="true" aria-label="任务详情">
|
||||||
|
<span class="sheet-grab" aria-hidden="true"></span>
|
||||||
|
|
||||||
|
<template v-if="mode === 'task' && task">
|
||||||
|
<div class="sheet-head">
|
||||||
|
<span class="sheet-thumb">
|
||||||
|
<img v-if="task.thumb_link" :src="task.thumb_link" alt="" loading="lazy">
|
||||||
|
</span>
|
||||||
|
<div class="sheet-heading">
|
||||||
|
<p class="sheet-title">{{ task.name }}</p>
|
||||||
|
<div class="sheet-sub">
|
||||||
|
<span class="status-pill" :class="task.status === '下载完成' ? 'is-done' : (task.status === '下载中' || task.status === '压缩中' ? 'is-running' : 'is-waiting')">
|
||||||
|
{{ task.status }}
|
||||||
|
</span>
|
||||||
|
<span>{{ task.pages }} 页 · {{ task.language }} · {{ task.fileSize }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress-line" v-if="task.progress && task.status !== '下载完成'">
|
||||||
|
<el-progress :percentage="parseInt(task.progress) || 0" :stroke-width="4" :show-text="false"/>
|
||||||
|
<span class="progress-value">{{ task.progress }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sheet-actions">
|
||||||
|
<button type="button" class="sheet-action is-primary" :disabled="!isDone" @click="downloadTask">下载</button>
|
||||||
|
<button type="button" class="sheet-action" @click="readOnline(task)">在线看</button>
|
||||||
|
<button type="button" class="sheet-action" :class="{'is-on': isCollect}" :disabled="!isDone" @click="toggleCollect">
|
||||||
|
{{ isCollect ? "已收藏" : "收藏" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<dl class="sheet-facts">
|
||||||
|
<dt>分辨率</dt>
|
||||||
|
<dd>{{ task.resolution || "—" }}</dd>
|
||||||
|
<dt>创建时间</dt>
|
||||||
|
<dd>{{ task.createTimeDisplay || "—" }}</dd>
|
||||||
|
<dt>原始页面</dt>
|
||||||
|
<dd><a v-if="task.link" :href="task.link" target="_blank" rel="noopener">打开链接</a><span v-else>—</span></dd>
|
||||||
|
<template v-if="isAdmin">
|
||||||
|
<dt>下载人</dt>
|
||||||
|
<dd>{{ task.downloaderName || `#${task.downloader}` }}</dd>
|
||||||
|
</template>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<div class="sheet-foot">
|
||||||
|
<button type="button" class="sheet-button is-danger" :disabled="!isDone" @click="deleteTask">删除任务</button>
|
||||||
|
<button type="button" class="sheet-button" @click="close">关闭</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="mode === 'remote' && chosenGallery">
|
||||||
|
<div class="sheet-head">
|
||||||
|
<span class="sheet-thumb">
|
||||||
|
<img v-if="remoteThumb" :src="remoteThumb" alt="" loading="lazy">
|
||||||
|
</span>
|
||||||
|
<div class="sheet-heading">
|
||||||
|
<p class="sheet-title">{{ chosenGallery.name }}</p>
|
||||||
|
<div class="sheet-sub">
|
||||||
|
<span v-if="chosenGallery.status">{{ chosenGallery.status }}</span>
|
||||||
|
<span v-if="chosenGallery.pages">{{ chosenGallery.pages }} 页</span>
|
||||||
|
<span v-if="chosenGallery.fileSize">{{ chosenGallery.fileSize }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="resolutions.length">
|
||||||
|
<div class="sheet-actions is-single">
|
||||||
|
<button type="button" class="sheet-action" @click="readOnline(chosenGallery)">在线看</button>
|
||||||
|
</div>
|
||||||
|
<p class="sheet-section">目标分辨率</p>
|
||||||
|
<div class="resolution-list">
|
||||||
|
<button v-for="item in resolutions"
|
||||||
|
:key="item.resolution"
|
||||||
|
type="button"
|
||||||
|
:aria-pressed="targetResolution === item.resolution"
|
||||||
|
@click="targetResolution = item.resolution">
|
||||||
|
{{ item.resolution }} · {{ item.fileSize }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="sheet-foot">
|
||||||
|
<button type="button" class="sheet-button" @click="close">取消</button>
|
||||||
|
<button type="button" class="sheet-button is-accent" @click="submitTask">提交下载</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div class="sheet-actions">
|
||||||
|
<button type="button" class="sheet-action is-primary" @click="downloadTask">下载文件</button>
|
||||||
|
<button type="button" class="sheet-action" @click="readOnline(chosenGallery)">在线看</button>
|
||||||
|
</div>
|
||||||
|
<div class="sheet-foot">
|
||||||
|
<button type="button" class="sheet-button" @click="close">关闭</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed} from "vue";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
gallery: {type: Object, required: true},
|
||||||
|
retrying: {type: Boolean, default: false},
|
||||||
|
});
|
||||||
|
|
||||||
|
defineEmits(["open", "download", "retry"]);
|
||||||
|
|
||||||
|
// Only a running download reports a percentage; everything else uses the status text.
|
||||||
|
const percent = computed(() => {
|
||||||
|
const gallery = props.gallery;
|
||||||
|
if (!gallery || gallery.status !== "下载中" || !gallery.pages) return null;
|
||||||
|
const done = Number(gallery.proceeding) || 0;
|
||||||
|
return Math.min(100, Math.max(0, Math.round((done / gallery.pages) * 100)));
|
||||||
|
});
|
||||||
|
|
||||||
|
const title = computed(() => {
|
||||||
|
return store.state.galleryNameType === "name" ? props.gallery.name : props.gallery.shortName;
|
||||||
|
});
|
||||||
|
|
||||||
|
// States arrive as Chinese labels from the backend; map them to pill colours.
|
||||||
|
const statusClass = computed(() => {
|
||||||
|
const status = props.gallery.status;
|
||||||
|
if (status === "下载完成") return "is-done";
|
||||||
|
if (status === "下载中" || status === "压缩中") return "is-running";
|
||||||
|
return "is-waiting";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="task-row">
|
||||||
|
<button type="button" class="task-row-open" @click="$emit('open', gallery)">
|
||||||
|
<span class="task-thumb">
|
||||||
|
<img v-if="gallery.thumb_link" :src="gallery.thumb_link" alt="" loading="lazy">
|
||||||
|
</span>
|
||||||
|
<span class="task-body">
|
||||||
|
<span class="task-title">{{ title }}</span>
|
||||||
|
<span class="task-meta">{{ gallery.pages }} 页 · {{ gallery.language }} · {{ gallery.fileSize }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="task-foot">
|
||||||
|
<span class="status-pill" :class="statusClass">{{ gallery.status }}</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<span v-if="percent !== null" class="task-side task-side-num">{{ percent }}%</span>
|
||||||
|
<button v-else-if="gallery.status === '下载完成'"
|
||||||
|
type="button"
|
||||||
|
class="task-side task-side-act"
|
||||||
|
aria-label="下载文件"
|
||||||
|
@click="$emit('download', gallery)">下载</button>
|
||||||
|
<button v-else
|
||||||
|
type="button"
|
||||||
|
class="task-side task-side-muted"
|
||||||
|
:disabled="retrying"
|
||||||
|
aria-label="重试任务"
|
||||||
|
@click="$emit('retry', gallery)">{{ retrying ? "重试中" : "重试" }}</button>
|
||||||
|
|
||||||
|
<span v-if="percent !== null" class="task-row-edge"><i :style="{width: percent + '%'}"></i></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
<script setup>
|
||||||
|
import {computed, ref} from "vue";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
import store from "../store/index.js";
|
||||||
|
import TaskRow from "./TaskRow.vue";
|
||||||
|
|
||||||
|
const retryingGids = ref(new Set());
|
||||||
|
const refreshing = ref(false);
|
||||||
|
|
||||||
|
const tasks = computed(() => store.getters.visibleTasks);
|
||||||
|
const total = computed(() => store.getters.taskTotal);
|
||||||
|
const remaining = computed(() => store.getters.taskRemaining);
|
||||||
|
|
||||||
|
const connectionShort = computed(() => ({
|
||||||
|
connected: "已连接",
|
||||||
|
connecting: "连接中",
|
||||||
|
reconnecting: "重连中",
|
||||||
|
disconnected: "已断开",
|
||||||
|
})[store.state.connectionStatus]);
|
||||||
|
|
||||||
|
const isConnected = computed(() => store.state.connectionStatus === "connected");
|
||||||
|
|
||||||
|
const category = computed({
|
||||||
|
get: () => store.state.category,
|
||||||
|
set: value => store.commit("_setCategory", value),
|
||||||
|
});
|
||||||
|
const sortType = computed({
|
||||||
|
get: () => store.state.sortType,
|
||||||
|
set: value => store.commit("_setSortType", value),
|
||||||
|
});
|
||||||
|
|
||||||
|
const isAdmin = computed(() => store.state.isAdmin);
|
||||||
|
const downloaderFilter = computed({
|
||||||
|
get: () => store.state.downloaderFilter,
|
||||||
|
set: value => store.commit("_setDownloaderFilter", value),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Options come from the current category, so the dropdown can never offer a
|
||||||
|
// downloader that would filter the visible list down to nothing.
|
||||||
|
const downloaderOptions = computed(() => {
|
||||||
|
const seen = new Map();
|
||||||
|
;(store.getters.categoryGallery || []).forEach(task => {
|
||||||
|
if (task.downloaderName && !seen.has(task.downloader))
|
||||||
|
seen.set(task.downloader, task.downloaderName);
|
||||||
|
});
|
||||||
|
return [...seen].map(([id, name]) => ({id, name}));
|
||||||
|
});
|
||||||
|
|
||||||
|
const emptyText = computed(() => {
|
||||||
|
if (store.state.category === "myDownload") return "您未下载过";
|
||||||
|
if (store.state.category === "myCollect") return "您未收藏过";
|
||||||
|
return "暂无任务";
|
||||||
|
});
|
||||||
|
|
||||||
|
function openTask(gallery) {
|
||||||
|
store.commit("_setDetailGallery", gallery);
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadTask(gallery) {
|
||||||
|
if (gallery.download) window.open(gallery.download);
|
||||||
|
else ElMessage({message: "下载地址不存在,请刷新任务后重试", type: "error"});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retryGallery(gallery) {
|
||||||
|
if (retryingGids.value.has(gallery.gid)) return;
|
||||||
|
retryingGids.value.add(gallery.gid);
|
||||||
|
try {
|
||||||
|
await store.dispatch("retryGallery", gallery.gid);
|
||||||
|
} finally {
|
||||||
|
retryingGids.value.delete(gallery.gid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMore() {
|
||||||
|
store.commit("_showMoreTasks");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshTasks() {
|
||||||
|
if (refreshing.value) return;
|
||||||
|
refreshing.value = true;
|
||||||
|
try {
|
||||||
|
await store.dispatch("updateGalleryTasks");
|
||||||
|
} finally {
|
||||||
|
refreshing.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="view">
|
||||||
|
<header class="app-bar">
|
||||||
|
<h1>任务</h1>
|
||||||
|
<span class="app-bar-count">{{ total }} 项</span>
|
||||||
|
<span class="app-bar-spacer"></span>
|
||||||
|
<span class="connection" :class="{'is-connected': isConnected}" role="status">
|
||||||
|
<i class="connection-dot"></i>{{ connectionShort }}
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="filter-bar" v-if="store.state.username !== 'test'">
|
||||||
|
<label class="filter">
|
||||||
|
<span class="filter-label">范围</span>
|
||||||
|
<el-select v-model="category" size="small" class="filter-select filter-select-range">
|
||||||
|
<el-option value="myDownload" label="我的下载"/>
|
||||||
|
<el-option value="myCollect" label="我的收藏"/>
|
||||||
|
<el-option value="total" label="全部"/>
|
||||||
|
</el-select>
|
||||||
|
</label>
|
||||||
|
<label class="filter">
|
||||||
|
<span class="filter-label">排序</span>
|
||||||
|
<el-select v-model="sortType" size="small" class="filter-select filter-select-sort">
|
||||||
|
<el-option value="createTime" label="创建时间"/>
|
||||||
|
<el-option value="name" label="名字"/>
|
||||||
|
<el-option value="shortName" label="简洁名"/>
|
||||||
|
</el-select>
|
||||||
|
</label>
|
||||||
|
<label class="filter" v-if="isAdmin">
|
||||||
|
<span class="filter-label">下载人</span>
|
||||||
|
<el-select v-model="downloaderFilter" size="small"
|
||||||
|
class="filter-select filter-select-downloader"
|
||||||
|
clearable placeholder="全部">
|
||||||
|
<el-option v-for="item in downloaderOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:value="item.id"
|
||||||
|
:label="item.name"/>
|
||||||
|
</el-select>
|
||||||
|
</label>
|
||||||
|
<button type="button" class="chip-button" :disabled="refreshing" @click="refreshTasks">
|
||||||
|
{{ refreshing ? "刷新中" : "刷新" }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-scroll">
|
||||||
|
<p v-if="tasks.length === 0" class="empty-state">{{ emptyText }}</p>
|
||||||
|
<TaskRow v-for="gallery in tasks"
|
||||||
|
:key="gallery.gid"
|
||||||
|
:gallery="gallery"
|
||||||
|
:retrying="retryingGids.has(gallery.gid)"
|
||||||
|
@open="openTask"
|
||||||
|
@download="downloadTask"
|
||||||
|
@retry="retryGallery"/>
|
||||||
|
<button v-if="remaining > 0" type="button" class="load-more" @click="showMore">
|
||||||
|
继续加载(还有 {{ remaining }} 项)
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
+11
-2
@@ -1,8 +1,17 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import {
|
||||||
|
ElButton, ElCheckbox, ElDialog, ElForm, ElFormItem, ElImage, ElInput,
|
||||||
|
ElInputNumber, ElOption, ElProgress, ElScrollbar, ElSelect, ElSwitch,
|
||||||
|
} from "element-plus"
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
import element from "element-plus"
|
|
||||||
import "./reset.css"
|
import "./reset.css"
|
||||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||||
|
import "./styles/theme.css"
|
||||||
|
|
||||||
createApp(App).use(element).mount('#app')
|
// 只注册本仓库用到的组件,避免把整个 Element Plus 打进入口包。
|
||||||
|
const app = createApp(App)
|
||||||
|
for (const component of [ElButton, ElCheckbox, ElDialog, ElForm, ElFormItem, ElImage,
|
||||||
|
ElInput, ElInputNumber, ElOption, ElProgress, ElScrollbar, ElSelect, ElSwitch])
|
||||||
|
app.component(component.name, component)
|
||||||
|
app.mount('#app')
|
||||||
|
|||||||
+8
-545
@@ -2,11 +2,7 @@ import vuex from "vuex"
|
|||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import {ElMessage} from "element-plus"
|
import {ElMessage} from "element-plus"
|
||||||
import qs from "qs"
|
import qs from "qs"
|
||||||
import {createTaskSocket} from "../utils/taskSocket.js"
|
import {createGalleryStore} from "lionwebsite-frontend-shared"
|
||||||
let taskSocket
|
|
||||||
let taskRefreshVersion = 0
|
|
||||||
const BaseUrl = "https://downloader.lionwebsite.xyz/"
|
|
||||||
const GalleryManageUrl = BaseUrl + "GalleryManage"
|
|
||||||
|
|
||||||
// Axios 全局错误处理
|
// Axios 全局错误处理
|
||||||
axios.interceptors.response.use(
|
axios.interceptors.response.use(
|
||||||
@@ -17,543 +13,10 @@ axios.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const actions = {
|
// 移动端与桌面端共用同一份任务业务核心,移动端用“继续加载”代替分页条。
|
||||||
reconnect(context) {
|
export default new vuex.Store(createGalleryStore({
|
||||||
axios.post(GalleryManageUrl + "/reconnect", null, {
|
variant: "mobile",
|
||||||
params: {
|
axios,
|
||||||
AuthCode: context.state.AuthCode
|
qs,
|
||||||
}
|
Message: ElMessage,
|
||||||
}).then(res => {
|
}))
|
||||||
if (res.data.result === "success") {
|
|
||||||
ElMessage("重连成功")
|
|
||||||
} else {
|
|
||||||
ElMessage("重连失败")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
updateGalleryTasks(context){
|
|
||||||
const version = ++taskRefreshVersion
|
|
||||||
return axios.get(GalleryManageUrl, {
|
|
||||||
params:{
|
|
||||||
AuthCode: context.state.AuthCode,
|
|
||||||
type: 'all'
|
|
||||||
}
|
|
||||||
}).then((res) => {
|
|
||||||
if(res.data.result === "success" && version === taskRefreshVersion)
|
|
||||||
context.commit("_updateGalleryTasks", JSON.parse(res.data.data))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
postGalleryTask(context, data){
|
|
||||||
return axios.post(GalleryManageUrl + '?' + qs.stringify({
|
|
||||||
AuthCode: context.state.AuthCode,
|
|
||||||
...data
|
|
||||||
}, {indices:false})).then((res) => {
|
|
||||||
if(res.data.result === "success") {
|
|
||||||
ElMessage("提交成功")
|
|
||||||
context.commit("_setChosenGallery", {gallery: false})
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(res.data.data)
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
else
|
|
||||||
ElMessage("提交失败")
|
|
||||||
// A node timeout can still leave a persisted task; always reload its actual state.
|
|
||||||
return Promise.all([context.dispatch("updateGalleryTasks"), context.dispatch("loadWeekUsedAmount")])
|
|
||||||
})
|
|
||||||
},
|
|
||||||
queryGalleryTask(context, link){
|
|
||||||
axios.get(GalleryManageUrl, {
|
|
||||||
params:{
|
|
||||||
param: link,
|
|
||||||
type: 'link',
|
|
||||||
AuthCode: context.state.AuthCode
|
|
||||||
}
|
|
||||||
}).then((res) => {
|
|
||||||
if(res.data.result === 'success'){
|
|
||||||
let gallery = JSON.parse(res.data.data)
|
|
||||||
if(gallery.status === "下载完成")
|
|
||||||
gallery.download = buildGalleryDownloadUrl(gallery.gid, context.state.AuthCode)
|
|
||||||
context.commit("_setChosenGallery", {gallery})
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ElMessage("查询失败")
|
|
||||||
})
|
|
||||||
},
|
|
||||||
validate(context, AuthCode){
|
|
||||||
axios.post(BaseUrl + "validate?AuthCode=" + AuthCode).then((res)=>{
|
|
||||||
if(res.data.result === 'success'){
|
|
||||||
let data = JSON.parse(res.data.data);
|
|
||||||
if(!data.isAvailable)
|
|
||||||
ElMessage({duration:0, message:"节点挂了,不能下也不能看,找狮子处理", type: "error"})
|
|
||||||
context.commit("_authed", {AuthCode, ...data})
|
|
||||||
//初始化
|
|
||||||
context.dispatch("loadWeekUsedAmount").then()
|
|
||||||
context.dispatch("updateGalleryTasks").then(() => confirmCurrentTask(context.state))
|
|
||||||
context.dispatch("initWebsocket").then()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
context.dispatch("disconnectWebsocket")
|
|
||||||
context.commit("_unAuthed")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
initWebsocket(context){
|
|
||||||
taskSocket?.stop()
|
|
||||||
taskSocket = createTaskSocket({
|
|
||||||
url: "wss://downloader.lionwebsite.xyz/ws/",
|
|
||||||
onState: status => context.commit("_setConnectionStatus", status),
|
|
||||||
onOpen: () => {
|
|
||||||
// Catch up on every connection, including events missed during an outage.
|
|
||||||
Promise.all([context.dispatch("updateGalleryTasks"), context.dispatch("loadWeekUsedAmount")]).catch(() => {})
|
|
||||||
},
|
|
||||||
onMessage: event => {
|
|
||||||
let message
|
|
||||||
try { message = JSON.parse(event.data) }
|
|
||||||
catch { return }
|
|
||||||
if(message.type === "updateTasks" && Array.isArray(message.data))
|
|
||||||
context.commit("_updateGalleryTaskProceeding", message.data)
|
|
||||||
else if(message.type === "fullUpdate")
|
|
||||||
context.dispatch("updateGalleryTasks").catch(() => {})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
taskSocket.start()
|
|
||||||
},
|
|
||||||
disconnectWebsocket(context){
|
|
||||||
taskSocket?.stop()
|
|
||||||
taskSocket = undefined
|
|
||||||
context.commit("_setConnectionStatus", "disconnected")
|
|
||||||
},
|
|
||||||
loadWeekUsedAmount(context){
|
|
||||||
return axios.get(GalleryManageUrl + "/weekUsedAmount", {
|
|
||||||
params: {
|
|
||||||
AuthCode: context.state.AuthCode
|
|
||||||
}
|
|
||||||
}).then((res) => {
|
|
||||||
if(res.data.result === "success"){
|
|
||||||
context.state.weekUsed = JSON.parse(res.data.data)
|
|
||||||
}else
|
|
||||||
ElMessage("查询用量失败")
|
|
||||||
})
|
|
||||||
},
|
|
||||||
collectGallery(context, gid){
|
|
||||||
axios.post(GalleryManageUrl + "/collect?" +qs.stringify( {
|
|
||||||
gid, AuthCode:context.state.AuthCode
|
|
||||||
})).then((res) => {
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
if(res.data.result === 'success')
|
|
||||||
context.commit("_collectGallery", gid)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
disCollectGallery(context, gid){
|
|
||||||
axios.post(GalleryManageUrl + "/disCollect?" + qs.stringify({
|
|
||||||
gid, AuthCode:context.state.AuthCode
|
|
||||||
})).then((res) => {
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
if(res.data.result === 'success')
|
|
||||||
context.commit("_disCollectGallery", gid)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
deleteGallery(context, gid){
|
|
||||||
return axios.delete(GalleryManageUrl, {
|
|
||||||
params:{
|
|
||||||
AuthCode:context.state.AuthCode, gid
|
|
||||||
}}).then((res) => {
|
|
||||||
if(res.data.result === "success"){
|
|
||||||
ElMessage("删除成功")
|
|
||||||
context.commit("_deleteGallery", gid)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
retryGallery(context, gid){
|
|
||||||
return axios.post(GalleryManageUrl + "/retry?" + qs.stringify({
|
|
||||||
gid, AuthCode: context.state.AuthCode
|
|
||||||
})).then((res) => {
|
|
||||||
if(res.data.result === "success"){
|
|
||||||
ElMessage({message: "重试结果:" + res.data.data, type: "success"})
|
|
||||||
return context.dispatch("updateGalleryTasks")
|
|
||||||
}
|
|
||||||
ElMessage({message: res.data.data || "重试失败", type: "error"})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
readOnlineGallery(context, gallery){
|
|
||||||
if(gallery.images !== undefined && gallery.images.length !== 0)
|
|
||||||
context.commit("_setReadingGallery", gallery)
|
|
||||||
else
|
|
||||||
return axios.post(GalleryManageUrl + "/cache", null, {
|
|
||||||
params: {url: gallery.link, AuthCode: context.state.AuthCode}
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.data.result === 'success') {
|
|
||||||
gallery.pages = res.data.data.pages
|
|
||||||
setTimeout(() => {
|
|
||||||
context.commit("_setReadingGallery", gallery)
|
|
||||||
}, 100)
|
|
||||||
} else
|
|
||||||
ElMessage.error(res.data.data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
alterAuthCode(context, AuthCode){
|
|
||||||
axios.put(BaseUrl + "AuthCode?" + qs.stringify({'AuthCode': context.state.AuthCode, 'newAuthCode': AuthCode}))
|
|
||||||
.then((res) => {
|
|
||||||
if(res.data.result === 'success') {
|
|
||||||
ElMessage("修改成功")
|
|
||||||
if(localStorage.getItem("auth") === context.state.AuthCode)
|
|
||||||
localStorage.setItem("auth", AuthCode)
|
|
||||||
context.state.AuthCode = AuthCode
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
resetUndone(context){
|
|
||||||
axios.post(GalleryManageUrl + "/reset?AuthCode=" + context.state.AuthCode).then((res) => {
|
|
||||||
ElMessage(res.data.data)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const mutations = {
|
|
||||||
_setConnectionStatus(state, status){
|
|
||||||
state.connectionStatus = status
|
|
||||||
},
|
|
||||||
_collectGallery(state, gid){
|
|
||||||
let tasks = state.totalGalleryTask
|
|
||||||
for(let i=0; i< tasks.length; i++){
|
|
||||||
if(!tasks[i].isCollect && tasks[i].gid === gid){
|
|
||||||
tasks[i].isCollect = true
|
|
||||||
state.collectGallery.push(tasks[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_disCollectGallery(state, gid){
|
|
||||||
let index
|
|
||||||
for(let i=0; i < state.collectGallery.length; i++)
|
|
||||||
if(state.collectGallery[i].gid === gid){
|
|
||||||
index = i
|
|
||||||
break
|
|
||||||
}
|
|
||||||
state.collectGallery[index].isCollect = false
|
|
||||||
state.collectGallery.splice(index, 1)
|
|
||||||
},
|
|
||||||
_updateGalleryTasks(state, tasks){
|
|
||||||
state.totalGalleryTask.splice(0)
|
|
||||||
state.collectGallery.splice(0)
|
|
||||||
state.downloadGallery.splice(0)
|
|
||||||
|
|
||||||
tasks.forEach((task) => {
|
|
||||||
//处理名字
|
|
||||||
task.shortName = getShortname(task.name)
|
|
||||||
if(task.thumb_link.trim() !== '')
|
|
||||||
task.thumb_link = buildGalleryManageUrl("/ehThumbnail", {
|
|
||||||
path: task.thumb_link,
|
|
||||||
AuthCode: state.AuthCode
|
|
||||||
})
|
|
||||||
else
|
|
||||||
delete task.thumb_link
|
|
||||||
|
|
||||||
//处理进度相关
|
|
||||||
switch (task.status) {
|
|
||||||
case "已提交":
|
|
||||||
case "等待压缩":
|
|
||||||
case "压缩中":
|
|
||||||
task.progress = task.status
|
|
||||||
break;
|
|
||||||
case "下载中":
|
|
||||||
task.progress = (Math.round((task.proceeding / task.pages) * 100)).toString() + "%"
|
|
||||||
break;
|
|
||||||
case "下载完成":
|
|
||||||
task.progress = task.status
|
|
||||||
task.download = buildGalleryDownloadUrl(task.gid, state.AuthCode)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//处理时间戳
|
|
||||||
task.createTimeDisplay = new Date(task.createTime * 1000).toLocaleString("zh")
|
|
||||||
|
|
||||||
//处理是否收藏
|
|
||||||
if('isCollect' in task)
|
|
||||||
state.collectGallery.push(task)
|
|
||||||
else
|
|
||||||
task.isCollect = false
|
|
||||||
|
|
||||||
//处理是否下载
|
|
||||||
if(task.downloader === state.userId)
|
|
||||||
state.downloadGallery.push(task)
|
|
||||||
|
|
||||||
state.totalGalleryTask.push(task)
|
|
||||||
})
|
|
||||||
|
|
||||||
sortTasks(state)
|
|
||||||
if(state.isAuth && !state.loadComplete){
|
|
||||||
state.loadComplete = true
|
|
||||||
ElMessage("加载完成")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_updateGalleryTaskProceeding(state, tasks){
|
|
||||||
let galleries = Array.from(state.totalGalleryTask)
|
|
||||||
state.totalGalleryTask.splice(0)
|
|
||||||
galleries.forEach((gallery) => {
|
|
||||||
if(gallery.status !== '下载完成')
|
|
||||||
tasks.forEach((task) => {
|
|
||||||
if(task.gid === gallery.gid){
|
|
||||||
gallery.status = status[task.status]
|
|
||||||
gallery.proceeding = task.proceeding
|
|
||||||
if(gallery.status === '下载中')
|
|
||||||
gallery.progress = (Math.round((gallery.proceeding / gallery.pages) * 100)).toString() + "%"
|
|
||||||
else
|
|
||||||
gallery.progress = gallery.status
|
|
||||||
}
|
|
||||||
})
|
|
||||||
state.totalGalleryTask.push(gallery)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
_changePage(state, targetPage){
|
|
||||||
state.page = targetPage
|
|
||||||
},
|
|
||||||
_authed(state, data){
|
|
||||||
state.AuthCode = data.AuthCode
|
|
||||||
state.userId = data.userId
|
|
||||||
state.username = data.username
|
|
||||||
state.isAuth = true
|
|
||||||
ElMessage("验证成功,加载中")
|
|
||||||
},
|
|
||||||
_unAuthed(state){
|
|
||||||
state.isAuth = false
|
|
||||||
state.AuthCode = ""
|
|
||||||
state.userId = -1
|
|
||||||
state.username = ""
|
|
||||||
ElMessage("授权码错误")
|
|
||||||
localStorage.removeItem("auth")
|
|
||||||
},
|
|
||||||
_searchLocalByLink(state, link){
|
|
||||||
let tasks = state.currentTasks
|
|
||||||
let gid = link.split("/")[4]
|
|
||||||
let name = null
|
|
||||||
|
|
||||||
if(gid === undefined)
|
|
||||||
for (let i = 0; i < tasks.length; i++) {
|
|
||||||
if (tasks[i].link === link) {
|
|
||||||
state.page = Math.floor(i / state.length) + 1
|
|
||||||
name = tasks[i].name
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else for (let i = 0; i < tasks.length; i++)
|
|
||||||
if (String(tasks[i].gid) === gid) {
|
|
||||||
state.page = Math.floor(i / state.length) + 1
|
|
||||||
name = state.sortType === "shortName" ? tasks[i].shortName: tasks[i].name
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!name)
|
|
||||||
ElMessage("未找到此任务")
|
|
||||||
else
|
|
||||||
ElMessage("已跳转到该任务所在页数,任务名:" + name)
|
|
||||||
},
|
|
||||||
_searchLocalByKeyword(state, keyword){
|
|
||||||
state.searchTask.splice(0)
|
|
||||||
if(keyword.trim() !== '') {
|
|
||||||
state.page = 1
|
|
||||||
let tasks = state.currentTasks
|
|
||||||
tasks.forEach((task) => {
|
|
||||||
if (task.name.includes(keyword))
|
|
||||||
state.searchTask.push(task)
|
|
||||||
})
|
|
||||||
if (state.searchTask.length === 0) {
|
|
||||||
ElMessage("未找到该关键字的任务")
|
|
||||||
state.isSearch = false
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
state.isSearch = true
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
state.isSearch = false
|
|
||||||
confirmCurrentTask(state)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_deleteGallery(state, gid){
|
|
||||||
let tasks = [state.totalGalleryTask, state.downloadGallery, state.collectGallery]
|
|
||||||
deleteTask(tasks, 'gid', gid)
|
|
||||||
},
|
|
||||||
_setChosenGallery(state,data){
|
|
||||||
state.chosenGallery = data.gallery
|
|
||||||
},
|
|
||||||
_setCategory(state, category){
|
|
||||||
state.category = category
|
|
||||||
confirmCurrentTask(state)
|
|
||||||
sortTasks(state)
|
|
||||||
},
|
|
||||||
_setSortType(state, sortType){
|
|
||||||
state.sortType = sortType
|
|
||||||
sortTasks(state)
|
|
||||||
},
|
|
||||||
_setGalleryNameType(state, galleryNameType){
|
|
||||||
state.galleryNameType = galleryNameType
|
|
||||||
},
|
|
||||||
_setShowNameType(state, type){
|
|
||||||
if(type === "shortName")
|
|
||||||
state.length = state.shortLength
|
|
||||||
else
|
|
||||||
state.length = state.defaultLength
|
|
||||||
},
|
|
||||||
_setReadingGallery(state, gallery){
|
|
||||||
if(gallery.images === undefined) {
|
|
||||||
gallery.images = []
|
|
||||||
for(let i=1; i<=gallery.pages; i++)
|
|
||||||
gallery.images.push(buildGalleryManageUrl("/onlineImage/" + i, {
|
|
||||||
gid: gallery.gid,
|
|
||||||
AuthCode: state.AuthCode
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
state.readingGallery = gallery
|
|
||||||
state.isReading = true;
|
|
||||||
},
|
|
||||||
_closeReader(state){
|
|
||||||
state.isReading = false;
|
|
||||||
},
|
|
||||||
_openHistoryPanel(state){
|
|
||||||
state.isShowHistory = true
|
|
||||||
},
|
|
||||||
_closeHistoryPanel(state){
|
|
||||||
state.isShowHistory = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const state = {
|
|
||||||
connectionStatus: "disconnected", // live task updates
|
|
||||||
websocket: null, //websocket
|
|
||||||
|
|
||||||
totalGalleryTask: [], //存放数据的数组
|
|
||||||
chosenGallery: false, //准备下载
|
|
||||||
collectGallery: [], //收藏
|
|
||||||
downloadGallery: [], //下载
|
|
||||||
isSearch: false, //用于决定是否显示搜索结果
|
|
||||||
|
|
||||||
readingGallery: {'name': '', 'images': []}, //在线看
|
|
||||||
isReading: false, //是否正在看
|
|
||||||
|
|
||||||
currentGid: "", //当前GID
|
|
||||||
lengthPerPage: 0, //在线预览每页图片数量
|
|
||||||
|
|
||||||
page: 1, //当前页数
|
|
||||||
length: 5, //每页能有多少个链接
|
|
||||||
defaultLength: 4, //默认个数
|
|
||||||
shortLength: 5, //简洁个数
|
|
||||||
|
|
||||||
userId: -1, //用户id
|
|
||||||
username: "", //用户名
|
|
||||||
isAuth: false, //是否授权
|
|
||||||
AuthCode: '', //授权码
|
|
||||||
loadComplete: false, //是否加载完成
|
|
||||||
galleryRefreshTimer: 0, //更新计时器id
|
|
||||||
|
|
||||||
isInclude: false, //是否搜索到任务
|
|
||||||
searchTask: [], //搜索到的任务
|
|
||||||
isShowHistory: false, //是否打开面板
|
|
||||||
galleryNameType: 'shortName', //名字类型 shortName name
|
|
||||||
category: 'myDownload', //分类 myDownload myCollect total
|
|
||||||
sortType:'shortName', //排序类型 shortName name createTime
|
|
||||||
currentTasks: [], //当前任务
|
|
||||||
weekUsed: {}, //每周用量
|
|
||||||
}
|
|
||||||
|
|
||||||
const getters = {
|
|
||||||
currentTasks(state){
|
|
||||||
if(state.isSearch)
|
|
||||||
return state.searchTask.slice((state.page - 1) * state.length, state.page * state.length)
|
|
||||||
else
|
|
||||||
return state.currentTasks.slice((state.page - 1) * state.length, state.page * state.length)
|
|
||||||
},
|
|
||||||
min(){
|
|
||||||
return 1
|
|
||||||
},
|
|
||||||
max(state){
|
|
||||||
let max = 0
|
|
||||||
let tasks
|
|
||||||
if(state.isSearch)
|
|
||||||
tasks = state.searchTask
|
|
||||||
else
|
|
||||||
tasks = state.currentTasks
|
|
||||||
|
|
||||||
if(!tasks)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
max = Math.floor(tasks.length/state.length)
|
|
||||||
if(tasks.length % state.length !== 0 || max === 0)
|
|
||||||
max += 1
|
|
||||||
|
|
||||||
return max
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default new vuex.Store({
|
|
||||||
actions,
|
|
||||||
mutations,
|
|
||||||
state,
|
|
||||||
getters
|
|
||||||
})
|
|
||||||
|
|
||||||
function getShortname(name){
|
|
||||||
if(name === null)
|
|
||||||
return null
|
|
||||||
if (!name.includes("[")) return name
|
|
||||||
|
|
||||||
// 截取最后一个 [ 之前的部分,然后移除所有 [...] 和 (...) 标签
|
|
||||||
name = name.substring(0, name.lastIndexOf("["))
|
|
||||||
return name.replace(/\s*\[[^\]]*\]\s*/g, '').replace(/\s*\([^\)]*\)\s*/g, '').trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildGalleryDownloadUrl(gid, AuthCode){
|
|
||||||
let params = new URLSearchParams({AuthCode, gid: gid.toString()})
|
|
||||||
return GalleryManageUrl + "/file/" + gid + ".zip?" + params.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildGalleryManageUrl(path, params){
|
|
||||||
return GalleryManageUrl + path + "?" + new URLSearchParams(params).toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmCurrentTask(state){
|
|
||||||
switch (state.category){
|
|
||||||
case 'myDownload':
|
|
||||||
state.currentTasks = state.downloadGallery
|
|
||||||
break
|
|
||||||
case 'myCollect':
|
|
||||||
state.currentTasks = state.collectGallery
|
|
||||||
break
|
|
||||||
case 'total':
|
|
||||||
state.currentTasks = state.totalGalleryTask
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sortTasks(state){
|
|
||||||
switch (state.sortType) {
|
|
||||||
case "name":
|
|
||||||
state.currentTasks = state.currentTasks.sort((before, after) => {
|
|
||||||
return before.name > after.name ? 1: -1
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case "shortName":
|
|
||||||
state.currentTasks = state.currentTasks.sort((before, after) => {
|
|
||||||
return before.shortName > after.shortName ? 1: -1
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case "createTime":
|
|
||||||
state.currentTasks = state.currentTasks.sort((before, after) => {
|
|
||||||
return before.createTime - after.createTime
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteTask(tasks, key, value){
|
|
||||||
for(let j=0; j < tasks.length; j++)
|
|
||||||
for(let i=0; i<tasks[j].length; i++)
|
|
||||||
if(tasks[j][i][key] === value){
|
|
||||||
tasks[j].splice(i, 1)
|
|
||||||
i--
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let status = ['已提交', '下载中', '等待压缩', '压缩中', '下载完成']
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
function imageItem(url, index) {
|
|
||||||
return {url, src: url, index, attempt: 0, failed: false, settled: false}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function startImages(urls) {
|
|
||||||
return urls.length ? [imageItem(urls[0], 0)] : []
|
|
||||||
}
|
|
||||||
|
|
||||||
export function settleImage(items, urls, item, failed = false) {
|
|
||||||
// Ignore events from images removed by a page change or dialog close.
|
|
||||||
if (!items.includes(item)) return
|
|
||||||
item.failed = failed
|
|
||||||
if (item.settled) return
|
|
||||||
item.settled = true
|
|
||||||
if (items.length < urls.length)
|
|
||||||
items.push(imageItem(urls[items.length], items.length))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function retryImage(item) {
|
|
||||||
item.failed = false
|
|
||||||
item.attempt++
|
|
||||||
item.src = item.url + (item.url.includes('?') ? '&' : '?') + 'retry=' + item.attempt
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
export function createTaskSocket({url, onOpen, onMessage, onState,
|
|
||||||
createSocket = address => new WebSocket(address),
|
|
||||||
setTimer = setTimeout, clearTimer = clearTimeout}) {
|
|
||||||
let socket = null
|
|
||||||
let retryTimer
|
|
||||||
let connectTimer
|
|
||||||
let attempts = 0
|
|
||||||
let stopped = true
|
|
||||||
|
|
||||||
function detach() {
|
|
||||||
clearTimer(connectTimer)
|
|
||||||
connectTimer = undefined
|
|
||||||
if (socket) {
|
|
||||||
const previous = socket
|
|
||||||
socket = null
|
|
||||||
previous.onopen = previous.onclose = previous.onerror = previous.onmessage = null
|
|
||||||
try { previous.close() } catch { /* already closed */ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function schedule() {
|
|
||||||
if (stopped) return
|
|
||||||
onState('reconnecting')
|
|
||||||
const delay = Math.min(1000 * 2 ** attempts, 30000)
|
|
||||||
attempts = Math.min(attempts + 1, 5)
|
|
||||||
clearTimer(retryTimer)
|
|
||||||
retryTimer = setTimer(connect, delay)
|
|
||||||
}
|
|
||||||
|
|
||||||
function connect() {
|
|
||||||
if (stopped) return
|
|
||||||
clearTimer(retryTimer)
|
|
||||||
retryTimer = undefined
|
|
||||||
onState(attempts ? 'reconnecting' : 'connecting')
|
|
||||||
let current
|
|
||||||
try { current = socket = createSocket(url) }
|
|
||||||
catch { schedule(); return }
|
|
||||||
const retry = () => {
|
|
||||||
if (stopped || socket !== current) return
|
|
||||||
detach()
|
|
||||||
schedule()
|
|
||||||
}
|
|
||||||
current.onopen = () => {
|
|
||||||
if (stopped || socket !== current) return
|
|
||||||
clearTimer(connectTimer)
|
|
||||||
connectTimer = undefined
|
|
||||||
attempts = 0
|
|
||||||
try { current.send('DownloaderWebsocket') }
|
|
||||||
catch { retry(); return }
|
|
||||||
onState('connected')
|
|
||||||
onOpen()
|
|
||||||
}
|
|
||||||
current.onmessage = event => {
|
|
||||||
if (!stopped && socket === current) onMessage(event)
|
|
||||||
}
|
|
||||||
current.onclose = retry
|
|
||||||
current.onerror = retry
|
|
||||||
connectTimer = setTimer(retry, 10000)
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
start() {
|
|
||||||
if (!stopped) return
|
|
||||||
stopped = false
|
|
||||||
attempts = 0
|
|
||||||
connect()
|
|
||||||
},
|
|
||||||
stop() {
|
|
||||||
stopped = true
|
|
||||||
clearTimer(retryTimer)
|
|
||||||
retryTimer = undefined
|
|
||||||
detach()
|
|
||||||
onState('disconnected')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
export function validateLink(rawLink){
|
|
||||||
if(rawLink.trim() === "")
|
|
||||||
return false
|
|
||||||
if(rawLink.includes("hentai"))
|
|
||||||
return rawLink.includes("/g/")
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import test from 'node:test'
|
|
||||||
import assert from 'node:assert/strict'
|
|
||||||
import {startImages, settleImage, retryImage} from '../src/utils/progressiveImages.js'
|
|
||||||
|
|
||||||
test('a failed image does not prevent later pages from loading', () => {
|
|
||||||
const urls = ['first', 'second', 'third']
|
|
||||||
const items = startImages(urls)
|
|
||||||
settleImage(items, urls, items[0], true)
|
|
||||||
assert.equal(items[0].failed, true)
|
|
||||||
assert.equal(items[1].url, 'second')
|
|
||||||
settleImage(items, urls, items[1])
|
|
||||||
assert.equal(items[2].url, 'third')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('retry does not append a duplicate page and bypasses a failed URL cache', () => {
|
|
||||||
const urls = ['first?gid=1', 'second', 'third']
|
|
||||||
const items = startImages(urls)
|
|
||||||
settleImage(items, urls, items[0], true)
|
|
||||||
retryImage(items[0])
|
|
||||||
assert.equal(items[0].src, 'first?gid=1&retry=1')
|
|
||||||
settleImage(items, urls, items[0])
|
|
||||||
assert.equal(items.length, 2)
|
|
||||||
assert.equal(items[0].failed, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('late image events cannot append content after changing pages', () => {
|
|
||||||
const old = startImages(['old'])[0]
|
|
||||||
const urls = ['new', 'next']
|
|
||||||
const items = startImages(urls)
|
|
||||||
settleImage(items, urls, old)
|
|
||||||
assert.equal(items.length, 1)
|
|
||||||
assert.deepEqual(startImages([]), [])
|
|
||||||
})
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import test from "node:test"
|
||||||
|
import assert from "node:assert/strict"
|
||||||
|
import {buildSearchParams, fetchGalleries, readResponse} from "lionwebsite-frontend-shared"
|
||||||
|
|
||||||
|
test("keyword request never hand-builds the query string", () => {
|
||||||
|
assert.deepEqual(buildSearchParams({keyword: "cat girl"}), {keyword: "cat girl"})
|
||||||
|
})
|
||||||
|
|
||||||
|
test("next page forwards the upstream cursor instead of the keyword", () => {
|
||||||
|
const params = buildSearchParams({
|
||||||
|
keyword: "cat girl", direction: "next",
|
||||||
|
href: "https://exhentai.org/?f_search=cat+girl&next=777",
|
||||||
|
})
|
||||||
|
assert.equal(params.next, "777")
|
||||||
|
assert.equal(params.keyword, "cat girl")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("fetchGalleries decodes object and JSON-string payloads identically", async () => {
|
||||||
|
const asObject = {get: async () => ({data: {result: "success", data: [{gid: 1}], next: "n1"}})}
|
||||||
|
const asString = {get: async () => ({data: {result: "success", data: '[{"gid":1}]', next: "n1"}})}
|
||||||
|
const one = await fetchGalleries(asObject, {keyword: "k"})
|
||||||
|
const two = await fetchGalleries(asString, {keyword: "k"})
|
||||||
|
assert.deepEqual(one.galleries, two.galleries)
|
||||||
|
assert.equal(one.pagination.next, "n1")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("fetchGalleries surfaces the backend message on failure", async () => {
|
||||||
|
const http = {get: async () => ({data: {result: "failure", data: "没有搜索到结果"}})}
|
||||||
|
await assert.rejects(() => fetchGalleries(http, {keyword: "k"}),
|
||||||
|
error => error.payload === "没有搜索到结果")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("readResponse keeps all four pagination cursors", () => {
|
||||||
|
const parsed = readResponse({data: {result: "success", data: "[]",
|
||||||
|
first: "f", previous: "p", next: "n", last: "l"}})
|
||||||
|
assert.deepEqual(parsed.pagination, {first: "f", previous: "p", next: "n", last: "l"})
|
||||||
|
})
|
||||||
|
|
||||||
+75
-79
@@ -1,95 +1,91 @@
|
|||||||
import test from 'node:test'
|
import test from "node:test"
|
||||||
import assert from 'node:assert/strict'
|
import assert from "node:assert/strict"
|
||||||
import fs from 'node:fs'
|
|
||||||
import vm from 'node:vm'
|
|
||||||
|
|
||||||
function fixture() {
|
// 直接加载真实的移动端 store;在 Node 里 import 到的就是下发到浏览器的那份配置。
|
||||||
let code = fs.readFileSync(new URL('../src/store/index.js', import.meta.url), 'utf8')
|
const store = (await import("../src/store/index.js")).default
|
||||||
.replace(/^import .*$/gm, '')
|
|
||||||
.replace('export default new vuex.Store(', 'globalThis.store = new vuex.Store(')
|
const tasks = () => [
|
||||||
const messages = []
|
{gid: 1, name: "beta [tag]", status: "下载完成", pages: 10, proceeding: 10,
|
||||||
const showMessage = message => messages.push(message)
|
thumb_link: "", createTime: 2, downloader: 7, isCollect: true},
|
||||||
showMessage.error = message => messages.push(message)
|
{gid: 2, name: "alpha", status: "下载中", pages: 10, proceeding: 5,
|
||||||
const axios = {interceptors: {response: {use() {}}}}
|
thumb_link: "", createTime: 1, downloader: 7, isCollect: false},
|
||||||
const context = vm.createContext({axios, vuex: {Store: function (config) {Object.assign(this, config)}},
|
{gid: 3, name: "gamma", status: "已提交", pages: 10, proceeding: 0,
|
||||||
ElMessage: showMessage, URLSearchParams, console,
|
thumb_link: "", createTime: 3, downloader: 8, isCollect: false},
|
||||||
qs: {stringify: () => ''}})
|
]
|
||||||
vm.runInContext(code, context)
|
|
||||||
const store = context.store
|
function reset() {
|
||||||
const api = {state: store.state,
|
store.state.AuthCode = "test-auth"
|
||||||
commit: (name, data) => store.mutations[name](store.state, data),
|
store.state.userId = 7
|
||||||
dispatch: (name, data) => Promise.resolve(store.actions[name](api, data))}
|
store.state.category = "total"
|
||||||
return {store, messages, axios, api}
|
store.state.sortType = "createTime"
|
||||||
|
store.state.length = 2
|
||||||
|
store.state.visiblePages = 1
|
||||||
|
store.state.isAdmin = false
|
||||||
|
store.state.downloaderFilter = null
|
||||||
|
store.commit("_updateGalleryTasks", tasks())
|
||||||
}
|
}
|
||||||
|
|
||||||
test('link search matches a numeric gid and jumps to the right page', () => {
|
test("mobile variant shares one task list with the desktop core", () => {
|
||||||
const {store, messages} = fixture()
|
reset()
|
||||||
store.state.currentTasks = [{gid: 1}, {gid: 2}, {gid: 12345, name: 'sample', shortName: 'sample'}]
|
assert.equal(store.state.totalGalleryTask.length, 3)
|
||||||
store.state.length = 2
|
assert.equal(store.getters.downloadGallery.length, 2)
|
||||||
store.mutations._searchLocalByLink(store.state, 'https://example.org/g/12345/key/')
|
assert.equal(store.getters.collectGallery.length, 1)
|
||||||
assert.equal(store.state.page, 2)
|
|
||||||
assert.match(messages[0], /已跳转/)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('missing gid still reports no match', () => {
|
test("continue-loading reveals every task beyond the first page", () => {
|
||||||
const {store, messages} = fixture()
|
reset()
|
||||||
store.state.currentTasks = [{gid: 12345}]
|
assert.equal(store.getters.visibleTasks.length, 2)
|
||||||
store.mutations._searchLocalByLink(store.state, 'https://example.org/g/999/key/')
|
assert.equal(store.getters.taskRemaining, 1)
|
||||||
assert.equal(messages[0], '未找到此任务')
|
store.commit("_showMoreTasks")
|
||||||
|
assert.equal(store.getters.visibleTasks.length, 3)
|
||||||
|
assert.equal(store.getters.taskRemaining, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('submission reloads persisted status without duplicating a completed task', async () => {
|
test("json-string and object payloads decode to the same store result", () => {
|
||||||
const {store, axios, api} = fixture()
|
reset()
|
||||||
const gallery = {gid: 123, name: 'sample', status: '下载完成', thumb_link: '', createTime: 1, downloader: 7}
|
const fromObjects = store.state.totalGalleryTask.map(task => task.gid)
|
||||||
store.state.chosenGallery = {...gallery, status: '已提交'}
|
store.state.totalGalleryTask = []
|
||||||
store.state.totalGalleryTask.push(gallery)
|
store.commit("_updateGalleryTasks", JSON.parse(JSON.stringify(tasks())))
|
||||||
axios.post = async () => ({data: {result: 'success'}})
|
assert.deepEqual(store.state.totalGalleryTask.map(task => task.gid), fromObjects)
|
||||||
axios.get = async url => ({data: {result: 'success', data: JSON.stringify(url.endsWith('weekUsedAmount') ? {} : [gallery])}})
|
|
||||||
await store.actions.postGalleryTask(api, {targetResolution: 'original'})
|
|
||||||
assert.equal(store.state.totalGalleryTask.length, 1)
|
|
||||||
assert.equal(store.state.totalGalleryTask[0].status, '下载完成')
|
|
||||||
assert.equal(store.state.chosenGallery, false)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('gallery management subrequests carry the active auth code', async () => {
|
test("cancelling a collect for a task missing from the list never throws", () => {
|
||||||
const {store, axios, api} = fixture()
|
reset()
|
||||||
store.state.AuthCode = 'test-auth'
|
// 旧实现会在 collectGallery 里找不到 gid 时抛 TypeError。
|
||||||
let call
|
assert.doesNotThrow(() => store.commit("_setCollect", {gid: 999, collect: false}))
|
||||||
axios.post = async (...args) => {
|
store.commit("_setCollect", {gid: 1, collect: false})
|
||||||
call = args
|
assert.equal(store.getters.collectGallery.length, 0)
|
||||||
return {data: {result: args[0].endsWith('/cache') ? 'failure' : 'success', data: 'expected test response'}}
|
|
||||||
}
|
|
||||||
await store.actions.reconnect(api)
|
|
||||||
assert.equal(call[0], 'https://downloader.lionwebsite.xyz/GalleryManage/reconnect')
|
|
||||||
assert.equal(call[1], null)
|
|
||||||
assert.equal(call[2].params.AuthCode, 'test-auth')
|
|
||||||
|
|
||||||
await store.actions.readOnlineGallery(api, {link: 'https://example.org/g/1/key/', images: []})
|
|
||||||
assert.equal(call[0], 'https://downloader.lionwebsite.xyz/GalleryManage/cache')
|
|
||||||
assert.equal(call[1], null)
|
|
||||||
assert.deepEqual({...call[2].params}, {
|
|
||||||
url: 'https://example.org/g/1/key/',
|
|
||||||
AuthCode: 'test-auth'
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('thumbnail and online image URLs carry the active auth code', () => {
|
test("sorting never reorders the single source array", () => {
|
||||||
const {store} = fixture()
|
reset()
|
||||||
store.state.AuthCode = 'code with spaces'
|
const before = store.state.totalGalleryTask.map(task => task.gid)
|
||||||
store.mutations._updateGalleryTasks(store.state, [{
|
store.commit("_setSortType", "name")
|
||||||
gid: 123,
|
assert.deepEqual(store.state.totalGalleryTask.map(task => task.gid), before)
|
||||||
name: 'sample',
|
assert.deepEqual(store.getters.visibleTasks.map(task => task.name), ["alpha", "beta [tag]"])
|
||||||
status: '已提交',
|
})
|
||||||
thumb_link: 'https://example.org/thumb?a=1&b=2',
|
|
||||||
createTime: 1,
|
test("link search surfaces the match as a search result on mobile", () => {
|
||||||
downloader: 7
|
const messages = []
|
||||||
|
reset()
|
||||||
|
store.commit("_searchLocalByLink", "https://example.org/g/3/key/")
|
||||||
|
assert.equal(store.state.isSearch, true)
|
||||||
|
assert.equal(store.getters.searchResults.length, 1)
|
||||||
|
assert.equal(store.getters.searchResults[0].gid, 3)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("thumbnail and online image urls carry the active auth code", () => {
|
||||||
|
store.state.AuthCode = "code with spaces"
|
||||||
|
store.commit("_updateGalleryTasks", [{
|
||||||
|
gid: 123, name: "sample", status: "已提交",
|
||||||
|
thumb_link: "https://example.org/thumb?a=1&b=2", createTime: 1, downloader: 7,
|
||||||
}])
|
}])
|
||||||
const thumbnail = new URL(store.state.totalGalleryTask[0].thumb_link)
|
const thumbnail = new URL(store.state.totalGalleryTask[0].thumb_link)
|
||||||
assert.equal(thumbnail.searchParams.get('AuthCode'), 'code with spaces')
|
assert.equal(thumbnail.searchParams.get("AuthCode"), "code with spaces")
|
||||||
assert.equal(thumbnail.searchParams.get('path'), 'https://example.org/thumb?a=1&b=2')
|
assert.equal(thumbnail.searchParams.get("path"), "https://example.org/thumb?a=1&b=2")
|
||||||
|
|
||||||
store.mutations._setReadingGallery(store.state, {gid: 123, pages: 1})
|
store.commit("_setReadingGallery", {gid: 123, pages: 1})
|
||||||
const image = new URL(store.state.readingGallery.images[0])
|
const image = new URL(store.state.readingGallery.images[0])
|
||||||
assert.equal(image.searchParams.get('gid'), '123')
|
assert.equal(image.searchParams.get("gid"), "123")
|
||||||
assert.equal(image.searchParams.get('AuthCode'), 'code with spaces')
|
assert.equal(image.searchParams.get("AuthCode"), "code with spaces")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
import test from "node:test"
|
||||||
|
import assert from "node:assert/strict"
|
||||||
|
import fs from "node:fs"
|
||||||
|
import {registerHooks} from "node:module"
|
||||||
|
import {compileScript, parse} from "@vue/compiler-sfc"
|
||||||
|
import {createRenderer, nextTick} from "vue"
|
||||||
|
import {ehThumbnailUrl} from "lionwebsite-frontend-shared"
|
||||||
|
|
||||||
|
// 移动端详情抽屉的“打开/模式”状态只存在于真实组件里,store 单测覆盖不到。
|
||||||
|
// 这里用编译期 loader hook 直接执行仓库中的 .vue 源码,再挂到最小渲染器上;
|
||||||
|
// 开关与模式都落在普通 DOM 属性上,因此不需要 jsdom/happy-dom。
|
||||||
|
registerHooks({
|
||||||
|
load(url, context, nextLoad) {
|
||||||
|
if (!url.endsWith("/TaskDetailSheet.vue")) return nextLoad(url, context)
|
||||||
|
const source = fs.readFileSync(new URL(url), "utf8")
|
||||||
|
const {descriptor, errors} = parse(source, {filename: url})
|
||||||
|
assert.deepEqual(errors, [], "SFC 解析必须无错")
|
||||||
|
return {
|
||||||
|
format: "module",
|
||||||
|
shortCircuit: true,
|
||||||
|
source: compileScript(descriptor, {id: "sheet-test", inlineTemplate: true, isProd: false}).content,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const {default: TaskDetailSheet} = await import("../src/components/TaskDetailSheet.vue")
|
||||||
|
const store = (await import("../src/store/index.js")).default
|
||||||
|
|
||||||
|
// 最小渲染器:只需要能插入节点、读回属性、处理 v-show 的 style。
|
||||||
|
function fakeElement(tag) {
|
||||||
|
return {nodeType: 1, tag, children: [], parentNode: null, style: {}, attrs: {}, listeners: {}}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nodeOps() {
|
||||||
|
const remove = node => {
|
||||||
|
const parent = node.parentNode
|
||||||
|
if (!parent) return
|
||||||
|
const index = parent.children.indexOf(node)
|
||||||
|
if (index >= 0) parent.children.splice(index, 1)
|
||||||
|
node.parentNode = null
|
||||||
|
}
|
||||||
|
const insert = (node, parent, anchor = null) => {
|
||||||
|
if (node.parentNode) remove(node)
|
||||||
|
const index = anchor ? parent.children.indexOf(anchor) : -1
|
||||||
|
if (index >= 0) parent.children.splice(index, 0, node)
|
||||||
|
else parent.children.push(node)
|
||||||
|
node.parentNode = parent
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
insert,
|
||||||
|
remove,
|
||||||
|
createElement: fakeElement,
|
||||||
|
createText: text => ({nodeType: 3, text, parentNode: null}),
|
||||||
|
createComment: text => ({nodeType: 8, text, parentNode: null}),
|
||||||
|
setText: (node, text) => { node.text = text },
|
||||||
|
setElementText: (node, text) => { node.children = [{nodeType: 3, text, parentNode: node}] },
|
||||||
|
parentNode: node => node.parentNode,
|
||||||
|
nextSibling: node => {
|
||||||
|
const parent = node.parentNode
|
||||||
|
if (!parent) return null
|
||||||
|
const index = parent.children.indexOf(node)
|
||||||
|
return parent.children[index + 1] || null
|
||||||
|
},
|
||||||
|
querySelector: () => null,
|
||||||
|
setScopeId: (el, id) => { el.scopeId = id },
|
||||||
|
cloneNode: el => ({...fakeElement(el.tag), attrs: {...el.attrs}}),
|
||||||
|
insertStaticContent: (content, parent, anchor) => {
|
||||||
|
const node = fakeElement("static")
|
||||||
|
insert(node, parent, anchor)
|
||||||
|
return [node, node]
|
||||||
|
},
|
||||||
|
patchProp: (el, key, previous, next) => {
|
||||||
|
if (key === "style") el.style = next || {}
|
||||||
|
else if (/^on[A-Z]/.test(key)) el.listeners[key] = next
|
||||||
|
else el.attrs[key] = next
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mountSheet() {
|
||||||
|
const app = createRenderer(nodeOps()).createApp(TaskDetailSheet)
|
||||||
|
// 真实入口在 main.js 里全局注册 Element Plus;这里只需要占位节点。
|
||||||
|
app.component("el-progress", {render: () => null})
|
||||||
|
const root = fakeElement("root")
|
||||||
|
app.mount(root)
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
|
||||||
|
function descendants(node, out = []) {
|
||||||
|
for (const child of node.children || []) {
|
||||||
|
if (child.nodeType === 1) {
|
||||||
|
out.push(child)
|
||||||
|
descendants(child, out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function findByClass(root, className) {
|
||||||
|
return descendants(root).find(node => node.attrs.class === className) || null
|
||||||
|
}
|
||||||
|
|
||||||
|
function textOf(root) {
|
||||||
|
const parts = []
|
||||||
|
const walk = node => {
|
||||||
|
if (node.nodeType === 3) { parts.push(node.text); return }
|
||||||
|
for (const child of node.children || []) walk(child)
|
||||||
|
}
|
||||||
|
walk(root)
|
||||||
|
return parts.join(" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
function isOpen(root) {
|
||||||
|
const layer = findByClass(root, "sheet-layer")
|
||||||
|
assert.ok(layer, "抽屉根节点必须存在")
|
||||||
|
// v-show 只在关闭时写 display: none。
|
||||||
|
return layer.style.display !== "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
const taskGallery = () => ({
|
||||||
|
gid: 5, name: "本地任务", status: "已提交", pages: 10, proceeding: 0,
|
||||||
|
thumb_link: "", createTime: 1, downloader: 7,
|
||||||
|
})
|
||||||
|
const remoteGallery = () => ({
|
||||||
|
gid: 9, name: "远端画廊", link: "https://example.org/g/9/k/", thumbnailUrl: "/t/9.jpg",
|
||||||
|
})
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
store.state.AuthCode = "auth"
|
||||||
|
store.state.userId = 7
|
||||||
|
store.state.detailGallery = null
|
||||||
|
store.state.chosenGallery = false
|
||||||
|
}
|
||||||
|
|
||||||
|
test("清空 detailGallery 会关上任务态抽屉", async () => {
|
||||||
|
reset()
|
||||||
|
const root = mountSheet()
|
||||||
|
store.state.detailGallery = taskGallery()
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), true)
|
||||||
|
assert.match(textOf(root), /本地任务/)
|
||||||
|
|
||||||
|
store.state.detailGallery = null
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), false)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("清空 chosenGallery 会关上远端态抽屉并复位模式", async () => {
|
||||||
|
reset()
|
||||||
|
const root = mountSheet()
|
||||||
|
store.state.chosenGallery = remoteGallery()
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), true)
|
||||||
|
assert.match(textOf(root), /远端画廊/)
|
||||||
|
|
||||||
|
store.state.chosenGallery = false
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), false)
|
||||||
|
|
||||||
|
// 模式必须回到 task,否则下一次打开任务会渲染成远端面板。
|
||||||
|
store.state.detailGallery = taskGallery()
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), true)
|
||||||
|
assert.match(textOf(root), /删除任务/)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("远端态下 detailGallery 变空不得误关抽屉", async () => {
|
||||||
|
reset()
|
||||||
|
const root = mountSheet()
|
||||||
|
store.state.chosenGallery = remoteGallery()
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), true)
|
||||||
|
|
||||||
|
// 任务流的 detail 被清空(例如列表刷新),此时屏幕上的是远端画廊,必须保持打开。
|
||||||
|
store.state.detailGallery = null
|
||||||
|
await nextTick()
|
||||||
|
assert.equal(isOpen(root), true)
|
||||||
|
assert.match(textOf(root), /远端画廊/)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("已规范化的 thumb_link 直接使用,不再二次代理", async () => {
|
||||||
|
reset()
|
||||||
|
const root = mountSheet()
|
||||||
|
const proxied = ehThumbnailUrl("/t/9.jpg", "auth")
|
||||||
|
store.state.chosenGallery = {
|
||||||
|
...remoteGallery(), thumb_link: proxied, thumbnailUrl: "https://example.org/raw.jpg",
|
||||||
|
}
|
||||||
|
await nextTick()
|
||||||
|
const image = descendants(root).find(node => node.tag === "img")
|
||||||
|
assert.ok(image, "远端态必须渲染缩略图")
|
||||||
|
assert.equal(image.attrs.src, proxied)
|
||||||
|
assert.equal(image.attrs.src.split("ehThumbnail").length - 1, 1)
|
||||||
|
// 外层 path 仍是原始图片路径,没有被嵌套成代理 URL。
|
||||||
|
assert.equal(new URL(image.attrs.src).searchParams.get("path"), "/t/9.jpg")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("只有原始上游地址时才在这里代理一次", async () => {
|
||||||
|
reset()
|
||||||
|
const root = mountSheet()
|
||||||
|
store.state.chosenGallery = {...remoteGallery(), thumbnailUrl: "https://example.org/raw.jpg"}
|
||||||
|
await nextTick()
|
||||||
|
const image = descendants(root).find(node => node.tag === "img")
|
||||||
|
assert.ok(image)
|
||||||
|
assert.equal(image.attrs.src, ehThumbnailUrl("https://example.org/raw.jpg", "auth"))
|
||||||
|
assert.equal(new URL(image.attrs.src).searchParams.get("path"), "https://example.org/raw.jpg")
|
||||||
|
})
|
||||||
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import test from 'node:test'
|
|
||||||
import assert from 'node:assert/strict'
|
|
||||||
import {createTaskSocket} from '../src/utils/taskSocket.js'
|
|
||||||
|
|
||||||
function fixture() {
|
|
||||||
const sockets = [], states = [], messages = [], timers = new Map()
|
|
||||||
let id = 0, opens = 0
|
|
||||||
const manager = createTaskSocket({url: 'wss://example.invalid',
|
|
||||||
onOpen: () => opens++, onState: value => states.push(value), onMessage: event => messages.push(event.data),
|
|
||||||
setTimer: (fn, delay) => { timers.set(++id, {fn, delay}); return id },
|
|
||||||
clearTimer: key => timers.delete(key),
|
|
||||||
createSocket: () => {
|
|
||||||
const socket = {sent: [], send(value) { this.sent.push(value) }, close() { this.closed = true }}
|
|
||||||
sockets.push(socket)
|
|
||||||
return socket
|
|
||||||
}
|
|
||||||
})
|
|
||||||
function tick(delay) {
|
|
||||||
const entry = [...timers].find(([, timer]) => timer.delay === delay)
|
|
||||||
assert.ok(entry, `expected timer ${delay}`)
|
|
||||||
timers.delete(entry[0]); entry[1].fn()
|
|
||||||
}
|
|
||||||
return {manager, sockets, states, messages, timers, tick, opens: () => opens}
|
|
||||||
}
|
|
||||||
|
|
||||||
test('reconnects and refreshes after each successful connection', () => {
|
|
||||||
const f = fixture(); f.manager.start()
|
|
||||||
f.sockets[0].onopen()
|
|
||||||
assert.deepEqual(f.sockets[0].sent, ['DownloaderWebsocket'])
|
|
||||||
f.sockets[0].onclose()
|
|
||||||
f.tick(1000)
|
|
||||||
f.sockets[1].onopen()
|
|
||||||
assert.equal(f.opens(), 2)
|
|
||||||
assert.equal(f.states.at(-1), 'connected')
|
|
||||||
assert.equal(f.timers.size, 0)
|
|
||||||
f.manager.stop()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('backs off and times out connection attempts', () => {
|
|
||||||
const f = fixture(); f.manager.start()
|
|
||||||
f.tick(10000)
|
|
||||||
assert.equal(f.sockets[0].closed, true)
|
|
||||||
f.tick(1000); f.sockets[1].onerror(); f.tick(2000)
|
|
||||||
f.sockets[2].onerror(); f.tick(4000)
|
|
||||||
assert.equal(f.sockets.length, 4)
|
|
||||||
f.manager.stop()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('stop cancels timers and ignores callbacks from replaced sockets', () => {
|
|
||||||
const f = fixture(); f.manager.start()
|
|
||||||
const oldOpen = f.sockets[0].onopen, oldMessage = f.sockets[0].onmessage
|
|
||||||
f.sockets[0].onerror()
|
|
||||||
f.manager.stop()
|
|
||||||
assert.equal(f.timers.size, 0)
|
|
||||||
f.manager.start()
|
|
||||||
oldOpen(); oldMessage({data: 'stale'})
|
|
||||||
assert.equal(f.opens(), 0)
|
|
||||||
assert.deepEqual(f.messages, [])
|
|
||||||
f.sockets[1].onopen()
|
|
||||||
f.sockets[1].onmessage({data: 'current'})
|
|
||||||
assert.deepEqual(f.messages, ['current'])
|
|
||||||
f.manager.stop()
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user