mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42e1aa73e2 | ||
|
|
26fde22af2 | ||
|
|
798f39d54f | ||
|
|
3a21dfac38 | ||
|
|
e8355b88b9 | ||
|
|
379660236d | ||
|
|
c86ee91c27 | ||
|
|
ff9d253242 | ||
|
|
53b45e00ba | ||
|
|
247b12a525 | ||
|
|
7a8d332e6e | ||
|
|
749a6f18d2 | ||
|
|
4107048f12 | ||
|
|
f5d9ab85a2 |
@@ -1,5 +1,37 @@
|
||||
# Changelog
|
||||
|
||||
## [3.2.1] - 2021-01-12
|
||||
### Added
|
||||
- Add settings for connection timeout
|
||||
- Add settings for maximum attempts
|
||||
### Changed
|
||||
- Enhance posts rename logic
|
||||
- Dependencies update
|
||||
- Switch reactive from rx-java to reactor
|
||||
|
||||
## [3.2.0] - 2020-11-16
|
||||
### Changed
|
||||
- Fix build issue
|
||||
|
||||
## [3.1.0] - 2020-11-16
|
||||
### Changed
|
||||
- UI revamp
|
||||
- Fix bugs
|
||||
|
||||
## [3.0.11] - 2020-10-31
|
||||
### Added
|
||||
- Support for vipr.im
|
||||
|
||||
## [3.0.10] - 2020-10-04
|
||||
### Changed
|
||||
- Fix bug on settings update
|
||||
|
||||
## [3.0.9] - 2020-09-27
|
||||
### Changed
|
||||
- Revert to appending post id to download folders
|
||||
- Fix a bug that lead to adding duplicate posts
|
||||
- Remove old unused settings
|
||||
|
||||
## [3.0.8] - 2020-08-22
|
||||
### Changed
|
||||
- Bug fix which breaks concurrent downloads
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.8</version>
|
||||
<version>3.2.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.0.RELEASE</version>
|
||||
<version>2.4.1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<modules>
|
||||
@@ -17,4 +17,4 @@
|
||||
<module>vripper-ui</module>
|
||||
<module>vripper-electron</module>
|
||||
</modules>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
Generated
+247
-280
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "3.0.8",
|
||||
"version": "3.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -64,9 +64,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/fs-extra": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.1.tgz",
|
||||
"integrity": "sha512-B42Sxuaz09MhC3DDeW5kubRcQ5by4iuVQ0cRRWM2lggLzAa/KVom0Aft/208NgMvNQQZ86s5rVcqDdn/SH0/mg==",
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.2.tgz",
|
||||
"integrity": "sha512-jp0RI6xfZpi5JL8v7WQwpBEQTq63RqW2kxwTZt+m27LcJqQdPVU1yGnT1ZI4EtCDynQQJtIGyQahkiCGCS7e+A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
@@ -78,9 +78,9 @@
|
||||
"integrity": "sha512-V8wj+w2YMNvGuhgl/MA5fmTxgjmVHVoasfIaxMMZJV6Y8Kk+Ydpi1z2whoShDCJ2BuNVoqH/h1hrygnBxkrw/Q=="
|
||||
},
|
||||
"@types/yargs": {
|
||||
"version": "15.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz",
|
||||
"integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==",
|
||||
"version": "15.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz",
|
||||
"integrity": "sha512-HmU8SeIRhZCWcnRskCs36Q1Q00KBV6Cqh/ora8WN1+22dY07AZdn6Gel8QZ3t26XYPImtcL8WV/eqjhVmMEw4g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/yargs-parser": "*"
|
||||
@@ -93,9 +93,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.12.3",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
|
||||
"integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
@@ -105,9 +105,9 @@
|
||||
}
|
||||
},
|
||||
"ajv-keywords": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.1.tgz",
|
||||
"integrity": "sha512-KWcq3xN8fDjSB+IMoh2VaXVhRI0BBGxoYp3rx7Pkb6z0cFjYR9Q9l4yZqqals0/zsioCmocC5H6UvsGD4MoIBA==",
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-align": {
|
||||
@@ -148,29 +148,29 @@
|
||||
}
|
||||
},
|
||||
"app-builder-bin": {
|
||||
"version": "3.5.9",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.5.9.tgz",
|
||||
"integrity": "sha512-NSjtqZ3x2kYiDp3Qezsgukx/AUzKPr3Xgf9by4cYt05ILWGAptepeeu0Uv+7MO+41o6ujhLixTou8979JGg2Kg==",
|
||||
"version": "3.5.10",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.5.10.tgz",
|
||||
"integrity": "sha512-Jd+GW68lR0NeetgZDo47PdWBEPdnD+p0jEa7XaxjRC8u6Oo/wgJsfKUkORRgr2NpkD19IFKN50P6JYy04XHFLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"app-builder-lib": {
|
||||
"version": "22.7.0",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-22.7.0.tgz",
|
||||
"integrity": "sha512-blRKwV8h0ztualXS50ciCTo39tbuDGNS+ldcy8+KLvKXuT6OpYnSJ7M6MSfPT+xWatshMHJV1rJx3Tl+k/Sn/g==",
|
||||
"version": "22.9.1",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-22.9.1.tgz",
|
||||
"integrity": "sha512-KfXim/fiNwFW2SKffsjEMdAU7RbbEXn62x5YyXle1b4j9X/wEHW9iwox8De6y0hJdR+/kCC/49lI+VgNwLhV7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~5.0.3",
|
||||
"@develar/schema-utils": "~2.6.5",
|
||||
"async-exit-hook": "^2.0.1",
|
||||
"bluebird-lst": "^1.0.9",
|
||||
"builder-util": "22.7.0",
|
||||
"builder-util-runtime": "8.7.1",
|
||||
"builder-util": "22.9.1",
|
||||
"builder-util-runtime": "8.7.2",
|
||||
"chromium-pickle-js": "^0.2.0",
|
||||
"debug": "^4.2.0",
|
||||
"ejs": "^3.1.3",
|
||||
"electron-publish": "22.7.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"hosted-git-info": "^3.0.4",
|
||||
"debug": "^4.3.0",
|
||||
"ejs": "^3.1.5",
|
||||
"electron-publish": "22.9.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"hosted-git-info": "^3.0.5",
|
||||
"is-ci": "^2.0.0",
|
||||
"isbinaryfile": "^4.0.6",
|
||||
"js-yaml": "^3.14.0",
|
||||
@@ -184,9 +184,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.0.tgz",
|
||||
"integrity": "sha512-jjO6JD2rKfiZQnBoRzhRTbXjHLGLfH+UtGkWLc/UXAh/rzZMyjbgn0NcfFpqT8nd1kTtFnDiJcrIFkq4UKeJVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
@@ -205,13 +205,21 @@
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
@@ -263,11 +271,11 @@
|
||||
"dev": true
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
|
||||
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"requires": {
|
||||
"follow-redirects": "1.5.10"
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
@@ -358,20 +366,20 @@
|
||||
"dev": true
|
||||
},
|
||||
"builder-util": {
|
||||
"version": "22.7.0",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-22.7.0.tgz",
|
||||
"integrity": "sha512-UV3MKL0mwjMq2y9JlBf28Cegpj0CrIXcjGkO0TXn+QZ6Yy9rY6lHOuUvpQ19ct2Qh1o+QSwH3Q1nKUf5viJBBg==",
|
||||
"version": "22.9.1",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-22.9.1.tgz",
|
||||
"integrity": "sha512-5hN/XOaYu4ZQUS6F+5CXE6jTo+NAnVqAxDuKGSaHWb9bejfv/rluChTLoY3/nJh7RFjkoyVjvFJv7zQDB1QmHw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~5.0.3",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"app-builder-bin": "3.5.9",
|
||||
"app-builder-bin": "3.5.10",
|
||||
"bluebird-lst": "^1.0.9",
|
||||
"builder-util-runtime": "8.7.1",
|
||||
"chalk": "^4.0.0",
|
||||
"debug": "^4.2.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"builder-util-runtime": "8.7.2",
|
||||
"chalk": "^4.1.0",
|
||||
"debug": "^4.3.0",
|
||||
"fs-extra": "^9.0.1",
|
||||
"is-ci": "^2.0.0",
|
||||
"js-yaml": "^3.14.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
@@ -380,9 +388,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.0.tgz",
|
||||
"integrity": "sha512-jjO6JD2rKfiZQnBoRzhRTbXjHLGLfH+UtGkWLc/UXAh/rzZMyjbgn0NcfFpqT8nd1kTtFnDiJcrIFkq4UKeJVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
@@ -401,13 +409,21 @@
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
@@ -419,24 +435,13 @@
|
||||
}
|
||||
},
|
||||
"builder-util-runtime": {
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.7.1.tgz",
|
||||
"integrity": "sha512-uEBH1nAnTvzjcsrh2XI3qOzJ39h0+9kuIuwj+kCc3a07TZNGShfJcai8fFzL3mNgGjEFxoq+XMssR11r+FOFSg==",
|
||||
"version": "8.7.2",
|
||||
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.7.2.tgz",
|
||||
"integrity": "sha512-xBqv+8bg6cfnzAQK1k3OGpfaHg+QkPgIgpEkXNhouZ0WiUkyZCftuRc2LYzQrLucFywpa14Xbc6+hTbpq83yRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^4.2.0",
|
||||
"debug": "^4.1.1",
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cacheable-request": {
|
||||
@@ -455,9 +460,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"get-stream": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
|
||||
"integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
@@ -513,9 +518,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"cli-boxes": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz",
|
||||
"integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz",
|
||||
"integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==",
|
||||
"dev": true
|
||||
},
|
||||
"cli-truncate": {
|
||||
@@ -528,14 +533,14 @@
|
||||
}
|
||||
},
|
||||
"cliui": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.3.tgz",
|
||||
"integrity": "sha512-Gj3QHTkVMPKqwP3f7B4KPkBZRMR9r4rfi5bXFpg1a+Svvj8l7q5CnkBkVQzfxT5DFSsGk2+PascOgL0JYkL2kw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wrap-ansi": "^6.2.0"
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
@@ -660,20 +665,14 @@
|
||||
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
|
||||
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"decamelize": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||
"dev": true
|
||||
},
|
||||
"decompress-response": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||
@@ -713,15 +712,15 @@
|
||||
"optional": true
|
||||
},
|
||||
"dmg-builder": {
|
||||
"version": "22.7.0",
|
||||
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-22.7.0.tgz",
|
||||
"integrity": "sha512-5Ea2YEz6zSNbyGzZD+O9/MzmaXb6oa15cSKWo4JQ1xP4rorOpte7IOj2jcwYjtc+Los2gu1lvT314OC1OZIWgg==",
|
||||
"version": "22.9.1",
|
||||
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-22.9.1.tgz",
|
||||
"integrity": "sha512-jc+DAirqmQrNT6KbDHdfEp8D1kD0DBTnsLhwUR3MX+hMBun5bT134LQzpdK0GKvd22GqF8L1Cz/NOgaVjscAXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"app-builder-lib": "22.7.0",
|
||||
"builder-util": "22.7.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"iconv-lite": "^0.5.1",
|
||||
"app-builder-lib": "22.9.1",
|
||||
"builder-util": "22.9.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"iconv-lite": "^0.6.2",
|
||||
"js-yaml": "^3.14.0",
|
||||
"sanitize-filename": "^1.6.3"
|
||||
},
|
||||
@@ -739,13 +738,21 @@
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
@@ -788,9 +795,9 @@
|
||||
}
|
||||
},
|
||||
"dot-prop": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
|
||||
"integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==",
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
|
||||
"integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-obj": "^2.0.0"
|
||||
@@ -815,18 +822,18 @@
|
||||
"dev": true
|
||||
},
|
||||
"ejs": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.3.tgz",
|
||||
"integrity": "sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg==",
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.5.tgz",
|
||||
"integrity": "sha512-dldq3ZfFtgVTJMLjOe+/3sROTzALlL9E34V4/sDtUd/KlBSS0s6U1/+WPE1B4sj9CXHJpL1M6rhNJnc9Wbal9w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jake": "^10.6.1"
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-9.1.0.tgz",
|
||||
"integrity": "sha512-VRAF8KX1m0py9I9sf0kw1kWfeC87mlscfFcbcRdLBsNJ44/GrJhi3+E8rKbpHUeZNQxsPaVA5Zu5Lxb6dV/scQ==",
|
||||
"version": "11.1.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-11.1.1.tgz",
|
||||
"integrity": "sha512-tlbex3xosJgfileN6BAQRotevPRXB/wQIq48QeQ08tUJJrXwE72c8smsM/hbHx5eDgnbfJ2G3a60PmRjHU2NhA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^1.0.1",
|
||||
@@ -835,33 +842,33 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.12.50",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.50.tgz",
|
||||
"integrity": "sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==",
|
||||
"version": "12.19.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.3.tgz",
|
||||
"integrity": "sha512-8Jduo8wvvwDzEVJCOvS/G6sgilOLvvhn1eMmK3TW8/T217O7u1jdrK6ImKLv80tVryaPSVeKu6sjDEiFjd4/eg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"electron-builder": {
|
||||
"version": "22.7.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-22.7.0.tgz",
|
||||
"integrity": "sha512-t6E3oMutpST64YWbZCg7HodEwJOsnjUF1vnDIHm2MW6CFZPX8tlCK6efqaV66LU0E0Nkp/JH6TE5bCqQ1+VdPQ==",
|
||||
"version": "22.9.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-22.9.1.tgz",
|
||||
"integrity": "sha512-GXPt8l5Mxwm1QKYopUM6/Tdh9W3695G6Ax+IFyj5pQ51G4SD5L1uq4/RkPSsOgs3rP7jNSV6g6OfDzdtVufPdA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/yargs": "^15.0.5",
|
||||
"app-builder-lib": "22.7.0",
|
||||
"app-builder-lib": "22.9.1",
|
||||
"bluebird-lst": "^1.0.9",
|
||||
"builder-util": "22.7.0",
|
||||
"builder-util-runtime": "8.7.1",
|
||||
"chalk": "^4.0.0",
|
||||
"dmg-builder": "22.7.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"builder-util": "22.9.1",
|
||||
"builder-util-runtime": "8.7.2",
|
||||
"chalk": "^4.1.0",
|
||||
"dmg-builder": "22.9.1",
|
||||
"fs-extra": "^9.0.1",
|
||||
"is-ci": "^2.0.0",
|
||||
"lazy-val": "^1.0.4",
|
||||
"read-config-file": "6.0.0",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"update-notifier": "^4.1.0",
|
||||
"yargs": "^15.3.1"
|
||||
"update-notifier": "^4.1.1",
|
||||
"yargs": "^16.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": {
|
||||
@@ -877,13 +884,21 @@
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
@@ -920,19 +935,19 @@
|
||||
"integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw=="
|
||||
},
|
||||
"electron-publish": {
|
||||
"version": "22.7.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.7.0.tgz",
|
||||
"integrity": "sha512-hmU69xlb6vvAV3QfpHYDlkdZMFdBAgDbptoxbLFrnTq5bOkcL8AaDbvxeoZ4+lvqgs29NwqGpkHo2oN+p/hCfg==",
|
||||
"version": "22.9.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.9.1.tgz",
|
||||
"integrity": "sha512-ducLjRJLEeU87FaTCWaUyDjCoLXHkawkltP2zqS/n2PyGke54ZIql0tBuUheht4EpR8AhFbVJ11spSn1gy8r6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"bluebird-lst": "^1.0.9",
|
||||
"builder-util": "22.7.0",
|
||||
"builder-util-runtime": "8.7.1",
|
||||
"chalk": "^4.0.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"builder-util": "22.9.1",
|
||||
"builder-util-runtime": "8.7.2",
|
||||
"chalk": "^4.1.0",
|
||||
"fs-extra": "^9.0.1",
|
||||
"lazy-val": "^1.0.4",
|
||||
"mime": "^2.4.5"
|
||||
"mime": "^2.4.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": {
|
||||
@@ -948,13 +963,21 @@
|
||||
}
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
|
||||
"integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^1.0.0"
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"universalify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
|
||||
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
@@ -1005,6 +1028,12 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"escalade": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
|
||||
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-goat": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz",
|
||||
@@ -1099,38 +1128,10 @@
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
||||
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
||||
"requires": {
|
||||
"debug": "=3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
}
|
||||
}
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
@@ -1148,6 +1149,12 @@
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
@@ -1254,6 +1261,15 @@
|
||||
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
|
||||
"dev": true
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
@@ -1267,9 +1283,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.5.tgz",
|
||||
"integrity": "sha512-i4dpK6xj9BIpVOTboXIlKG9+8HMKggcrMX7WA24xZtKwX0TPelq/rbaS5rCKeNX8sJXZJGdSxpnEGtta+wismQ==",
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.7.tgz",
|
||||
"integrity": "sha512-fWqc0IcuXs+BmE9orLDyVykAG9GJtGLGuZAAqgcckPgv5xad4AcXGIv8galtQvlwutxSlaMcdw7BUtq2EIvqCQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lru-cache": "^6.0.0"
|
||||
@@ -1315,12 +1331,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz",
|
||||
"integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==",
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz",
|
||||
"integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
},
|
||||
"import-lazy": {
|
||||
@@ -1350,9 +1366,9 @@
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||
"dev": true
|
||||
},
|
||||
"is-ci": {
|
||||
@@ -1364,6 +1380,15 @@
|
||||
"ci-info": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz",
|
||||
"integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
@@ -1568,15 +1593,6 @@
|
||||
"integrity": "sha512-u93kb2fPbIrfzBuLjZE+w+fJbUUMhNDXxNmMfaqNgpfQf1CO5ZSe2LfsnBqVAk7i/2NF48OSoRj+Xe2VT+lE8Q==",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
@@ -1747,30 +1763,6 @@
|
||||
"integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==",
|
||||
"dev": true
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"dev": true
|
||||
},
|
||||
"package-json": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
|
||||
@@ -1918,9 +1910,9 @@
|
||||
}
|
||||
},
|
||||
"registry-auth-token": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz",
|
||||
"integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz",
|
||||
"integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"rc": "^1.2.8"
|
||||
@@ -1941,18 +1933,13 @@
|
||||
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
|
||||
"dev": true
|
||||
},
|
||||
"require-main-filename": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
|
||||
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
|
||||
"version": "1.18.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz",
|
||||
"integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-core-module": "^2.0.0",
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
@@ -1974,13 +1961,13 @@
|
||||
}
|
||||
},
|
||||
"roarr": {
|
||||
"version": "2.15.3",
|
||||
"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.3.tgz",
|
||||
"integrity": "sha512-AEjYvmAhlyxOeB9OqPUzQCo3kuAkNfuDk/HqWbZdFsqDFpapkTjiw+p4svNEoRLvuqNTxqfL+s+gtD4eDgZ+CA==",
|
||||
"version": "2.15.4",
|
||||
"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
|
||||
"integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"boolean": "^3.0.0",
|
||||
"boolean": "^3.0.1",
|
||||
"detect-node": "^2.0.4",
|
||||
"globalthis": "^1.0.1",
|
||||
"json-stringify-safe": "^5.0.1",
|
||||
@@ -2054,12 +2041,6 @@
|
||||
"type-fest": "^0.13.1"
|
||||
}
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
@@ -2142,9 +2123,9 @@
|
||||
}
|
||||
},
|
||||
"spdx-license-ids": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
|
||||
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz",
|
||||
"integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
@@ -2229,9 +2210,9 @@
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
|
||||
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
@@ -2248,9 +2229,9 @@
|
||||
}
|
||||
},
|
||||
"term-size": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz",
|
||||
"integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz",
|
||||
"integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==",
|
||||
"dev": true
|
||||
},
|
||||
"to-readable-stream": {
|
||||
@@ -2322,9 +2303,9 @@
|
||||
}
|
||||
},
|
||||
"update-notifier": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz",
|
||||
"integrity": "sha512-w3doE1qtI0/ZmgeoDoARmI5fjDoT93IfKgEGqm26dGUOh8oNpaSTsGNdYRN/SjOuo10jcJGwkEL3mroKzktkew==",
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz",
|
||||
"integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boxen": "^4.2.0",
|
||||
@@ -2355,9 +2336,9 @@
|
||||
}
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
||||
"integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
@@ -2398,12 +2379,6 @@
|
||||
"spdx-expression-parse": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"which-module": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
|
||||
"dev": true
|
||||
},
|
||||
"widest-line": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz",
|
||||
@@ -2414,9 +2389,9 @@
|
||||
}
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
@@ -2465,9 +2440,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"y18n": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
|
||||
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz",
|
||||
"integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==",
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
@@ -2477,33 +2452,25 @@
|
||||
"dev": true
|
||||
},
|
||||
"yargs": {
|
||||
"version": "15.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||
"version": "16.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.1.0.tgz",
|
||||
"integrity": "sha512-upWFJOmDdHN0syLuESuvXDmrRcWd1QafJolHskzaw79uZa7/x53gxQKiR07W59GWY1tFhhU/Th9DrtSfpS782g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cliui": "^6.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^4.1.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"cliui": "^7.0.2",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^4.2.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^18.1.2"
|
||||
"y18n": "^5.0.2",
|
||||
"yargs-parser": "^20.2.2"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "18.1.3",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
||||
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
}
|
||||
"version": "20.2.3",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.3.tgz",
|
||||
"integrity": "sha512-emOFRT9WVHw03QSvN5qor9QQT9+sw5vwxfYweivSMHTcAXPefwVae2FjO7JJjj8hCE4CzPOPeFM83VwT29HCww==",
|
||||
"dev": true
|
||||
},
|
||||
"yauzl": {
|
||||
"version": "2.10.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "3.0.8",
|
||||
"version": "3.2.1",
|
||||
"description": "A ripper for vipergirls.to built using web technolgies",
|
||||
"main": "main.js",
|
||||
"author": "death-claw <53543762+death-claw@users.noreply.github.com>",
|
||||
@@ -65,11 +65,11 @@
|
||||
"dist": "node pre-build.js && electron-builder"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "9.1.0",
|
||||
"electron-builder": "22.7.0"
|
||||
"electron": "11.1.1",
|
||||
"electron-builder": "22.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "0.19.2",
|
||||
"axios": "0.21.1",
|
||||
"cheerio": "1.0.0-rc.3",
|
||||
"copy-dir": "1.3.0",
|
||||
"electron-context-menu": "2.1.0",
|
||||
|
||||
+71
-71
@@ -1,77 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.8</version>
|
||||
</parent>
|
||||
<artifactId>vripper-electron</artifactId>
|
||||
<name>vripper-electron</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<classifier>${buildClassifier}</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>electron</id>
|
||||
<properties>
|
||||
<buildClassifier>electron</buildClassifier>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
<classifier>${buildClassifier}</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<artifactId>vripper-electron</artifactId>
|
||||
<name>vripper-electron</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
<nodeVersion>v12.2.0</nodeVersion>
|
||||
<npmVersion>6.9.0</npmVersion>
|
||||
<workingDirectory>build-dir</workingDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm run build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<arguments>run dist</arguments>
|
||||
<classifier>${buildClassifier}</classifier>
|
||||
</configuration>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>electron</id>
|
||||
<properties>
|
||||
<buildClassifier>electron</buildClassifier>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
<classifier>${buildClassifier}</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
<nodeVersion>v12.2.0</nodeVersion>
|
||||
<npmVersion>6.9.0</npmVersion>
|
||||
<workingDirectory>build-dir</workingDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm run build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run dist</arguments>
|
||||
</configuration>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@ const cheerio = require('cheerio');
|
||||
const fs = require('fs');
|
||||
const rimraf = require("rimraf");
|
||||
const copydir = require("copy-dir");
|
||||
const { execSync } = require("child_process");
|
||||
const {execSync} = require("child_process");
|
||||
|
||||
rimraf.sync('./build/vripper-ui');
|
||||
copydir.sync('../vripper-ui/dist/vripper-ui', './build/vripper-ui', {});
|
||||
@@ -19,7 +19,7 @@ fs.writeFileSync('./build/vripper-ui/index.html', $.html());
|
||||
console.log('Building runtime environment');
|
||||
rimraf.sync('java-runtime');
|
||||
execSync('jlink --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.desktop,java.instrument,java.management,java.naming,java.prefs,java.rmi,java.scripting,java.security.jgss,java.sql,jdk.httpserver,jdk.unsupported,jdk.crypto.ec --output java-runtime');
|
||||
if(process.platform === 'linux') {
|
||||
if (process.platform === 'linux') {
|
||||
console.log('Stripping libjvm.so');
|
||||
execSync('strip -p --strip-unneeded java-runtime/lib/server/libjvm.so');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.8</version>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<name>vripper-server</name>
|
||||
@@ -72,9 +72,8 @@
|
||||
<version>2.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.reactivex.rxjava2</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
<version>2.2.6</version>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.jodah</groupId>
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
package tn.mnlr.vripper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.RetryPolicy;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@SpringBootApplication
|
||||
@Slf4j
|
||||
public class VripperApplication {
|
||||
|
||||
public static final RetryPolicy<Object> retryPolicy = new RetryPolicy<>()
|
||||
.withDelay(1, 3, ChronoUnit.SECONDS)
|
||||
.withMaxAttempts(5)
|
||||
.onFailedAttempt(e -> log.warn(String.format("#%d tries failed", e.getAttemptCount()), e.getLastFailure()));
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(SpringContext::close));
|
||||
|
||||
+49
-50
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.q;
|
||||
package tn.mnlr.vripper.download;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,6 +23,7 @@ import javax.imageio.ImageReader;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
@@ -31,41 +32,20 @@ import java.util.*;
|
||||
@Slf4j
|
||||
public class DownloadJob implements CheckedRunnable {
|
||||
|
||||
public enum ContextAttributes {
|
||||
OPEN_CONNECTION("OPEN_CONNECTION");
|
||||
|
||||
private final String value;
|
||||
|
||||
ContextAttributes(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Byte LOCK = 0;
|
||||
private static final Object LOCK = new Object();
|
||||
private static final int READ_BUFFER_SIZE = 8192;
|
||||
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
private final ConnectionManager cm;
|
||||
private final VipergirlsAuthService authService;
|
||||
private final ConnectionService cm;
|
||||
private final VGAuthService authService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final AppSettingsService appSettingsService;
|
||||
|
||||
private final SettingsService settingsService;
|
||||
private final HttpClientContext context;
|
||||
|
||||
@Getter
|
||||
private final Image image;
|
||||
|
||||
@Getter
|
||||
private final Post post;
|
||||
|
||||
private boolean stopped = false;
|
||||
|
||||
@Getter
|
||||
private boolean finished = false;
|
||||
|
||||
@@ -74,10 +54,10 @@ public class DownloadJob implements CheckedRunnable {
|
||||
this.post = post;
|
||||
dataService = SpringContext.getBean(DataService.class);
|
||||
pathService = SpringContext.getBean(PathService.class);
|
||||
cm = SpringContext.getBean(ConnectionManager.class);
|
||||
authService = SpringContext.getBean(VipergirlsAuthService.class);
|
||||
cm = SpringContext.getBean(ConnectionService.class);
|
||||
authService = SpringContext.getBean(VGAuthService.class);
|
||||
downloadSpeedService = SpringContext.getBean(DownloadSpeedService.class);
|
||||
appSettingsService = SpringContext.getBean(AppSettingsService.class);
|
||||
settingsService = SpringContext.getBean(SettingsService.class);
|
||||
context = HttpClientContext.create();
|
||||
context.setCookieStore(new BasicCookieStore());
|
||||
context.setAttribute(ContextAttributes.OPEN_CONNECTION.toString(), Collections.synchronizedList(new ArrayList<AbstractExecutionAwareRequest>()));
|
||||
@@ -97,8 +77,16 @@ public class DownloadJob implements CheckedRunnable {
|
||||
post.setStatus(Status.DOWNLOADING);
|
||||
dataService.updatePostStatus(post.getStatus(), post.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// The post may be updated and the download directory might be set by another thread
|
||||
Post updatedPost = dataService.findById(post.getId()).orElseThrow();
|
||||
if (updatedPost.getDownloadDirectory() == null) {
|
||||
pathService.createDefaultPostFolder(updatedPost);
|
||||
}
|
||||
if (settingsService.getSettings().getLeaveThanksOnStart()) {
|
||||
authService.leaveThanks(updatedPost);
|
||||
}
|
||||
}
|
||||
|
||||
if (stopped) {
|
||||
return;
|
||||
@@ -135,16 +123,7 @@ public class DownloadJob implements CheckedRunnable {
|
||||
if (stopped) {
|
||||
return;
|
||||
}
|
||||
File destinationFolder;
|
||||
synchronized (LOCK) {
|
||||
Post updatedPost = dataService.findPostById(post.getId()).orElseThrow();
|
||||
if (updatedPost.getPostFolderName() == null) {
|
||||
pathService.createDefaultPostFolder(updatedPost);
|
||||
}
|
||||
destinationFolder = pathService.getDownloadDestinationFolder(updatedPost);
|
||||
authService.leaveThanks(updatedPost);
|
||||
}
|
||||
File outputFile = new File(destinationFolder.getPath() + File.separator + String.format("%03d_", image.getIndex()) + nameAndUrl.getName() + ".tmp");
|
||||
File outputFile = Files.createTempFile("vripper", "tmp").toFile();
|
||||
try (InputStream downloadStream = response.getEntity().getContent(); FileOutputStream fos = new FileOutputStream(outputFile)) {
|
||||
|
||||
if (stopped) {
|
||||
@@ -171,7 +150,7 @@ public class DownloadJob implements CheckedRunnable {
|
||||
return;
|
||||
}
|
||||
}
|
||||
checkImageTypeAndRename(dataService.findPostById(post.getId()).orElseThrow(), outputFile, nameAndUrl.getName(), image.getIndex());
|
||||
checkImageTypeAndRename(dataService.findById(post.getId()).orElseThrow(), outputFile, nameAndUrl.getName(), image.getIndex());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (stopped) {
|
||||
@@ -179,7 +158,7 @@ public class DownloadJob implements CheckedRunnable {
|
||||
}
|
||||
throw new DownloadException(e);
|
||||
} finally {
|
||||
if (image.getCurrent() == image.getTotal()) {
|
||||
if (image.getCurrent() == image.getTotal() && image.getTotal() > 0) {
|
||||
image.setStatus(Status.COMPLETE);
|
||||
} else if (stopped) {
|
||||
image.setStatus(Status.STOPPED);
|
||||
@@ -198,7 +177,7 @@ public class DownloadJob implements CheckedRunnable {
|
||||
throw new HostException("Image file is not recognized!");
|
||||
}
|
||||
ImageReader reader = it.next();
|
||||
if (reader.getFormatName().toUpperCase().equals("JPEG")) {
|
||||
if (reader.getFormatName().equalsIgnoreCase("JPEG")) {
|
||||
String imageNameLC = imageName.toLowerCase();
|
||||
if (!imageNameLC.endsWith("_jpg") && !imageNameLC.endsWith("_jpeg")) {
|
||||
imageName += ".jpg";
|
||||
@@ -213,7 +192,7 @@ public class DownloadJob implements CheckedRunnable {
|
||||
imageName = imageName.substring(0, imageName.length() - toReplace.length()) + ".jpg";
|
||||
}
|
||||
}
|
||||
} else if (reader.getFormatName().toUpperCase().equals("PNG")) {
|
||||
} else if (reader.getFormatName().equalsIgnoreCase("PNG")) {
|
||||
String imageNameLC = imageName.toLowerCase();
|
||||
if (!imageNameLC.endsWith("_png")) {
|
||||
imageName += ".png";
|
||||
@@ -231,14 +210,19 @@ public class DownloadJob implements CheckedRunnable {
|
||||
throw new HostException("Failed to guess image format", e);
|
||||
}
|
||||
try {
|
||||
File downloadDestinationFolder = pathService.getDownloadDestinationFolder(post);
|
||||
File outImage = new File(downloadDestinationFolder, (appSettingsService.getSettings().getForceOrder() ? String.format("%03d_", index) : "") + imageName);
|
||||
if (outImage.exists() && outImage.delete()) {
|
||||
log.debug(String.format("%s is deleted", outImage.toString()));
|
||||
}
|
||||
Files.move(outputFile.toPath(), outImage.toPath(), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
|
||||
pathService.getDirectoryAccess().lock();
|
||||
File downloadDestinationFolder = pathService.calcDownloadDirectory(post);
|
||||
File outImage = new File(downloadDestinationFolder, (settingsService.getSettings().getForceOrder() ? String.format("%03d_", index) : "") + imageName);
|
||||
Files.copy(outputFile.toPath(), outImage.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (Exception e) {
|
||||
throw new HostException("Failed to rename the image", e);
|
||||
} finally {
|
||||
pathService.getDirectoryAccess().unlock();
|
||||
try {
|
||||
Files.delete(outputFile.toPath());
|
||||
} catch (IOException e) {
|
||||
log.warn(String.format("Failed to delete temporary file %s", outputFile.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,4 +259,19 @@ public class DownloadJob implements CheckedRunnable {
|
||||
}
|
||||
this.stopped = true;
|
||||
}
|
||||
|
||||
public enum ContextAttributes {
|
||||
OPEN_CONNECTION("OPEN_CONNECTION");
|
||||
|
||||
private final String value;
|
||||
|
||||
ContextAttributes(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-8
@@ -1,29 +1,31 @@
|
||||
package tn.mnlr.vripper.q;
|
||||
package tn.mnlr.vripper.download;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.Failsafe;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.VripperApplication;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
|
||||
@Slf4j
|
||||
public class ExecuteRunnable implements Runnable {
|
||||
public class DownloadRunnable implements Runnable {
|
||||
|
||||
private final ExecutionService executionService;
|
||||
private final DownloadService downloadService;
|
||||
private final DataService dataService;
|
||||
private final ConnectionService connectionService;
|
||||
|
||||
private final DownloadJob downloadJob;
|
||||
|
||||
public ExecuteRunnable(final DownloadJob downloadJob) {
|
||||
executionService = SpringContext.getBean(ExecutionService.class);
|
||||
public DownloadRunnable(final DownloadJob downloadJob) {
|
||||
downloadService = SpringContext.getBean(DownloadService.class);
|
||||
dataService = SpringContext.getBean(DataService.class);
|
||||
connectionService = SpringContext.getBean(ConnectionService.class);
|
||||
this.downloadJob = downloadJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Failsafe.with(VripperApplication.retryPolicy)
|
||||
Failsafe.with(connectionService.getRetryPolicy())
|
||||
.onFailure(e -> {
|
||||
log.error(String.format("Failed to download %s after %d tries", downloadJob.getImage().getUrl(), e.getAttemptCount()), e.getFailure());
|
||||
downloadJob.getImage().setStatus(Status.ERROR);
|
||||
@@ -31,7 +33,7 @@ public class ExecuteRunnable implements Runnable {
|
||||
})
|
||||
.onComplete(e -> {
|
||||
dataService.afterJobFinish(downloadJob.getImage(), downloadJob.getPost());
|
||||
executionService.afterJobFinish(downloadJob);
|
||||
downloadService.afterJobFinish(downloadJob);
|
||||
log.debug(String.format("Finished downloading %s", downloadJob.getImage().getUrl()));
|
||||
}).run(downloadJob);
|
||||
}
|
||||
+17
-19
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.q;
|
||||
package tn.mnlr.vripper.download;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -8,19 +8,18 @@ import tn.mnlr.vripper.host.Host;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.services.AppSettingsService;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.post.PostService;
|
||||
import tn.mnlr.vripper.services.PostService;
|
||||
import tn.mnlr.vripper.services.SettingsService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExecutionService {
|
||||
public class DownloadService {
|
||||
|
||||
private static final List<Status> FINISHED = Arrays.asList(Status.ERROR, Status.COMPLETE, Status.STOPPED);
|
||||
private final int MAX_POOL_SIZE = 12;
|
||||
@@ -30,8 +29,8 @@ public class ExecutionService {
|
||||
private final BlockingQueue<DownloadJob> executionQueue = new LinkedBlockingQueue<>();
|
||||
private final List<DownloadJob> executing = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
private final PendingQ pendingQ;
|
||||
private final AppSettingsService settings;
|
||||
private final PendingQueue pendingQueue;
|
||||
private final SettingsService settings;
|
||||
private final DataService dataService;
|
||||
private final PostService postService;
|
||||
|
||||
@@ -40,8 +39,8 @@ public class ExecutionService {
|
||||
private Thread pollThread;
|
||||
|
||||
@Autowired
|
||||
public ExecutionService(PendingQ pendingQ, AppSettingsService settings, DataService dataService, PostService postService) {
|
||||
this.pendingQ = pendingQ;
|
||||
public DownloadService(PendingQueue pendingQueue, SettingsService settings, DataService dataService, PostService postService) {
|
||||
this.pendingQueue = pendingQueue;
|
||||
this.settings = settings;
|
||||
this.dataService = dataService;
|
||||
this.postService = postService;
|
||||
@@ -55,8 +54,7 @@ public class ExecutionService {
|
||||
executionThread.start();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() throws InterruptedException {
|
||||
public void destroy() throws Exception {
|
||||
log.info("Shutting down ExecutionService");
|
||||
executionThread.interrupt();
|
||||
pollThread.interrupt();
|
||||
@@ -65,7 +63,7 @@ public class ExecutionService {
|
||||
log.debug(String.format("Stopping download jobs for %s", p));
|
||||
this.stopRunning(p.getPostId());
|
||||
});
|
||||
executor.awaitTermination(10, TimeUnit.SECONDS);
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void stopRunning(@NonNull String postId) {
|
||||
@@ -121,7 +119,7 @@ public class ExecutionService {
|
||||
log.debug(String.format("Restarting %d jobs for post id %s", images.size(), postId));
|
||||
for (Image image : images) {
|
||||
try {
|
||||
pendingQ.put(post, image);
|
||||
pendingQueue.put(post, image);
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Thread was interrupted", e);
|
||||
Thread.currentThread().interrupt();
|
||||
@@ -130,7 +128,7 @@ public class ExecutionService {
|
||||
}
|
||||
|
||||
private boolean isPending(String postId) {
|
||||
return pendingQ.isPending(postId);
|
||||
return pendingQueue.isPending(postId);
|
||||
}
|
||||
|
||||
private void stop(String postId) {
|
||||
@@ -143,7 +141,7 @@ public class ExecutionService {
|
||||
if (FINISHED.contains(post.getStatus())) {
|
||||
return;
|
||||
}
|
||||
pendingQ.stop(post);
|
||||
pendingQueue.stop(post);
|
||||
stopRunning(postId);
|
||||
dataService.stopImagesByPostIdAndIsNotCompleted(postId);
|
||||
dataService.finishPost(post);
|
||||
@@ -170,11 +168,11 @@ public class ExecutionService {
|
||||
private void poll() {
|
||||
while (!Thread.interrupted()) {
|
||||
try {
|
||||
List<DownloadJob> peek = pendingQ.peek();
|
||||
List<DownloadJob> peek = pendingQueue.peek();
|
||||
for (DownloadJob downloadJob : peek) {
|
||||
if (canRun(downloadJob.getImage().getHost())) {
|
||||
executionQueue.offer(downloadJob);
|
||||
pendingQ.remove(downloadJob);
|
||||
pendingQueue.remove(downloadJob);
|
||||
}
|
||||
}
|
||||
synchronized (threadCount) {
|
||||
@@ -203,12 +201,12 @@ public class ExecutionService {
|
||||
|
||||
private void push(DownloadJob downloadJob) {
|
||||
log.debug(String.format("Scheduling a job for %s", downloadJob.getImage().getUrl()));
|
||||
executor.execute(new ExecuteRunnable(downloadJob));
|
||||
executor.execute(new DownloadRunnable(downloadJob));
|
||||
executing.add(downloadJob);
|
||||
}
|
||||
|
||||
public synchronized void afterJobFinish(DownloadJob downloadJob) {
|
||||
int count = pendingQ.decrement(downloadJob.getPost().getPostId());
|
||||
int count = pendingQueue.decrement(downloadJob.getPost().getPostId());
|
||||
if (count == 0) {
|
||||
dataService.finishPost(downloadJob.getPost());
|
||||
}
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.q;
|
||||
package tn.mnlr.vripper.download;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -6,8 +6,8 @@ import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.host.Host;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.services.AppSettingsService;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.SettingsService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
@@ -19,19 +19,19 @@ import java.util.function.Predicate;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PendingQ {
|
||||
public class PendingQueue {
|
||||
|
||||
private final DataService dataService;
|
||||
private final AppSettingsService appSettingsService;
|
||||
private final SettingsService settingsService;
|
||||
private final List<Host> hosts;
|
||||
|
||||
private final ConcurrentHashMap<Host, BlockingDeque<DownloadJob>> pendingQ = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, AtomicInteger> toBeExecuted = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
public PendingQ(DataService dataService, AppSettingsService appSettingsService, List<Host> hosts) {
|
||||
public PendingQueue(DataService dataService, SettingsService settingsService, List<Host> hosts) {
|
||||
this.dataService = dataService;
|
||||
this.appSettingsService = appSettingsService;
|
||||
this.settingsService = settingsService;
|
||||
this.hosts = hosts;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class PendingQ {
|
||||
}
|
||||
for (Host host : hosts) {
|
||||
Iterator<DownloadJob> it = pendingQ.get(host).iterator();
|
||||
for (int i = 0; i < appSettingsService.getSettings().getMaxThreads(); i++) {
|
||||
for (int i = 0; i < settingsService.getSettings().getMaxThreads(); i++) {
|
||||
DownloadJob downloadJob = it.hasNext() ? it.next() : null;
|
||||
if (downloadJob != null) {
|
||||
downloadJobs.add(downloadJob);
|
||||
@@ -0,0 +1,15 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class ImageUpdateEvent extends ApplicationEvent {
|
||||
|
||||
private final Long id;
|
||||
|
||||
public ImageUpdateEvent(Object source, Long id) {
|
||||
super(source);
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class MetadataUpdateEvent extends ApplicationEvent {
|
||||
|
||||
private final Long id;
|
||||
private final Long postIdRef;
|
||||
|
||||
public MetadataUpdateEvent(Object source, Long id, Long postIdRef) {
|
||||
super(source);
|
||||
this.id = id;
|
||||
this.postIdRef = postIdRef;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class PostRemoveEvent extends ApplicationEvent {
|
||||
|
||||
private final String postId;
|
||||
|
||||
public PostRemoveEvent(Object source, String postId) {
|
||||
super(source);
|
||||
this.postId = postId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class PostUpdateEvent extends ApplicationEvent {
|
||||
|
||||
private final Long id;
|
||||
|
||||
public PostUpdateEvent(Object source, Long id) {
|
||||
super(source);
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class QueuedRemoveEvent extends ApplicationEvent {
|
||||
|
||||
private final String threadId;
|
||||
|
||||
public QueuedRemoveEvent(Object source, String threadId) {
|
||||
super(source);
|
||||
this.threadId = threadId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package tn.mnlr.vripper.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class QueuedUpdateEvent extends ApplicationEvent {
|
||||
|
||||
private final Long id;
|
||||
|
||||
public QueuedUpdateEvent(Object source, Long id) {
|
||||
super(source);
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,6 @@ public class HostException extends Exception {
|
||||
}
|
||||
|
||||
public HostException(String message, Throwable e) {
|
||||
super(message,e);
|
||||
super(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package tn.mnlr.vripper.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RenameException extends Exception {
|
||||
|
||||
public RenameException(String message, IOException e) {
|
||||
super(message, e);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.exception.HostException;
|
||||
import tn.mnlr.vripper.exception.XpathException;
|
||||
import tn.mnlr.vripper.services.ConnectionManager;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.HostService;
|
||||
import tn.mnlr.vripper.services.HtmlProcessorService;
|
||||
import tn.mnlr.vripper.services.XpathService;
|
||||
@@ -31,14 +31,14 @@ public class AcidimgHost extends Host {
|
||||
private static final String CONTINUE_BUTTON_XPATH = "//input[@id='continuebutton']";
|
||||
private static final String IMG_XPATH = "//img[@class='centred']";
|
||||
|
||||
private final ConnectionManager cm;
|
||||
private final ConnectionService cm;
|
||||
private final HostService hostService;
|
||||
private final XpathService xpathService;
|
||||
private final HtmlProcessorService htmlProcessorService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public AcidimgHost(ConnectionManager cm, HostService hostService, XpathService xpathService, HtmlProcessorService htmlProcessorService) {
|
||||
public AcidimgHost(ConnectionService cm, HostService hostService, XpathService xpathService, HtmlProcessorService htmlProcessorService) {
|
||||
this.cm = cm;
|
||||
this.hostService = hostService;
|
||||
this.xpathService = xpathService;
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.exception.HostException;
|
||||
import tn.mnlr.vripper.exception.HtmlProcessorException;
|
||||
import tn.mnlr.vripper.exception.XpathException;
|
||||
import tn.mnlr.vripper.services.ConnectionManager;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.HostService;
|
||||
import tn.mnlr.vripper.services.HtmlProcessorService;
|
||||
import tn.mnlr.vripper.services.XpathService;
|
||||
@@ -29,12 +29,12 @@ public class ImageBamHost extends Host {
|
||||
private static final String IMG_XPATH = "//img[@class='image']";
|
||||
|
||||
private final HostService hostService;
|
||||
private final ConnectionManager cm;
|
||||
private final ConnectionService cm;
|
||||
private final XpathService xpathService;
|
||||
private final HtmlProcessorService htmlProcessorService;
|
||||
|
||||
@Autowired
|
||||
public ImageBamHost(HostService hostService, ConnectionManager cm, XpathService xpathService, HtmlProcessorService htmlProcessorService) {
|
||||
public ImageBamHost(HostService hostService, ConnectionService cm, XpathService xpathService, HtmlProcessorService htmlProcessorService) {
|
||||
this.hostService = hostService;
|
||||
this.cm = cm;
|
||||
this.xpathService = xpathService;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.exception.HostException;
|
||||
import tn.mnlr.vripper.exception.HtmlProcessorException;
|
||||
import tn.mnlr.vripper.exception.XpathException;
|
||||
import tn.mnlr.vripper.services.ConnectionManager;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.HostService;
|
||||
import tn.mnlr.vripper.services.HtmlProcessorService;
|
||||
import tn.mnlr.vripper.services.XpathService;
|
||||
@@ -35,11 +35,11 @@ public class ImxHost extends Host {
|
||||
|
||||
private final HostService hostService;
|
||||
private final XpathService xpathService;
|
||||
private final ConnectionManager cm;
|
||||
private final ConnectionService cm;
|
||||
private final HtmlProcessorService htmlProcessorService;
|
||||
|
||||
@Autowired
|
||||
public ImxHost(HostService hostService, XpathService xpathService, ConnectionManager cm, HtmlProcessorService htmlProcessorService) {
|
||||
public ImxHost(HostService hostService, XpathService xpathService, ConnectionService cm, HtmlProcessorService htmlProcessorService) {
|
||||
this.hostService = hostService;
|
||||
this.xpathService = xpathService;
|
||||
this.cm = cm;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package tn.mnlr.vripper.host;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.exception.HostException;
|
||||
import tn.mnlr.vripper.exception.XpathException;
|
||||
import tn.mnlr.vripper.services.HostService;
|
||||
import tn.mnlr.vripper.services.XpathService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ViprImHost extends Host {
|
||||
|
||||
private static final String IMG_XPATH = "//img[contains(@class, 'img')]";
|
||||
private static final String host = "vipr.im";
|
||||
|
||||
private final HostService hostService;
|
||||
private final XpathService xpathService;
|
||||
|
||||
@Autowired
|
||||
public ViprImHost(HostService hostService, XpathService xpathService) {
|
||||
this.hostService = hostService;
|
||||
this.xpathService = xpathService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLookup() {
|
||||
return host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostService.NameUrl getNameAndUrl(final String url, final HttpClientContext context) throws HostException {
|
||||
|
||||
Document doc = hostService.getResponse(url, context).getDocument();
|
||||
|
||||
Node imgNode;
|
||||
try {
|
||||
log.debug(String.format("Looking for xpath expression %s in %s", IMG_XPATH, url));
|
||||
imgNode = xpathService.getAsNode(doc, IMG_XPATH);
|
||||
} catch (XpathException e) {
|
||||
throw new HostException(e);
|
||||
}
|
||||
|
||||
try {
|
||||
log.debug(String.format("Resolving name and image url for %s", url));
|
||||
String imgTitle = Optional.ofNullable(imgNode.getAttributes().getNamedItem("alt")).map(Node::getTextContent).map(String::trim).orElse(null);
|
||||
String imgUrl = imgNode.getAttributes().getNamedItem("src").getTextContent().trim();
|
||||
|
||||
return new HostService.NameUrl(imgTitle, imgUrl);
|
||||
} catch (Exception e) {
|
||||
throw new HostException("Unexpected error occurred", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package tn.mnlr.vripper.jpa;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tn.mnlr.vripper.download.DownloadService;
|
||||
import tn.mnlr.vripper.services.ThreadPoolService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -25,13 +27,28 @@ public class Management {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final String backupFolder;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final DownloadService downloadService;
|
||||
|
||||
@Autowired
|
||||
public Management(JdbcTemplate jdbcTemplate, @Value("${base.dir}") String baseDir, @Value("${base.dir.name}") String baseDirName) {
|
||||
public Management(JdbcTemplate jdbcTemplate, @Value("${base.dir}") String baseDir, @Value("${base.dir.name}") String baseDirName, ThreadPoolService threadPoolService, DownloadService downloadService) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.downloadService = downloadService;
|
||||
this.backupFolder = baseDir + File.separator + baseDirName + File.separator + "backup";
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
|
||||
try {
|
||||
threadPoolService.destroy();
|
||||
downloadService.destroy();
|
||||
this.jdbcTemplate.execute("SHUTDOWN");
|
||||
} catch (Exception ignored) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@Scheduled(cron = "0 0 0 ? * *")
|
||||
private void backup() {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Post {
|
||||
private String securityToken;
|
||||
|
||||
@JsonIgnore
|
||||
private String postFolderName;
|
||||
private String downloadDirectory;
|
||||
|
||||
private boolean thanked;
|
||||
|
||||
|
||||
@@ -10,14 +10,12 @@ public interface IPostRepository extends IRepository {
|
||||
|
||||
Post save(Post post);
|
||||
|
||||
int delete(Long id);
|
||||
|
||||
Optional<Post> findByPostId(String postId);
|
||||
|
||||
List<String> findCompleted();
|
||||
|
||||
Optional<Post> findById(Long id);
|
||||
|
||||
List<String> findCompleted();
|
||||
|
||||
List<Post> findAll();
|
||||
|
||||
boolean existByPostId(String postId);
|
||||
|
||||
@@ -2,5 +2,5 @@ package tn.mnlr.vripper.jpa.repositories;
|
||||
|
||||
public interface IRepository {
|
||||
|
||||
public void init();
|
||||
void init();
|
||||
}
|
||||
|
||||
+28
-16
@@ -1,8 +1,11 @@
|
||||
package tn.mnlr.vripper.jpa.repositories.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.event.ImageUpdateEvent;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.jpa.repositories.IImageRepository;
|
||||
@@ -12,10 +15,11 @@ import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Service
|
||||
public class ImageRepository implements IImageRepository {
|
||||
public class ImageRepository implements IImageRepository, ApplicationEventPublisherAware {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final AtomicLong counter = new AtomicLong(0);
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Autowired
|
||||
public ImageRepository(JdbcTemplate jdbcTemplate) {
|
||||
@@ -50,6 +54,7 @@ public class ImageRepository implements IImageRepository {
|
||||
image.getPostIdRef()
|
||||
);
|
||||
image.setId(id);
|
||||
applicationEventPublisher.publishEvent(new ImageUpdateEvent(ImageRepository.class, id));
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -62,9 +67,8 @@ public class ImageRepository implements IImageRepository {
|
||||
public List<Image> findByPostId(String postId) {
|
||||
return jdbcTemplate.query(
|
||||
"SELECT * FROM IMAGE WHERE POST_ID = ?",
|
||||
new Object[]{postId},
|
||||
new ImageRowMapper()
|
||||
);
|
||||
new ImageRowMapper(),
|
||||
postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,9 +83,8 @@ public class ImageRepository implements IImageRepository {
|
||||
public List<Image> findByPostIdAndIsNotCompleted(String postId) {
|
||||
return jdbcTemplate.query(
|
||||
"SELECT * FROM IMAGE AS image WHERE image.POST_ID = ? AND image.STATUS <> 'COMPLETE'",
|
||||
new Object[]{postId},
|
||||
new ImageRowMapper()
|
||||
);
|
||||
new ImageRowMapper(),
|
||||
postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,18 +99,16 @@ public class ImageRepository implements IImageRepository {
|
||||
public List<Image> findByPostIdAndIsError(String postId) {
|
||||
return jdbcTemplate.query(
|
||||
"SELECT * FROM IMAGE AS image WHERE image.POST_ID = ? AND image.STATUS = 'ERROR'",
|
||||
new Object[]{postId},
|
||||
new ImageRowMapper()
|
||||
);
|
||||
new ImageRowMapper(),
|
||||
postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Image> findById(Long id) {
|
||||
List<Image> images = jdbcTemplate.query(
|
||||
"SELECT * FROM IMAGE AS image WHERE image.ID = ?",
|
||||
new Object[]{id},
|
||||
new ImageRowMapper()
|
||||
);
|
||||
new ImageRowMapper(),
|
||||
id);
|
||||
if (images.isEmpty()) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -117,25 +118,36 @@ public class ImageRepository implements IImageRepository {
|
||||
|
||||
@Override
|
||||
public int updateStatus(Status status, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE IMAGE AS image SET image.STATUS = ? WHERE image.ID = ?",
|
||||
status.name(), id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new ImageUpdateEvent(ImageRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCurrent(long current, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE IMAGE AS image SET image.CURRENT = ? WHERE image.ID = ?",
|
||||
current, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new ImageUpdateEvent(ImageRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateTotal(long total, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE IMAGE AS image SET image.TOTAL = ? WHERE image.ID = ?",
|
||||
total, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new ImageUpdateEvent(ImageRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-2
@@ -1,8 +1,11 @@
|
||||
package tn.mnlr.vripper.jpa.repositories.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.event.MetadataUpdateEvent;
|
||||
import tn.mnlr.vripper.jpa.domain.Metadata;
|
||||
import tn.mnlr.vripper.jpa.repositories.IMetadataRepository;
|
||||
|
||||
@@ -11,10 +14,11 @@ import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Service
|
||||
public class MetadataRepository implements IMetadataRepository {
|
||||
public class MetadataRepository implements IMetadataRepository, ApplicationEventPublisherAware {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final AtomicLong counter = new AtomicLong(0);
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Autowired
|
||||
public MetadataRepository(JdbcTemplate jdbcTemplate) {
|
||||
@@ -44,6 +48,7 @@ public class MetadataRepository implements IMetadataRepository {
|
||||
metadata.getPostIdRef()
|
||||
);
|
||||
metadata.setId(id);
|
||||
applicationEventPublisher.publishEvent(new MetadataUpdateEvent(MetadataRepository.class, id, metadata.getPostIdRef()));
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@@ -78,8 +83,13 @@ public class MetadataRepository implements IMetadataRepository {
|
||||
@Override
|
||||
public int deleteByPostId(String postId) {
|
||||
return jdbcTemplate.update(
|
||||
"DELETE FROM METADATA WHERE POST_ID_REF = (SELECT post.ID FROM POST AS post INNER JOIN METADATA metadata ON post.ID = metadata.POST_ID_REF WHERE post.POST_ID = ?)",
|
||||
"DELETE FROM METADATA AS metadata WHERE metadata.ID = (SELECT inner_metadata.ID FROM POST AS post INNER JOIN METADATA inner_metadata ON post.ID = inner_metadata.POST_ID_REF WHERE post.POST_ID = ?)",
|
||||
postId
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
}
|
||||
}
|
||||
|
||||
+38
-26
@@ -1,8 +1,12 @@
|
||||
package tn.mnlr.vripper.jpa.repositories.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.event.PostRemoveEvent;
|
||||
import tn.mnlr.vripper.event.PostUpdateEvent;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.jpa.repositories.IPostRepository;
|
||||
@@ -12,10 +16,11 @@ import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Service
|
||||
public class PostRepository implements IPostRepository {
|
||||
public class PostRepository implements IPostRepository, ApplicationEventPublisherAware {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final AtomicLong counter = new AtomicLong(0);
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Autowired
|
||||
public PostRepository(JdbcTemplate jdbcTemplate) {
|
||||
@@ -44,7 +49,7 @@ public class PostRepository implements IPostRepository {
|
||||
post.getDone(),
|
||||
post.getForum(),
|
||||
String.join(";", post.getHosts()),
|
||||
post.getPostFolderName(),
|
||||
post.getDownloadDirectory(),
|
||||
post.getPostId(),
|
||||
String.join(";", post.getPreviews()),
|
||||
post.getSecurityToken(),
|
||||
@@ -57,24 +62,16 @@ public class PostRepository implements IPostRepository {
|
||||
post.getUrl()
|
||||
);
|
||||
post.setId(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return jdbcTemplate.update(
|
||||
"DELETE FROM POST AS post WHERE post.ID = ?",
|
||||
id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return post;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Post> findByPostId(String postId) {
|
||||
List<Post> posts = jdbcTemplate.query(
|
||||
"SELECT metadata.*,post.* FROM METADATA metadata FULL JOIN POST post ON metadata.POST_ID_REF = post.ID WHERE POST_ID = ?",
|
||||
new Object[]{postId},
|
||||
new PostRowMapper()
|
||||
);
|
||||
new PostRowMapper(),
|
||||
postId);
|
||||
if (posts.isEmpty()) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -94,9 +91,8 @@ public class PostRepository implements IPostRepository {
|
||||
public Optional<Post> findById(Long id) {
|
||||
List<Post> posts = jdbcTemplate.query(
|
||||
"SELECT metadata.*,post.* FROM METADATA metadata FULL JOIN POST post ON metadata.POST_ID_REF = post.ID WHERE post.ID = ?",
|
||||
new Object[]{id},
|
||||
new PostRowMapper()
|
||||
);
|
||||
new PostRowMapper(),
|
||||
id);
|
||||
if (posts.isEmpty()) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -116,9 +112,8 @@ public class PostRepository implements IPostRepository {
|
||||
public boolean existByPostId(String postId) {
|
||||
Integer count = jdbcTemplate.queryForObject(
|
||||
"SELECT COUNT(*) FROM POST AS post WHERE post.POST_ID = ?",
|
||||
new Object[]{postId},
|
||||
Integer.class
|
||||
);
|
||||
Integer.class,
|
||||
postId);
|
||||
if (count == null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -135,49 +130,66 @@ public class PostRepository implements IPostRepository {
|
||||
|
||||
@Override
|
||||
public int deleteByPostId(String postId) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"DELETE FROM POST AS post WHERE post.POST_ID = ?",
|
||||
postId
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostRemoveEvent(PostRepository.class, postId));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(Status status, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE POST AS post SET post.STATUS = ? WHERE post.ID = ?",
|
||||
status.name(), id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDone(int done, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE POST AS post SET post.DONE = ? WHERE post.ID = ?",
|
||||
done, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFolderName(String postFolderName, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE POST AS post SET post.POST_FOLDER_NAME = ? WHERE post.ID = ?",
|
||||
postFolderName, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateTitle(String title, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE POST AS post SET post.TITLE = ? WHERE post.ID = ?",
|
||||
title, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateThanked(boolean thanked, Long id) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"UPDATE POST AS post SET post.THANKED = ? WHERE post.ID = ?",
|
||||
thanked, id
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new PostUpdateEvent(PostRepository.class, id));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class PostRowMapper implements RowMapper<Post> {
|
||||
post.setHosts(Set.of(rs.getString("HOSTS").split(DELIMITER)));
|
||||
post.setForum(rs.getString("FORUM"));
|
||||
post.setSecurityToken(rs.getString("SECURITY_TOKEN"));
|
||||
post.setPostFolderName(rs.getString("POST_FOLDER_NAME"));
|
||||
post.setDownloadDirectory(rs.getString("POST_FOLDER_NAME"));
|
||||
post.setThanked(rs.getBoolean("THANKED"));
|
||||
String previews;
|
||||
if ((previews = rs.getString("PREVIEWS")) != null) {
|
||||
|
||||
+15
-2
@@ -1,8 +1,12 @@
|
||||
package tn.mnlr.vripper.jpa.repositories.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.event.QueuedRemoveEvent;
|
||||
import tn.mnlr.vripper.event.QueuedUpdateEvent;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.jpa.repositories.IQueuedRepository;
|
||||
|
||||
@@ -11,10 +15,11 @@ import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Service
|
||||
public class QueuedRepository implements IQueuedRepository {
|
||||
public class QueuedRepository implements IQueuedRepository, ApplicationEventPublisherAware {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final AtomicLong counter = new AtomicLong(0);
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@Autowired
|
||||
public QueuedRepository(JdbcTemplate jdbcTemplate) {
|
||||
@@ -46,6 +51,7 @@ public class QueuedRepository implements IQueuedRepository {
|
||||
queued.getThreadId()
|
||||
);
|
||||
queued.setId(id);
|
||||
applicationEventPublisher.publishEvent(new QueuedUpdateEvent(QueuedRepository.class, id));
|
||||
return queued;
|
||||
}
|
||||
|
||||
@@ -87,9 +93,16 @@ public class QueuedRepository implements IQueuedRepository {
|
||||
|
||||
@Override
|
||||
public int deleteByThreadId(String threadId) {
|
||||
return jdbcTemplate.update(
|
||||
int mutationCount = jdbcTemplate.update(
|
||||
"DELETE FROM QUEUED AS queued WHERE THREAD_ID = ?",
|
||||
threadId
|
||||
);
|
||||
applicationEventPublisher.publishEvent(new QueuedRemoveEvent(QueuedRepository.class, threadId));
|
||||
return mutationCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
public interface DataEventListener<T> {
|
||||
Flux<T> getDataFlux();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import reactor.core.publisher.Sinks.EmitFailureHandler;
|
||||
|
||||
public class EmitHandler {
|
||||
public static final EmitFailureHandler RETRY = (signalType, emitResult) -> true;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.ImageUpdateEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ImageUpdateEventListener implements ApplicationListener<ImageUpdateEvent>, DataEventListener<ImageUpdateEvent> {
|
||||
|
||||
private final Sinks.Many<ImageUpdateEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ImageUpdateEvent event) {
|
||||
sink.emitNext(event, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<ImageUpdateEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.MetadataUpdateEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MetadataUpdateEventListener implements ApplicationListener<MetadataUpdateEvent>, DataEventListener<MetadataUpdateEvent> {
|
||||
|
||||
private final Sinks.Many<MetadataUpdateEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(MetadataUpdateEvent event) {
|
||||
sink.emitNext(event, (signalType, emitResult) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<MetadataUpdateEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.PostRemoveEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PostRemoveEventListener implements ApplicationListener<PostRemoveEvent>, DataEventListener<PostRemoveEvent> {
|
||||
|
||||
private final Sinks.Many<PostRemoveEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(PostRemoveEvent event) {
|
||||
sink.emitNext(event, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<PostRemoveEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.PostUpdateEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PostUpdateEventListener implements ApplicationListener<PostUpdateEvent>, DataEventListener<PostUpdateEvent> {
|
||||
|
||||
private final Sinks.Many<PostUpdateEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(PostUpdateEvent event) {
|
||||
sink.emitNext(event, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<PostUpdateEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.QueuedRemoveEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QueuedRemoveEventListener implements ApplicationListener<QueuedRemoveEvent>, DataEventListener<QueuedRemoveEvent> {
|
||||
|
||||
private final Sinks.Many<QueuedRemoveEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(QueuedRemoveEvent event) {
|
||||
sink.emitNext(event, (signalType, emitResult) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<QueuedRemoveEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tn.mnlr.vripper.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.event.QueuedUpdateEvent;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QueuedUpdateEventListener implements ApplicationListener<QueuedUpdateEvent>, DataEventListener<QueuedUpdateEvent> {
|
||||
|
||||
private final Sinks.Many<QueuedUpdateEvent> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(QueuedUpdateEvent event) {
|
||||
sink.emitNext(event, (signalType, emitResult) -> true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<QueuedUpdateEvent> getDataFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(Sinks.EmitFailureHandler.FAIL_FAST);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import lombok.Getter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class CommonExecutor {
|
||||
@Getter
|
||||
private final ExecutorService generalExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
private final ExecutorService schedulerExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
@Getter
|
||||
private final Scheduler scheduler = Schedulers.from(schedulerExecutor);
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() throws InterruptedException {
|
||||
generalExecutor.shutdown();
|
||||
generalExecutor.awaitTermination(10, TimeUnit.SECONDS);
|
||||
schedulerExecutor.shutdown();
|
||||
schedulerExecutor.awaitTermination(10, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
+61
-18
@@ -1,5 +1,8 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.RetryPolicy;
|
||||
import org.apache.http.client.config.CookieSpecs;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.AbstractExecutionAwareRequest;
|
||||
@@ -13,37 +16,77 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.q.DownloadJob;
|
||||
import reactor.core.Disposable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import tn.mnlr.vripper.download.DownloadJob;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.net.URI;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@EnableScheduling
|
||||
public class ConnectionManager {
|
||||
@Slf4j
|
||||
public class ConnectionService {
|
||||
|
||||
private ConnectionManager() {
|
||||
private final Disposable disposable;
|
||||
private PoolingHttpClientConnectionManager pcm;
|
||||
private RequestConfig rc;
|
||||
|
||||
@Getter
|
||||
private RetryPolicy<Object> retryPolicy;
|
||||
|
||||
private int connectionTimeout;
|
||||
private int maxAttempts;
|
||||
|
||||
public ConnectionService(SettingsService settingsService) {
|
||||
connectionTimeout = settingsService.getSettings().getConnectionTimeout();
|
||||
maxAttempts = settingsService.getSettings().getMaxAttempts();
|
||||
Flux<SettingsService.Settings> settingsFlux = settingsService.getSettingsFlux();
|
||||
disposable = settingsFlux.subscribe(settings -> {
|
||||
if (connectionTimeout != settings.getConnectionTimeout()) {
|
||||
connectionTimeout = settings.getConnectionTimeout();
|
||||
buildRequestConfig();
|
||||
}
|
||||
if (maxAttempts != settings.getMaxAttempts()) {
|
||||
maxAttempts = settings.getMaxAttempts();
|
||||
buildRetryPolicy();
|
||||
}
|
||||
});
|
||||
|
||||
buildRequestConfig();
|
||||
buildRetryPolicy();
|
||||
buildConnectionPool();
|
||||
}
|
||||
|
||||
private PoolingHttpClientConnectionManager pcm;
|
||||
|
||||
private RequestConfig rc = RequestConfig.custom()
|
||||
.setConnectionRequestTimeout(5_000)
|
||||
.setConnectTimeout(5_000)
|
||||
.setSocketTimeout(5_000)
|
||||
.setCookieSpec(CookieSpecs.STANDARD)
|
||||
.build();
|
||||
|
||||
private void buildConnectionPool() {
|
||||
|
||||
pcm = new PoolingHttpClientConnectionManager();
|
||||
pcm.setMaxTotal(50);
|
||||
pcm.setDefaultMaxPerRoute(4);
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 1000)
|
||||
private void buildRetryPolicy() {
|
||||
retryPolicy = new RetryPolicy<>()
|
||||
.withDelay(2, 5, ChronoUnit.SECONDS)
|
||||
.withMaxAttempts(maxAttempts)
|
||||
.onFailedAttempt(e -> log.warn(String.format("#%d tries failed", e.getAttemptCount()), e.getLastFailure()));
|
||||
}
|
||||
|
||||
private void buildConnectionPool() {
|
||||
pcm = new PoolingHttpClientConnectionManager();
|
||||
}
|
||||
|
||||
private void buildRequestConfig() {
|
||||
rc = RequestConfig.custom()
|
||||
.setConnectionRequestTimeout(connectionTimeout * 1000)
|
||||
.setConnectTimeout(connectionTimeout * 1000)
|
||||
.setSocketTimeout(connectionTimeout * 1000)
|
||||
.setCookieSpec(CookieSpecs.STANDARD)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 5_000)
|
||||
private void idleConnectionMonitoring() {
|
||||
pcm.closeExpiredConnections();
|
||||
pcm.closeIdleConnections(30, TimeUnit.SECONDS);
|
||||
@@ -1,7 +1,5 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.processors.PublishProcessor;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -30,57 +28,27 @@ public class DataService {
|
||||
private final IImageRepository imageRepository;
|
||||
private final IQueuedRepository queuedRepository;
|
||||
private final IMetadataRepository metadataRepository;
|
||||
private final AppSettingsService appSettingsService;
|
||||
|
||||
private final PublishProcessor<Long> liveGrabQueue = PublishProcessor.create();
|
||||
private final PublishProcessor<Long> liveImageUpdates = PublishProcessor.create();
|
||||
private final PublishProcessor<Long> livePostsState = PublishProcessor.create();
|
||||
|
||||
private final PublishProcessor<String> postRemove = PublishProcessor.create();
|
||||
private final PublishProcessor<String> queueRemove = PublishProcessor.create();
|
||||
|
||||
public Observable<Long> liveQueue() {
|
||||
return liveGrabQueue.toObservable();
|
||||
}
|
||||
|
||||
public Observable<Long> livePost() {
|
||||
return livePostsState.toObservable();
|
||||
}
|
||||
|
||||
public Observable<Long> liveImage() {
|
||||
return liveImageUpdates.toObservable();
|
||||
}
|
||||
|
||||
public Observable<String> queueRemove() {
|
||||
return queueRemove.toObservable();
|
||||
}
|
||||
|
||||
public Observable<String> postRemove() {
|
||||
return postRemove.toObservable();
|
||||
}
|
||||
private final SettingsService settingsService;
|
||||
|
||||
@Autowired
|
||||
public DataService(IPostRepository postRepository, IImageRepository imageRepository, IQueuedRepository queuedRepository, IMetadataRepository metadataRepository, AppSettingsService appSettingsService) {
|
||||
public DataService(IPostRepository postRepository, IImageRepository imageRepository, IQueuedRepository queuedRepository, IMetadataRepository metadataRepository, SettingsService settingsService) {
|
||||
this.postRepository = postRepository;
|
||||
this.imageRepository = imageRepository;
|
||||
this.queuedRepository = queuedRepository;
|
||||
this.metadataRepository = metadataRepository;
|
||||
this.appSettingsService = appSettingsService;
|
||||
this.settingsService = settingsService;
|
||||
}
|
||||
|
||||
private void save(Post post) {
|
||||
postRepository.save(post);
|
||||
livePostsState.onNext(post.getId());
|
||||
}
|
||||
|
||||
private void save(Queued queued) {
|
||||
queuedRepository.save(queued);
|
||||
liveGrabQueue.onNext(queued.getId());
|
||||
}
|
||||
|
||||
private void save(Image image) {
|
||||
imageRepository.save(image);
|
||||
liveImageUpdates.onNext(image.getId());
|
||||
}
|
||||
|
||||
public boolean exists(String postId) {
|
||||
@@ -110,7 +78,6 @@ public class DataService {
|
||||
}
|
||||
|
||||
private void updatePostDone(int done, Long id) {
|
||||
livePostsState.onNext(id);
|
||||
postRepository.updateDone(done, id);
|
||||
}
|
||||
|
||||
@@ -125,7 +92,7 @@ public class DataService {
|
||||
} else {
|
||||
post.setStatus(Status.COMPLETE);
|
||||
updatePostStatus(post.getStatus(), post.getId());
|
||||
if (appSettingsService.getSettings().getClearCompleted()) {
|
||||
if (settingsService.getSettings().getClearCompleted()) {
|
||||
remove(post.getPostId());
|
||||
}
|
||||
}
|
||||
@@ -136,7 +103,6 @@ public class DataService {
|
||||
imageRepository.deleteAllByPostId(postId);
|
||||
metadataRepository.deleteByPostId(postId);
|
||||
postRepository.deleteByPostId(postId);
|
||||
postRemove.onNext(postId);
|
||||
}
|
||||
|
||||
public void newQueueLink(@NonNull final Queued queued) {
|
||||
@@ -145,7 +111,6 @@ public class DataService {
|
||||
|
||||
public void removeQueueLink(@NonNull final String threadId) {
|
||||
queuedRepository.deleteByThreadId(threadId);
|
||||
queueRemove.onNext(threadId);
|
||||
}
|
||||
|
||||
public List<String> clearCompleted() {
|
||||
@@ -197,7 +162,7 @@ public class DataService {
|
||||
return queuedRepository.findAll();
|
||||
}
|
||||
|
||||
public Optional<Post> findPostById(Long aLong) {
|
||||
public Optional<Post> findById(Long aLong) {
|
||||
return postRepository.findById(aLong);
|
||||
}
|
||||
|
||||
@@ -212,7 +177,6 @@ public class DataService {
|
||||
public void setMetadata(Post post, Metadata metadata) {
|
||||
metadata.setPostIdRef(post.getId());
|
||||
metadataRepository.save(metadata);
|
||||
livePostsState.onNext(post.getId());
|
||||
}
|
||||
|
||||
public Optional<Metadata> findMetadataByPostId(String postId) {
|
||||
@@ -221,36 +185,29 @@ public class DataService {
|
||||
|
||||
public void updateImageStatus(Status status, Long id) {
|
||||
imageRepository.updateStatus(status, id);
|
||||
liveImageUpdates.onNext(id);
|
||||
}
|
||||
|
||||
public void updateImageCurrent(long current, Long id) {
|
||||
imageRepository.updateCurrent(current, id);
|
||||
liveImageUpdates.onNext(id);
|
||||
}
|
||||
|
||||
public void updateImageTotal(long total, Long id) {
|
||||
imageRepository.updateTotal(total, id);
|
||||
liveImageUpdates.onNext(id);
|
||||
}
|
||||
|
||||
public void updatePostStatus(Status status, Long id) {
|
||||
postRepository.updateStatus(status, id);
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
|
||||
public void updatePostFolderName(String postFolderName, Long id) {
|
||||
public void updateDownloadDirectory(String postFolderName, Long id) {
|
||||
postRepository.updateFolderName(postFolderName, id);
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
|
||||
public void updatePostTitle(String title, Long id) {
|
||||
postRepository.updateTitle(title, id);
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
|
||||
public void updatePostThanked(boolean thanked, Long id) {
|
||||
postRepository.updateThanked(thanked, id);
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.processors.PublishProcessor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.listener.EmitHandler;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Service
|
||||
@EnableScheduling
|
||||
public class DownloadSpeedService {
|
||||
|
||||
private AtomicLong read = new AtomicLong(0);
|
||||
|
||||
private final AtomicLong read = new AtomicLong(0);
|
||||
private final Sinks.Many<Long> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
@Getter
|
||||
private long currentValue;
|
||||
|
||||
@Getter
|
||||
private final PublishProcessor<Long> readBytesPerSecond = PublishProcessor.create();
|
||||
|
||||
private boolean allowWrite = false;
|
||||
|
||||
public Flux<Long> getReadBytesPerSecond() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
public void increase(long read) {
|
||||
if (allowWrite) {
|
||||
this.read.addAndGet(read);
|
||||
@@ -34,8 +37,13 @@ public class DownloadSpeedService {
|
||||
long newValue = read.getAndSet(0);
|
||||
if (newValue != currentValue) {
|
||||
currentValue = newValue;
|
||||
readBytesPerSecond.onNext(currentValue);
|
||||
sink.emitNext(currentValue, EmitHandler.RETRY);
|
||||
}
|
||||
allowWrite = true;
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(EmitHandler.RETRY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,55 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.processors.PublishProcessor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.q.ExecutionService;
|
||||
import tn.mnlr.vripper.q.PendingQ;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.download.DownloadService;
|
||||
import tn.mnlr.vripper.download.PendingQueue;
|
||||
import tn.mnlr.vripper.listener.EmitHandler;
|
||||
import tn.mnlr.vripper.services.domain.GlobalState;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
@Service
|
||||
@EnableScheduling
|
||||
public class GlobalStateService {
|
||||
|
||||
private final PendingQ pendingQ;
|
||||
private final ExecutionService executionService;
|
||||
private final PendingQueue pendingQueue;
|
||||
private final DownloadService downloadService;
|
||||
private final DataService dataService;
|
||||
|
||||
private final Sinks.Many<GlobalState> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
@Getter
|
||||
private GlobalState currentState;
|
||||
|
||||
@Getter
|
||||
private final PublishProcessor<GlobalState> liveGlobalState = PublishProcessor.create();
|
||||
|
||||
@Autowired
|
||||
public GlobalStateService(PendingQ pendingQ, ExecutionService executionService, DataService dataService) {
|
||||
this.pendingQ = pendingQ;
|
||||
this.executionService = executionService;
|
||||
public GlobalStateService(PendingQueue pendingQueue, DownloadService downloadService, DataService dataService) {
|
||||
this.pendingQueue = pendingQueue;
|
||||
this.downloadService = downloadService;
|
||||
this.dataService = dataService;
|
||||
}
|
||||
|
||||
public Flux<GlobalState> getGlobalState() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 3000)
|
||||
private void interval() {
|
||||
GlobalState newGlobalState = new GlobalState(
|
||||
executionService.runningCount(),
|
||||
pendingQ.size(),
|
||||
downloadService.runningCount(),
|
||||
pendingQueue.size(),
|
||||
dataService.countErrorImages());
|
||||
if (!newGlobalState.equals(currentState)) {
|
||||
currentState = newGlobalState;
|
||||
liveGlobalState.onNext(currentState);
|
||||
sink.emitNext(currentState, EmitHandler.RETRY);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(EmitHandler.RETRY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,40 +22,15 @@ import java.net.URISyntaxException;
|
||||
@Slf4j
|
||||
public class HostService {
|
||||
|
||||
private final ConnectionManager cm;
|
||||
private final ConnectionService cm;
|
||||
private final HtmlProcessorService htmlProcessorService;
|
||||
|
||||
@Autowired
|
||||
public HostService(ConnectionManager cm, HtmlProcessorService htmlProcessorService) {
|
||||
public HostService(ConnectionService cm, HtmlProcessorService htmlProcessorService) {
|
||||
this.cm = cm;
|
||||
this.htmlProcessorService = htmlProcessorService;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Response {
|
||||
|
||||
private final Document document;
|
||||
private final Header[] headers;
|
||||
|
||||
protected Response(Document document, Header[] headers) {
|
||||
this.document = document;
|
||||
this.headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class NameUrl {
|
||||
|
||||
private String name;
|
||||
private String url;
|
||||
|
||||
public NameUrl(String name, String url) {
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Response getResponse(final String url, final HttpClientContext context) throws HostException {
|
||||
String basePage;
|
||||
|
||||
@@ -102,4 +77,28 @@ public class HostService {
|
||||
log.debug(String.format("Extracting name from url %s: %s", imgUrl, imageTitle));
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Response {
|
||||
|
||||
private final Document document;
|
||||
private final Header[] headers;
|
||||
|
||||
protected Response(Document document, Header[] headers) {
|
||||
this.document = document;
|
||||
this.headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class NameUrl {
|
||||
|
||||
private final String name;
|
||||
private final String url;
|
||||
|
||||
public NameUrl(String name, String url) {
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+34
-41
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
@@ -15,15 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.VripperApplication;
|
||||
import tn.mnlr.vripper.exception.DownloadException;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Metadata;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.services.ConnectionManager;
|
||||
import tn.mnlr.vripper.services.HtmlProcessorService;
|
||||
import tn.mnlr.vripper.services.VipergirlsAuthService;
|
||||
import tn.mnlr.vripper.services.XpathService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -36,46 +31,18 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MetadataCache {
|
||||
|
||||
@Getter
|
||||
static class Key {
|
||||
private final String postId;
|
||||
private final String threadId;
|
||||
private final String url;
|
||||
|
||||
Key(String postId, String threadId, String url) {
|
||||
this.postId = postId;
|
||||
this.threadId = threadId;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Key key = (Key) o;
|
||||
return Objects.equals(postId, key.postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(postId);
|
||||
}
|
||||
}
|
||||
public class MetadataService {
|
||||
|
||||
private static final List<String> dictionary = Arrays.asList("download", "link", "rapidgator", "filefactory", "filefox");
|
||||
|
||||
private final LoadingCache<Key, Metadata> cache;
|
||||
private final ConnectionManager cm;
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
private final ConnectionService cm;
|
||||
private final VGAuthService VGAuthService;
|
||||
private final HtmlProcessorService htmlProcessorService;
|
||||
private final XpathService xpathService;
|
||||
|
||||
@Autowired
|
||||
public MetadataCache(ConnectionManager cm, VipergirlsAuthService vipergirlsAuthService, HtmlProcessorService htmlProcessorService, XpathService xpathService) {
|
||||
public MetadataService(ConnectionService cm, VGAuthService VGAuthService, HtmlProcessorService htmlProcessorService, XpathService xpathService) {
|
||||
this.cm = cm;
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
this.VGAuthService = VGAuthService;
|
||||
this.htmlProcessorService = htmlProcessorService;
|
||||
this.xpathService = xpathService;
|
||||
|
||||
@@ -101,7 +68,7 @@ public class MetadataCache {
|
||||
private Metadata fetchMetadata(Key key) {
|
||||
HttpGet httpGet = cm.buildHttpGet(key.getUrl(), null);
|
||||
Metadata metadata = new Metadata();
|
||||
Failsafe.with(VripperApplication.retryPolicy)
|
||||
Failsafe.with(cm.getRetryPolicy())
|
||||
.onFailure(e -> {
|
||||
if (e.getFailure() instanceof InterruptedException || e.getFailure().getCause() instanceof InterruptedException) {
|
||||
log.debug("Fetching interrupted");
|
||||
@@ -111,7 +78,7 @@ public class MetadataCache {
|
||||
})
|
||||
.run(() -> {
|
||||
HttpClient connection = cm.getClient().build();
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, vipergirlsAuthService.getContext())) {
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, VGAuthService.getContext())) {
|
||||
if (response.getStatusLine().getStatusCode() / 100 != 2) {
|
||||
throw new DownloadException(String.format("Unexpected response code '%d' for %s", response.getStatusLine().getStatusCode(), httpGet));
|
||||
}
|
||||
@@ -166,4 +133,30 @@ public class MetadataCache {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
static class Key {
|
||||
private final String postId;
|
||||
private final String threadId;
|
||||
private final String url;
|
||||
|
||||
Key(String postId, String threadId, String url) {
|
||||
this.postId = postId;
|
||||
this.threadId = threadId;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Key key = (Key) o;
|
||||
return Objects.equals(postId, key.postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(postId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,82 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.exception.RenameException;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PathService {
|
||||
|
||||
public static final int MAX_ATTEMPTS = 24;
|
||||
private final AppSettingsService appSettingsService;
|
||||
private final SettingsService settingsService;
|
||||
private final DataService dataService;
|
||||
|
||||
private final CommonExecutor commonExecutor;
|
||||
@Getter
|
||||
private final ReentrantLock directoryAccess = new ReentrantLock();
|
||||
|
||||
@Autowired
|
||||
public PathService(AppSettingsService appSettingsService, DataService dataService, CommonExecutor commonExecutor) {
|
||||
this.appSettingsService = appSettingsService;
|
||||
public PathService(SettingsService settingsService, DataService dataService) {
|
||||
this.settingsService = settingsService;
|
||||
this.dataService = dataService;
|
||||
this.commonExecutor = commonExecutor;
|
||||
}
|
||||
|
||||
public final File getDownloadDestinationFolder(Post post) {
|
||||
return _getDownloadDestinationFolder(post.getForum(), post.getThreadTitle(), post.getPostFolderName());
|
||||
public final File calcDownloadDirectory(Post post) {
|
||||
return new File(settingsService.getSettings().getDownloadPath(), post.getDownloadDirectory());
|
||||
}
|
||||
|
||||
private File _getDownloadDestinationFolder(@NonNull String forum, @NonNull String threadTitle, @NonNull String title) {
|
||||
File sourceFolder = appSettingsService.getSettings().getSubLocation() ? new File(appSettingsService.getSettings().getDownloadPath(), sanitize(forum)) : new File(appSettingsService.getSettings().getDownloadPath());
|
||||
sourceFolder = appSettingsService.getSettings().getThreadSubLocation() ? new File(sourceFolder, threadTitle) : sourceFolder;
|
||||
return new File(sourceFolder, title);
|
||||
private File getRootFolder(@NonNull String forum, @NonNull String threadTitle) {
|
||||
File sourceFolder = settingsService.getSettings().getSubLocation() ? new File(settingsService.getSettings().getDownloadPath(), sanitize(forum)) : new File(settingsService.getSettings().getDownloadPath());
|
||||
return settingsService.getSettings().getThreadSubLocation() ? new File(sourceFolder, threadTitle) : sourceFolder;
|
||||
}
|
||||
|
||||
public final void createDefaultPostFolder(Post post) {
|
||||
File sourceFolder = _getDownloadDestinationFolder(post.getForum(), post.getThreadTitle(), sanitize(post.getTitle()));
|
||||
File destFolder = makeDirs(sourceFolder);
|
||||
post.setPostFolderName(destFolder.getName());
|
||||
dataService.updatePostFolderName(post.getPostFolderName(), post.getId());
|
||||
File downloadDirectory = getRootFolder(post.getForum(), post.getThreadTitle());
|
||||
downloadDirectory = new File(downloadDirectory, settingsService.getSettings().getAppendPostId() ? sanitize(post.getTitle()) + "_" + post.getPostId() : sanitize(post.getTitle()));
|
||||
downloadDirectory = makeDir(downloadDirectory);
|
||||
post.setDownloadDirectory(downloadDirectory.getAbsolutePath().replace(settingsService.getSettings().getDownloadPath(), ""));
|
||||
dataService.updateDownloadDirectory(post.getDownloadDirectory(), post.getId());
|
||||
}
|
||||
|
||||
public final void rename(@NonNull String postId, @NonNull String altName) {
|
||||
public final void rename(@NonNull String postId, @NonNull String altName) throws RenameException {
|
||||
Post post = dataService.findPostByPostId(postId).orElseThrow();
|
||||
commonExecutor.getGeneralExecutor().submit(() -> {
|
||||
if (altName.equals(post.getTitle())) {
|
||||
return;
|
||||
}
|
||||
if (altName.equals(post.getTitle())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Download have not started yet
|
||||
if (post.getDownloadDirectory() == null) {
|
||||
post.setTitle(altName);
|
||||
dataService.updatePostTitle(post.getTitle(), post.getId());
|
||||
if (post.getPostFolderName() == null) {
|
||||
return;
|
||||
}
|
||||
File newDestFolder = makeDirs(_getDownloadDestinationFolder(post.getForum(), post.getThreadTitle(), sanitize(altName)));
|
||||
File currentDesFolder = getDownloadDestinationFolder(post);
|
||||
post.setPostFolderName(newDestFolder.getName());
|
||||
dataService.updatePostFolderName(post.getPostFolderName(), post.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
List<File> files = Arrays.stream(Objects.requireNonNull(currentDesFolder.listFiles())).filter(e -> !e.getName().endsWith(".tmp")).collect(Collectors.toList());
|
||||
for (File f : files) {
|
||||
try {
|
||||
Files.move(f.toPath(), Paths.get(newDestFolder.toString(), f.toPath().getFileName().toString()), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
log.error(String.format("Failed to move files from %s to %s", currentDesFolder.toString(), newDestFolder.toString()), e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
File newDownloadDirectory = getRootFolder(post.getForum(), post.getThreadTitle());
|
||||
newDownloadDirectory = new File(newDownloadDirectory, sanitize(altName));
|
||||
File currentDownloadDirectory = calcDownloadDirectory(post);
|
||||
try {
|
||||
directoryAccess.lock();
|
||||
Files.move(currentDownloadDirectory.toPath(), newDownloadDirectory.toPath(), StandardCopyOption.ATOMIC_MOVE);
|
||||
post.setDownloadDirectory(newDownloadDirectory.getAbsolutePath().replace(settingsService.getSettings().getDownloadPath(), ""));
|
||||
dataService.updateDownloadDirectory(post.getDownloadDirectory(), post.getId());
|
||||
|
||||
int attempts = 0;
|
||||
while (currentDesFolder.exists() && attempts <= MAX_ATTEMPTS) {
|
||||
attempts++;
|
||||
if (!currentDesFolder.delete()) {
|
||||
log.warn(String.format("Failed to remove %s", currentDesFolder.toString()));
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5_000);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
if (attempts > MAX_ATTEMPTS) {
|
||||
log.error(String.format("Failed to rename post %s", postId));
|
||||
}
|
||||
});
|
||||
post.setTitle(altName);
|
||||
dataService.updatePostTitle(post.getTitle(), post.getId());
|
||||
} catch (IOException e) {
|
||||
throw new RenameException(String.format("Failed to move files from %s to %s", currentDownloadDirectory.toString(), newDownloadDirectory.toString()), e);
|
||||
} finally {
|
||||
directoryAccess.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private File makeDirs(@NonNull final File sourceFolder) {
|
||||
private File makeDir(@NonNull final File sourceFolder) {
|
||||
int counter = 1;
|
||||
File folder = sourceFolder;
|
||||
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.download.PendingQueue;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.services.domain.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PostService {
|
||||
|
||||
private final SettingsService settingsService;
|
||||
private final PendingQueue pendingQueue;
|
||||
private final DataService dataService;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final Map<String, Future<?>> fetchingMetadata = new ConcurrentHashMap<>();
|
||||
private final VGAuthService VGAuthService;
|
||||
|
||||
@Getter
|
||||
private final LoadingCache<Queued, List<MultiPostItem>> cache;
|
||||
|
||||
@Autowired
|
||||
public PostService(SettingsService settingsService, PendingQueue pendingQueue, DataService dataService, ThreadPoolService threadPoolService, VGAuthService VGAuthService) {
|
||||
this.settingsService = settingsService;
|
||||
this.pendingQueue = pendingQueue;
|
||||
this.dataService = dataService;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.VGAuthService = VGAuthService;
|
||||
|
||||
CacheLoader<Queued, List<MultiPostItem>> loader = new CacheLoader<>() {
|
||||
@Override
|
||||
public List<MultiPostItem> load(@NonNull Queued multiPostItem) throws Exception {
|
||||
ApiThreadParser apiThreadParser = new ApiThreadParser(multiPostItem);
|
||||
return apiThreadParser.parse();
|
||||
}
|
||||
};
|
||||
|
||||
cache = CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(30, TimeUnit.MINUTES)
|
||||
.build(loader);
|
||||
}
|
||||
|
||||
public void addPost(String postId, String threadId) throws PostParseException {
|
||||
|
||||
if (dataService.exists(postId)) {
|
||||
log.warn(String.format("skipping %s, already loaded", postId));
|
||||
return;
|
||||
}
|
||||
|
||||
ApiPostParser apiPostParser = new ApiPostParser(threadId, postId);
|
||||
ApiPost apiPost = apiPostParser.parse();
|
||||
if (apiPost.getPost().isEmpty()) {
|
||||
throw new PostParseException(String.format("parsing failed for thread %s, post %s", threadId, postId));
|
||||
}
|
||||
|
||||
Post post = apiPost.getPost().get();
|
||||
Set<Image> images = apiPost.getImages();
|
||||
|
||||
dataService.newPost(post, images);
|
||||
|
||||
// Metadata thread
|
||||
fetchingMetadata.put(post.getPostId(), threadPoolService.getGeneralExecutor().submit(new MetadataRunnable(post)));
|
||||
|
||||
if (settingsService.getSettings().getAutoStart()) {
|
||||
log.debug("Auto start downloads option is enabled");
|
||||
post.setStatus(Status.PENDING);
|
||||
try {
|
||||
pendingQueue.enqueue(post, images);
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Interruption was caught");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
log.debug(String.format("Done enqueuing jobs for %s", post.getUrl()));
|
||||
} else {
|
||||
post.setStatus(Status.STOPPED);
|
||||
log.debug("Auto start downloads option is disabled");
|
||||
}
|
||||
if (!settingsService.getSettings().getLeaveThanksOnStart()) {
|
||||
VGAuthService.leaveThanks(post);
|
||||
}
|
||||
dataService.updatePostStatus(post.getStatus(), post.getId());
|
||||
}
|
||||
|
||||
public void stopFetchingMetadata(Post post) {
|
||||
this.fetchingMetadata.forEach((k, v) -> {
|
||||
if (k.equals(post.getPostId())) {
|
||||
v.cancel(true);
|
||||
}
|
||||
});
|
||||
fetchingMetadata.remove(post.getPostId());
|
||||
}
|
||||
|
||||
public void processMultiPost(List<Queued> queuedList) throws Exception {
|
||||
for (Queued queued : queuedList) {
|
||||
if (queued.getPostId() != null) {
|
||||
addPost(queued.getPostId(), queued.getThreadId());
|
||||
} else {
|
||||
threadPoolService.getGeneralExecutor().submit(() -> this.multiPost(queued));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void multiPost(Queued queued) {
|
||||
|
||||
List<MultiPostItem> multiPostItems;
|
||||
try {
|
||||
multiPostItems = cache.get(queued);
|
||||
} catch (ExecutionException e) {
|
||||
log.error(String.format("Failed to add post with thread id %s, postId %s", queued.getThreadId(), queued.getPostId()), e);
|
||||
return;
|
||||
}
|
||||
queued.setTotal(multiPostItems.size());
|
||||
queued.done();
|
||||
log.debug(String.format("%d found for %s", multiPostItems.size(), queued.getLink()));
|
||||
if (multiPostItems.size() == 1) {
|
||||
try {
|
||||
addPost(multiPostItems.get(0).getPostId(), multiPostItems.get(0).getThreadId());
|
||||
} catch (PostParseException e) {
|
||||
log.error(String.format("Failed to add post with postId %s", multiPostItems.get(0).getPostId()), e);
|
||||
return;
|
||||
}
|
||||
log.debug(String.format("threadId %s, postId %s is added automatically for download", queued.getThreadId(), queued.getPostId()));
|
||||
} else {
|
||||
if (dataService.findQueuedByThreadId(queued.getThreadId()).isEmpty()) {
|
||||
dataService.newQueueLink(queued);
|
||||
} else {
|
||||
log.info(String.format("Thread with id = %s is already loaded", queued.getThreadId()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void remove(String threadId) {
|
||||
dataService.removeQueueLink(threadId);
|
||||
}
|
||||
}
|
||||
+77
-30
@@ -11,8 +11,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.exception.ValidationException;
|
||||
import tn.mnlr.vripper.listener.EmitHandler;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
@@ -25,21 +28,19 @@ import java.nio.file.Paths;
|
||||
import static java.nio.file.StandardOpenOption.*;
|
||||
|
||||
@Service
|
||||
@Getter
|
||||
@Setter
|
||||
@Slf4j
|
||||
public class AppSettingsService {
|
||||
|
||||
private final String MAX_TOTAL_THREADS = "MAX_TOTAL_THREADS";
|
||||
private final String baseDir;
|
||||
public class SettingsService {
|
||||
|
||||
private final Path configPath;
|
||||
private final ObjectMapper om = new ObjectMapper();
|
||||
|
||||
private Sinks.Many<Settings> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
|
||||
@Getter
|
||||
private Settings settings = new Settings();
|
||||
|
||||
public AppSettingsService(@Value("${base.dir}") String baseDir, @Value("${base.dir.name}") String baseDirName) {
|
||||
this.baseDir = baseDir;
|
||||
public SettingsService(@Value("${base.dir}") String baseDir, @Value("${base.dir.name}") String baseDirName) {
|
||||
this.configPath = Paths.get(baseDir, baseDirName, "config.json");
|
||||
om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
@@ -47,33 +48,34 @@ public class AppSettingsService {
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
restore();
|
||||
sink.emitNext(settings, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
Flux<Settings> getSettingsFlux() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
public void newSettings(Settings settings) {
|
||||
|
||||
if (settings.getVLogin()) {
|
||||
if (settings.getVLogin() != null && settings.getVLogin()) {
|
||||
if (!this.settings.getVPassword().equals(settings.getVPassword())) {
|
||||
settings.setVPassword(settings.getVPassword());
|
||||
settings.setVPassword(DigestUtils.md5Hex(settings.getVPassword()));
|
||||
}
|
||||
} else {
|
||||
settings.setVUsername("");
|
||||
settings.setVPassword("");
|
||||
settings.setVThanks(false);
|
||||
settings.setVLogin(false);
|
||||
}
|
||||
this.settings = settings;
|
||||
|
||||
save();
|
||||
sink.emitNext(settings, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
public void restore() {
|
||||
try {
|
||||
settings = om.readValue(configPath.toFile(), Settings.class);
|
||||
try {
|
||||
check(this.settings);
|
||||
} catch (ValidationException e) {
|
||||
log.error(String.format("Your settings are invalid, either remove %s, or fix it", configPath.toString()), e);
|
||||
SpringContext.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Failed restore user settings", e);
|
||||
settings = new Settings();
|
||||
@@ -135,25 +137,47 @@ public class AppSettingsService {
|
||||
settings.setDarkTheme(false);
|
||||
}
|
||||
|
||||
if (settings.getViewPhotos() == null) {
|
||||
settings.setViewPhotos(false);
|
||||
if (settings.getAppendPostId() == null) {
|
||||
settings.setAppendPostId(true);
|
||||
}
|
||||
|
||||
if (settings.getLeaveThanksOnStart() == null) {
|
||||
settings.setLeaveThanksOnStart(false);
|
||||
}
|
||||
|
||||
if (settings.getConnectionTimeout() == null) {
|
||||
settings.setConnectionTimeout(30);
|
||||
}
|
||||
|
||||
if (settings.getMaxAttempts() == null) {
|
||||
settings.setMaxAttempts(5);
|
||||
}
|
||||
|
||||
try {
|
||||
check(this.settings);
|
||||
} catch (ValidationException e) {
|
||||
log.error(String.format("Your settings are invalid, either remove %s, or fix it", configPath.toString()), e);
|
||||
SpringContext.close();
|
||||
}
|
||||
|
||||
save();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
// force disable gallery
|
||||
settings.setViewPhotos(false);
|
||||
|
||||
Files.write(configPath, om.writeValueAsBytes(settings), CREATE, WRITE, TRUNCATE_EXISTING, SYNC);
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to store user settings", e);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
save();
|
||||
sink.emitComplete(EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
public void check(Settings settings) throws ValidationException {
|
||||
|
||||
Path path;
|
||||
@@ -175,6 +199,14 @@ public class AppSettingsService {
|
||||
if (settings.getMaxThreads() < 1 || settings.getMaxThreads() > 4) {
|
||||
throw new ValidationException(String.format("Invalid max concurrent download settings, values must be in [%d,%d]", 1, 4));
|
||||
}
|
||||
|
||||
if (settings.getConnectionTimeout() < 1 || settings.getConnectionTimeout() > 300) {
|
||||
throw new ValidationException(String.format("Invalid connection timeout settings, values must be in [%d,%d]", 1, 300));
|
||||
}
|
||||
|
||||
if (settings.getMaxAttempts() < 1 || settings.getMaxAttempts() > 10) {
|
||||
throw new ValidationException(String.format("Invalid maximum attempts settings, values must be in [%d,%d]", 1, 10));
|
||||
}
|
||||
}
|
||||
|
||||
public Theme getTheme() {
|
||||
@@ -206,41 +238,56 @@ public class AppSettingsService {
|
||||
|
||||
@JsonProperty("downloadPath")
|
||||
private String downloadPath;
|
||||
|
||||
@JsonProperty("maxThreads")
|
||||
private Integer maxThreads;
|
||||
|
||||
@JsonProperty("maxTotalThreads")
|
||||
private Integer maxTotalThreads;
|
||||
|
||||
@JsonProperty("autoStart")
|
||||
private Boolean autoStart;
|
||||
|
||||
@JsonProperty("vLogin")
|
||||
private Boolean vLogin;
|
||||
|
||||
@JsonProperty("vUsername")
|
||||
private String vUsername;
|
||||
|
||||
@JsonProperty("vPassword")
|
||||
private String vPassword;
|
||||
|
||||
@JsonProperty("vThanks")
|
||||
private Boolean vThanks;
|
||||
|
||||
@JsonProperty("desktopClipboard")
|
||||
private Boolean desktopClipboard;
|
||||
|
||||
@JsonProperty("forceOrder")
|
||||
private Boolean forceOrder;
|
||||
|
||||
@JsonProperty("subLocation")
|
||||
private Boolean subLocation;
|
||||
|
||||
@JsonProperty("threadSubLocation")
|
||||
private Boolean threadSubLocation;
|
||||
|
||||
@JsonProperty("clearCompleted")
|
||||
private Boolean clearCompleted;
|
||||
@JsonProperty("viewPhotos")
|
||||
private Boolean viewPhotos;
|
||||
|
||||
@JsonProperty("darkTheme")
|
||||
private Boolean darkTheme;
|
||||
|
||||
public void setVPassword(String vPassword) {
|
||||
if (vPassword == null || vPassword.isEmpty()) {
|
||||
this.vPassword = "";
|
||||
} else {
|
||||
this.vPassword = DigestUtils.md5Hex(vPassword);
|
||||
}
|
||||
}
|
||||
@JsonProperty("appendPostId")
|
||||
private Boolean appendPostId;
|
||||
|
||||
@JsonProperty("leaveThanksOnStart")
|
||||
private Boolean leaveThanksOnStart;
|
||||
|
||||
@JsonProperty("connectionTimeout")
|
||||
private Integer connectionTimeout;
|
||||
|
||||
@JsonProperty("maxAttempts")
|
||||
private Integer maxAttempts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class ThreadPoolService {
|
||||
@Getter
|
||||
private final ExecutorService generalExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
public void destroy() throws Exception {
|
||||
generalExecutor.shutdown();
|
||||
generalExecutor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
+45
-37
@@ -1,6 +1,5 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.processors.PublishProcessor;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.NameValuePair;
|
||||
@@ -15,73 +14,83 @@ import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.Disposable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import tn.mnlr.vripper.exception.VripperException;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.listener.EmitHandler;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class VipergirlsAuthService {
|
||||
public class VGAuthService {
|
||||
|
||||
private final ConnectionManager cm;
|
||||
private final AppSettingsService appSettingsService;
|
||||
private final CommonExecutor commonExecutor;
|
||||
private final ConnectionService cm;
|
||||
private final SettingsService settingsService;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final DataService dataService;
|
||||
|
||||
private final Disposable disposable;
|
||||
|
||||
@Getter
|
||||
private final HttpClientContext context = HttpClientContext.create();
|
||||
|
||||
private final Sinks.Many<String> sink = Sinks.many().multicast().onBackpressureBuffer();
|
||||
@Getter
|
||||
private boolean authenticated = false;
|
||||
|
||||
@Getter
|
||||
private String loggedUser = "";
|
||||
|
||||
@Getter
|
||||
private final PublishProcessor<String> loggedInUser = PublishProcessor.create();
|
||||
|
||||
@Autowired
|
||||
public VipergirlsAuthService(ConnectionManager cm, AppSettingsService appSettingsService, CommonExecutor commonExecutor, DataService dataService) {
|
||||
public VGAuthService(ConnectionService cm, SettingsService settingsService, ThreadPoolService threadPoolService, DataService dataService) {
|
||||
this.cm = cm;
|
||||
this.appSettingsService = appSettingsService;
|
||||
this.commonExecutor = commonExecutor;
|
||||
this.settingsService = settingsService;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.dataService = dataService;
|
||||
disposable = settingsService.getSettingsFlux().subscribe(settings -> this.authenticate());
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
context.setCookieStore(new BasicCookieStore());
|
||||
try {
|
||||
authenticate();
|
||||
} catch (VripperException e) {
|
||||
log.error("Cannot authenticate user with ViperGirls", e);
|
||||
}
|
||||
authenticate();
|
||||
}
|
||||
|
||||
public void authenticate() throws VripperException {
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
sink.emitComplete(EmitHandler.RETRY);
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
public Flux<String> getLoggedInUser() {
|
||||
return sink.asFlux();
|
||||
}
|
||||
|
||||
public void authenticate() {
|
||||
|
||||
log.info("Authenticating using ViperGirls credentials");
|
||||
authenticated = false;
|
||||
|
||||
if (!appSettingsService.getSettings().getVLogin()) {
|
||||
if (!settingsService.getSettings().getVLogin()) {
|
||||
log.debug("Authentication option is disabled");
|
||||
context.getCookieStore().clear();
|
||||
loggedUser = "";
|
||||
loggedInUser.onNext(loggedUser);
|
||||
sink.emitNext(loggedUser, EmitHandler.RETRY);
|
||||
return;
|
||||
}
|
||||
|
||||
String username = appSettingsService.getSettings().getVUsername();
|
||||
String password = appSettingsService.getSettings().getVPassword();
|
||||
String username = settingsService.getSettings().getVUsername();
|
||||
String password = settingsService.getSettings().getVPassword();
|
||||
|
||||
if (username == null || password == null || username.isEmpty() || password.isEmpty()) {
|
||||
log.error("Cannot authenticate with ViperGirls credentials, username or password is empty");
|
||||
context.getCookieStore().clear();
|
||||
loggedUser = "";
|
||||
loggedInUser.onNext(loggedUser);
|
||||
sink.emitNext(loggedUser, EmitHandler.RETRY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,8 +106,9 @@ public class VipergirlsAuthService {
|
||||
} catch (Exception e) {
|
||||
context.getCookieStore().clear();
|
||||
loggedUser = "";
|
||||
loggedInUser.onNext(loggedUser);
|
||||
throw new VripperException(e);
|
||||
sink.emitNext(loggedUser, EmitHandler.RETRY);
|
||||
log.error("Failed to authenticate user with vipergirls.to", e);
|
||||
return;
|
||||
}
|
||||
|
||||
postAuth.addHeader("Referer", "https://vipergirls.to/");
|
||||
@@ -115,30 +125,28 @@ public class VipergirlsAuthService {
|
||||
log.debug(String.format("Authentication with ViperGirls response body:%n%s", responseBody));
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
if (context.getCookieStore().getCookies().stream().map(Cookie::getName).noneMatch(e -> e.equals("vg_userid"))) {
|
||||
throw new VripperException("Failed to authenticate user with ViperRipper");
|
||||
log.error("Failed to authenticate user with vipergirls.to, missing vg_userid cookie");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
context.getCookieStore().clear();
|
||||
loggedUser = "";
|
||||
loggedInUser.onNext(loggedUser);
|
||||
if (e instanceof VripperException) {
|
||||
throw (VripperException) e;
|
||||
} else {
|
||||
throw new VripperException(e);
|
||||
}
|
||||
sink.emitNext(loggedUser, EmitHandler.RETRY);
|
||||
log.error("Failed to authenticate user with vipergirls.to", e);
|
||||
return;
|
||||
}
|
||||
authenticated = true;
|
||||
loggedUser = username;
|
||||
log.info(String.format("Authenticated: %s", username));
|
||||
loggedInUser.onNext(loggedUser);
|
||||
sink.emitNext(loggedUser, EmitHandler.RETRY);
|
||||
}
|
||||
|
||||
public void leaveThanks(Post post) {
|
||||
if (!appSettingsService.getSettings().getVLogin()) {
|
||||
if (!settingsService.getSettings().getVLogin()) {
|
||||
log.debug("Authentication with ViperGirls option is disabled");
|
||||
return;
|
||||
}
|
||||
if (!appSettingsService.getSettings().getVThanks()) {
|
||||
if (!settingsService.getSettings().getVThanks()) {
|
||||
log.debug("Leave thanks option is disabled");
|
||||
return;
|
||||
}
|
||||
@@ -150,7 +158,7 @@ public class VipergirlsAuthService {
|
||||
log.debug("Already left a thanks");
|
||||
return;
|
||||
}
|
||||
commonExecutor.getGeneralExecutor().submit(() -> {
|
||||
threadPoolService.getGeneralExecutor().submit(() -> {
|
||||
try {
|
||||
postThanks(post);
|
||||
} catch (Exception e) {
|
||||
@@ -1,86 +0,0 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.services.post.CachedPost;
|
||||
import tn.mnlr.vripper.services.post.PostService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class VGHandler {
|
||||
|
||||
private final DataService dataService;
|
||||
private final PostService postService;
|
||||
private final CommonExecutor commonExecutor;
|
||||
|
||||
@Getter
|
||||
private final LoadingCache<Queued, List<CachedPost>> cache;
|
||||
|
||||
@Autowired
|
||||
public VGHandler(DataService dataService, PostService postService, CommonExecutor commonExecutor) {
|
||||
this.dataService = dataService;
|
||||
this.postService = postService;
|
||||
this.commonExecutor = commonExecutor;
|
||||
|
||||
CacheLoader<Queued, List<CachedPost>> loader = new CacheLoader<>() {
|
||||
@Override
|
||||
public List<CachedPost> load(@NonNull Queued queuedVGLink) throws Exception {
|
||||
VRThreadParser vrThreadParser = new VRThreadParser(queuedVGLink);
|
||||
return vrThreadParser.parse();
|
||||
}
|
||||
};
|
||||
|
||||
cache = CacheBuilder.newBuilder()
|
||||
.expireAfterWrite(30, TimeUnit.MINUTES)
|
||||
.build(loader);
|
||||
}
|
||||
|
||||
public void handle(List<Queued> queuedList) throws Exception {
|
||||
for (Queued queued : queuedList) {
|
||||
if (queued.getPostId() != null) {
|
||||
postService.addPost(queued.getPostId(), queued.getThreadId());
|
||||
} else {
|
||||
Runnable runnable = () -> {
|
||||
List<CachedPost> cachedPosts;
|
||||
try {
|
||||
cachedPosts = cache.get(queued);
|
||||
} catch (ExecutionException e) {
|
||||
log.error(String.format("Failed to add post with thread id %s, postId %s", queued.getThreadId(), queued.getPostId()), e);
|
||||
return;
|
||||
}
|
||||
queued.setTotal(cachedPosts.size());
|
||||
queued.done();
|
||||
log.debug(String.format("%d found for %s", cachedPosts.size(), queued.getLink()));
|
||||
if (cachedPosts.size() == 1) {
|
||||
try {
|
||||
postService.addPost(cachedPosts.get(0).getPostId(), cachedPosts.get(0).getThreadId());
|
||||
} catch (PostParseException e) {
|
||||
log.error(String.format("Failed to add post with postId %s", cachedPosts.get(0).getPostId()), e);
|
||||
return;
|
||||
}
|
||||
log.debug(String.format("threadId %s, postId %s is added automatically for download", queued.getThreadId(), queued.getPostId()));
|
||||
} else {
|
||||
dataService.newQueueLink(queued);
|
||||
}
|
||||
};
|
||||
commonExecutor.getGeneralExecutor().submit(runnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(String threadId) {
|
||||
dataService.removeQueueLink(threadId);
|
||||
}
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.Failsafe;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.VripperApplication;
|
||||
import tn.mnlr.vripper.exception.DownloadException;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.host.Host;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.services.post.CachedPost;
|
||||
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class VRThreadParser {
|
||||
|
||||
private static final String VR_API = "https://vipergirls.to/vr.php";
|
||||
|
||||
private static final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
private final Queued queued;
|
||||
private final ConnectionManager cm;
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
|
||||
VRThreadParser(Queued queued) {
|
||||
this.queued = queued;
|
||||
this.cm = SpringContext.getBean(ConnectionManager.class);
|
||||
this.vipergirlsAuthService = SpringContext.getBean(VipergirlsAuthService.class);
|
||||
}
|
||||
|
||||
public List<CachedPost> parse() throws PostParseException {
|
||||
|
||||
log.debug(String.format("Parsing thread %s", queued));
|
||||
HttpGet httpGet;
|
||||
try {
|
||||
URIBuilder uriBuilder = new URIBuilder(VR_API);
|
||||
uriBuilder.setParameter("t", queued.getThreadId());
|
||||
httpGet = cm.buildHttpGet(uriBuilder.build(), null);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new PostParseException(e);
|
||||
}
|
||||
|
||||
VRThreadHandler handler = new VRThreadHandler(queued);
|
||||
AtomicReference<Throwable> thr = new AtomicReference<>();
|
||||
log.debug(String.format("Requesting %s", httpGet));
|
||||
List<CachedPost> posts = Failsafe.with(VripperApplication.retryPolicy)
|
||||
.onFailure(e -> thr.set(e.getFailure()))
|
||||
.get(() -> {
|
||||
HttpClient connection = cm.getClient().build();
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, vipergirlsAuthService.getContext())) {
|
||||
if (response.getStatusLine().getStatusCode() / 100 != 2) {
|
||||
throw new DownloadException(String.format("Unexpected response code '%d' for %s", response.getStatusLine().getStatusCode(), httpGet));
|
||||
}
|
||||
|
||||
try {
|
||||
factory.newSAXParser().parse(new BufferedInputStream(response.getEntity().getContent()), handler);
|
||||
return handler.getPosts();
|
||||
} catch (Exception e) {
|
||||
throw new PostParseException(String.format("Failed to parse thread %s", queued), e);
|
||||
} finally {
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (thr.get() != null) {
|
||||
log.error(String.format("parsing failed for thread %s", queued), thr.get());
|
||||
throw new PostParseException(thr.get());
|
||||
}
|
||||
return posts;
|
||||
}
|
||||
}
|
||||
|
||||
class VRThreadHandler extends DefaultHandler {
|
||||
|
||||
private final Queued queued;
|
||||
private final Collection<Host> supportedHosts;
|
||||
private final Map<Host, AtomicInteger> hostMap = new HashMap<>();
|
||||
private List<String> previews = new ArrayList<>();
|
||||
private String threadTitle;
|
||||
private String postId;
|
||||
private String postTitle;
|
||||
private int imageCount;
|
||||
private int postCounter;
|
||||
private int previewCounter = 0;
|
||||
|
||||
@Getter
|
||||
private List<CachedPost> posts = new ArrayList<>();
|
||||
|
||||
VRThreadHandler(Queued queued) {
|
||||
this.queued = queued;
|
||||
this.supportedHosts = SpringContext.getBeansOfType(Host.class).values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
|
||||
switch (qName.toLowerCase()) {
|
||||
case "thread":
|
||||
threadTitle = attributes.getValue("title").trim();
|
||||
break;
|
||||
case "post":
|
||||
imageCount = Integer.parseInt(attributes.getValue("imagecount").trim());
|
||||
postId = attributes.getValue("id").trim();
|
||||
postCounter = Integer.parseInt(attributes.getValue("number").trim());
|
||||
postTitle = Optional.ofNullable(attributes.getValue("title")).map(e -> e.trim().isEmpty() ? null : e.trim()).orElse(threadTitle);
|
||||
break;
|
||||
case "image":
|
||||
Optional.ofNullable(attributes.getValue("main_url"))
|
||||
.map(String::trim)
|
||||
.flatMap(mainUrl -> supportedHosts.stream().filter(host -> host.isSupported(mainUrl)).findFirst())
|
||||
.ifPresent(host -> Optional.ofNullable(hostMap.get(host)).ifPresentOrElse(AtomicInteger::incrementAndGet, () -> hostMap.put(host, new AtomicInteger(0))));
|
||||
if (previewCounter++ < 4) {
|
||||
Optional.ofNullable(attributes.getValue("thumb_url")).map(String::trim).ifPresent(previews::add);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) {
|
||||
if ("post".equals(qName.toLowerCase())) {
|
||||
if (imageCount != 0) {
|
||||
posts.add(new CachedPost(
|
||||
queued.getThreadId(),
|
||||
postId,
|
||||
postCounter,
|
||||
postTitle,
|
||||
imageCount,
|
||||
String.format("https://vipergirls.to/threads/?p=%s&viewfull=1#post%s", postId, postId),
|
||||
previews,
|
||||
hostMap.entrySet().stream().filter(v -> v.getValue().get() > 0).map(e -> e.getKey().getHost() + " (" + e.getValue().get() + ")").collect(Collectors.joining(", "))
|
||||
));
|
||||
queued.increment();
|
||||
}
|
||||
previewCounter = 0;
|
||||
previews = new ArrayList<>();
|
||||
hostMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDocument() {
|
||||
queued.done();
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import javax.xml.xpath.XPathFactory;
|
||||
@Service
|
||||
public class XpathService {
|
||||
|
||||
private XPath xpath = XPathFactory.newInstance().newXPath();
|
||||
private final XPath xpath = XPathFactory.newInstance().newXPath();
|
||||
|
||||
public Node getAsNode(Node source, String xpathExpression) throws XpathException {
|
||||
try {
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
@@ -7,14 +7,14 @@ import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class ParseResult {
|
||||
public class ApiPost {
|
||||
|
||||
private final Post post;
|
||||
|
||||
@Getter
|
||||
private final Set<Image> images;
|
||||
|
||||
ParseResult(Post post, Set<Image> images) {
|
||||
public ApiPost(Post post, Set<Image> images) {
|
||||
this.post = post;
|
||||
this.images = images;
|
||||
}
|
||||
@@ -22,4 +22,4 @@ public class ParseResult {
|
||||
public Optional<Post> getPost() {
|
||||
return Optional.ofNullable(post);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.xml.sax.Attributes;
|
||||
@@ -15,7 +15,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
class VRApiPostHandler extends DefaultHandler {
|
||||
class ApiPostHandler extends DefaultHandler {
|
||||
|
||||
private final Collection<Host> supportedHosts;
|
||||
|
||||
@@ -32,7 +32,7 @@ class VRApiPostHandler extends DefaultHandler {
|
||||
|
||||
private Post parsedPost;
|
||||
|
||||
VRApiPostHandler(String threadId, String postId) {
|
||||
ApiPostHandler(String threadId, String postId) {
|
||||
this.threadId = threadId;
|
||||
this.postId = postId;
|
||||
this.postUrl = String.format("https://vipergirls.to/threads/%s/?p=%s&viewfull=1#post%s", this.threadId, this.postId, this.postId);
|
||||
@@ -40,8 +40,8 @@ class VRApiPostHandler extends DefaultHandler {
|
||||
}
|
||||
|
||||
|
||||
public ParseResult getParsedPost() {
|
||||
return new ParseResult(parsedPost, images);
|
||||
public ApiPost getParsedPost() {
|
||||
return new ApiPost(parsedPost, images);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +95,7 @@ class VRApiPostHandler extends DefaultHandler {
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) {
|
||||
if ("post".equals(qName.toLowerCase())) {
|
||||
if ("post".equalsIgnoreCase(qName)) {
|
||||
parsedPost.setTotal(images.size());
|
||||
if (!previews.isEmpty()) {
|
||||
parsedPost.setPreviews(previews);
|
||||
@@ -105,4 +105,4 @@ class VRApiPostHandler extends DefaultHandler {
|
||||
previews = new HashSet<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-18
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.Failsafe;
|
||||
@@ -8,18 +8,17 @@ import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.VripperApplication;
|
||||
import tn.mnlr.vripper.exception.DownloadException;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.services.ConnectionManager;
|
||||
import tn.mnlr.vripper.services.VipergirlsAuthService;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.VGAuthService;
|
||||
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
public class VRPostParser {
|
||||
public class ApiPostParser {
|
||||
|
||||
private static final String VR_API = "https://vipergirls.to/vr.php";
|
||||
|
||||
@@ -27,17 +26,17 @@ public class VRPostParser {
|
||||
|
||||
private final String threadId;
|
||||
private final String postId;
|
||||
private final ConnectionManager cm;
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
private final ConnectionService cm;
|
||||
private final VGAuthService VGAuthService;
|
||||
|
||||
public VRPostParser(String threadId, String postId) {
|
||||
public ApiPostParser(String threadId, String postId) {
|
||||
this.threadId = threadId;
|
||||
this.postId = postId;
|
||||
this.cm = SpringContext.getBean(ConnectionManager.class);
|
||||
this.vipergirlsAuthService = SpringContext.getBean(VipergirlsAuthService.class);
|
||||
this.cm = SpringContext.getBean(ConnectionService.class);
|
||||
this.VGAuthService = SpringContext.getBean(VGAuthService.class);
|
||||
}
|
||||
|
||||
public ParseResult parse() throws PostParseException {
|
||||
public ApiPost parse() throws PostParseException {
|
||||
|
||||
log.debug(String.format("Parsing post %s", postId));
|
||||
HttpGet httpGet;
|
||||
@@ -50,9 +49,9 @@ public class VRPostParser {
|
||||
}
|
||||
|
||||
AtomicReference<Throwable> thr = new AtomicReference<>();
|
||||
VRApiPostHandler handler = new VRApiPostHandler(threadId, postId);
|
||||
ApiPostHandler apiPostHandler = new ApiPostHandler(threadId, postId);
|
||||
log.debug(String.format("Requesting %s", httpGet));
|
||||
ParseResult post = getPost(httpGet, handler, thr);
|
||||
ApiPost post = getPost(httpGet, apiPostHandler, thr);
|
||||
if (thr.get() != null) {
|
||||
log.error(String.format("parsing failed for thread %s, post %s", threadId, postId), thr.get());
|
||||
throw new PostParseException(thr.get());
|
||||
@@ -60,19 +59,19 @@ public class VRPostParser {
|
||||
return post;
|
||||
}
|
||||
|
||||
private ParseResult getPost(HttpGet httpGet, VRApiPostHandler handler, AtomicReference<Throwable> thr) {
|
||||
return Failsafe.with(VripperApplication.retryPolicy)
|
||||
private ApiPost getPost(HttpGet httpGet, ApiPostHandler apiPostHandler, AtomicReference<Throwable> thr) {
|
||||
return Failsafe.with(cm.getRetryPolicy())
|
||||
.onFailure(e -> thr.set(e.getFailure()))
|
||||
.get(() -> {
|
||||
HttpClient connection = cm.getClient().build();
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, vipergirlsAuthService.getContext())) {
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, VGAuthService.getContext())) {
|
||||
if (response.getStatusLine().getStatusCode() / 100 != 2) {
|
||||
throw new DownloadException(String.format("Unexpected response code '%d' for %s", response.getStatusLine().getStatusCode(), httpGet));
|
||||
}
|
||||
|
||||
factory.newSAXParser().parse(response.getEntity().getContent(), handler);
|
||||
factory.newSAXParser().parse(response.getEntity().getContent(), apiPostHandler);
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
return handler.getParsedPost();
|
||||
return apiPostHandler.getParsedPost();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.host.Host;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ApiThreadHandler extends DefaultHandler {
|
||||
|
||||
private final Queued queued;
|
||||
private final Collection<Host> supportedHosts;
|
||||
private final Map<Host, AtomicInteger> hostMap = new HashMap<>();
|
||||
@Getter
|
||||
private final List<MultiPostItem> posts = new ArrayList<>();
|
||||
private List<String> previews = new ArrayList<>();
|
||||
private String threadTitle;
|
||||
private String postId;
|
||||
private String postTitle;
|
||||
private int imageCount;
|
||||
private int postCounter;
|
||||
private int previewCounter = 0;
|
||||
|
||||
public ApiThreadHandler(Queued queued) {
|
||||
this.queued = queued;
|
||||
this.supportedHosts = SpringContext.getBeansOfType(Host.class).values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
|
||||
switch (qName.toLowerCase()) {
|
||||
case "thread":
|
||||
threadTitle = attributes.getValue("title").trim();
|
||||
break;
|
||||
case "post":
|
||||
imageCount = Integer.parseInt(attributes.getValue("imagecount").trim());
|
||||
postId = attributes.getValue("id").trim();
|
||||
postCounter = Integer.parseInt(attributes.getValue("number").trim());
|
||||
postTitle = Optional.ofNullable(attributes.getValue("title")).map(e -> e.trim().isEmpty() ? null : e.trim()).orElse(threadTitle);
|
||||
break;
|
||||
case "image":
|
||||
Optional.ofNullable(attributes.getValue("main_url"))
|
||||
.map(String::trim)
|
||||
.flatMap(mainUrl -> supportedHosts.stream().filter(host -> host.isSupported(mainUrl)).findFirst())
|
||||
.ifPresent(host -> Optional.ofNullable(hostMap.get(host)).ifPresentOrElse(AtomicInteger::incrementAndGet, () -> hostMap.put(host, new AtomicInteger(1))));
|
||||
if (previewCounter++ < 4) {
|
||||
Optional.ofNullable(attributes.getValue("thumb_url")).map(String::trim).ifPresent(previews::add);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) {
|
||||
if ("post".equalsIgnoreCase(qName)) {
|
||||
if (imageCount != 0) {
|
||||
posts.add(new MultiPostItem(
|
||||
queued.getThreadId(),
|
||||
postId,
|
||||
postCounter,
|
||||
postTitle,
|
||||
imageCount,
|
||||
String.format("https://vipergirls.to/threads/?p=%s&viewfull=1#post%s", postId, postId),
|
||||
previews,
|
||||
hostMap.entrySet().stream().filter(v -> v.getValue().get() > 0).map(e -> e.getKey().getHost() + " (" + e.getValue().get() + ")").collect(Collectors.joining(", "))
|
||||
));
|
||||
queued.increment();
|
||||
}
|
||||
previewCounter = 0;
|
||||
previews = new ArrayList<>();
|
||||
hostMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDocument() {
|
||||
queued.done();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.Failsafe;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.exception.DownloadException;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.services.ConnectionService;
|
||||
import tn.mnlr.vripper.services.VGAuthService;
|
||||
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
public class ApiThreadParser {
|
||||
|
||||
private static final String VR_API = "https://vipergirls.to/vr.php";
|
||||
|
||||
private static final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
private final Queued queued;
|
||||
private final ConnectionService cm;
|
||||
private final VGAuthService VGAuthService;
|
||||
|
||||
public ApiThreadParser(Queued queued) {
|
||||
this.queued = queued;
|
||||
this.cm = SpringContext.getBean(ConnectionService.class);
|
||||
this.VGAuthService = SpringContext.getBean(VGAuthService.class);
|
||||
}
|
||||
|
||||
public List<MultiPostItem> parse() throws PostParseException {
|
||||
|
||||
log.debug(String.format("Parsing thread %s", queued));
|
||||
HttpGet httpGet;
|
||||
try {
|
||||
URIBuilder uriBuilder = new URIBuilder(VR_API);
|
||||
uriBuilder.setParameter("t", queued.getThreadId());
|
||||
httpGet = cm.buildHttpGet(uriBuilder.build(), null);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new PostParseException(e);
|
||||
}
|
||||
|
||||
ApiThreadHandler apiThreadHandler = new ApiThreadHandler(queued);
|
||||
AtomicReference<Throwable> thr = new AtomicReference<>();
|
||||
log.debug(String.format("Requesting %s", httpGet));
|
||||
List<MultiPostItem> posts = Failsafe.with(cm.getRetryPolicy())
|
||||
.onFailure(e -> thr.set(e.getFailure()))
|
||||
.get(() -> {
|
||||
HttpClient connection = cm.getClient().build();
|
||||
try (CloseableHttpResponse response = (CloseableHttpResponse) connection.execute(httpGet, VGAuthService.getContext())) {
|
||||
if (response.getStatusLine().getStatusCode() / 100 != 2) {
|
||||
throw new DownloadException(String.format("Unexpected response code '%d' for %s", response.getStatusLine().getStatusCode(), httpGet));
|
||||
}
|
||||
|
||||
try {
|
||||
factory.newSAXParser().parse(new BufferedInputStream(response.getEntity().getContent()), apiThreadHandler);
|
||||
return apiThreadHandler.getPosts();
|
||||
} catch (Exception e) {
|
||||
throw new PostParseException(String.format("Failed to parse thread %s", queued), e);
|
||||
} finally {
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (thr.get() != null) {
|
||||
log.error(String.format("parsing failed for thread %s", queued), thr.get());
|
||||
throw new PostParseException(thr.get());
|
||||
}
|
||||
return posts;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class GlobalState {
|
||||
private final long remaining;
|
||||
private final long error;
|
||||
|
||||
GlobalState(long running, long remaining, long error) {
|
||||
public GlobalState(long running, long remaining, long error) {
|
||||
this.running = running;
|
||||
this.remaining = remaining;
|
||||
this.error = error;
|
||||
+11
-5
@@ -1,6 +1,7 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jodah.failsafe.FailsafeException;
|
||||
import org.apache.http.impl.execchain.RequestAbortedException;
|
||||
@@ -8,6 +9,7 @@ import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.jpa.domain.Metadata;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.MetadataService;
|
||||
|
||||
@Slf4j
|
||||
public class MetadataRunnable implements Runnable {
|
||||
@@ -15,19 +17,23 @@ public class MetadataRunnable implements Runnable {
|
||||
@Getter
|
||||
private final Post post;
|
||||
|
||||
private final MetadataCache metadataCache;
|
||||
private final MetadataService metadataService;
|
||||
private final DataService dataService;
|
||||
|
||||
public MetadataRunnable(Post post) {
|
||||
public MetadataRunnable(@NonNull Post post) {
|
||||
this.post = post;
|
||||
this.metadataCache = SpringContext.getBean(MetadataCache.class);
|
||||
this.metadataService = SpringContext.getBean(MetadataService.class);
|
||||
this.dataService = SpringContext.getBean(DataService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Metadata metadata = metadataCache.get(post);
|
||||
if (Thread.interrupted()) {
|
||||
log.debug(String.format("Metadata fetching for postId=%s, threadId=%s interrupted", post.getPostId(), post.getThreadId()));
|
||||
return;
|
||||
}
|
||||
Metadata metadata = metadataService.get(post);
|
||||
dataService.setMetadata(post, metadata);
|
||||
} catch (Exception e) {
|
||||
if (e.getCause() instanceof InterruptedException || (e.getCause() instanceof FailsafeException && (e.getCause().getCause() instanceof InterruptedException || e.getCause().getCause() instanceof RequestAbortedException))) {
|
||||
+3
-4
@@ -1,12 +1,11 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class CachedPost {
|
||||
private final String type = "postParse";
|
||||
public class MultiPostItem {
|
||||
private final String threadId;
|
||||
private final String postId;
|
||||
private final int number;
|
||||
@@ -16,7 +15,7 @@ public class CachedPost {
|
||||
private final List<String> previews;
|
||||
private final String hosts;
|
||||
|
||||
public CachedPost(String threadId, String postId, int number, String title, int imageCount, String url, List<String> previews, String hosts) {
|
||||
public MultiPostItem(String threadId, String postId, int number, String title, int imageCount, String url, List<String> previews, String hosts) {
|
||||
this.threadId = threadId;
|
||||
this.postId = postId;
|
||||
this.number = number;
|
||||
@@ -1,85 +0,0 @@
|
||||
package tn.mnlr.vripper.services.post;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.enums.Status;
|
||||
import tn.mnlr.vripper.q.PendingQ;
|
||||
import tn.mnlr.vripper.services.AppSettingsService;
|
||||
import tn.mnlr.vripper.services.CommonExecutor;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PostService {
|
||||
|
||||
private final AppSettingsService appSettingsService;
|
||||
private final PendingQ pendingQ;
|
||||
private final DataService dataService;
|
||||
private final CommonExecutor commonExecutor;
|
||||
private final Map<String, Future<?>> fetchingMetadata = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
public PostService(AppSettingsService appSettingsService, PendingQ pendingQ, DataService dataService, DataService dataService1, CommonExecutor commonExecutor) {
|
||||
this.appSettingsService = appSettingsService;
|
||||
this.pendingQ = pendingQ;
|
||||
this.dataService = dataService1;
|
||||
this.commonExecutor = commonExecutor;
|
||||
}
|
||||
|
||||
public void addPost(String postId, String threadId) throws PostParseException {
|
||||
|
||||
if (dataService.exists(postId)) {
|
||||
log.warn(String.format("skipping %s, already loaded", postId));
|
||||
return;
|
||||
}
|
||||
|
||||
VRPostParser vrPostParser = new VRPostParser(threadId, postId);
|
||||
ParseResult parseResult = vrPostParser.parse();
|
||||
if (parseResult.getPost().isEmpty()) {
|
||||
throw new PostParseException(String.format("parsing failed for thread %s, post %s", threadId, postId));
|
||||
}
|
||||
|
||||
Post post = parseResult.getPost().get();
|
||||
Set<Image> images = parseResult.getImages();
|
||||
|
||||
dataService.newPost(post, images);
|
||||
|
||||
// Metadata thread
|
||||
fetchingMetadata.put(post.getPostId(), commonExecutor.getGeneralExecutor().submit(new MetadataRunnable(post)));
|
||||
|
||||
if (appSettingsService.getSettings().getAutoStart()) {
|
||||
log.debug("Auto start downloads option is enabled");
|
||||
post.setStatus(Status.PENDING);
|
||||
try {
|
||||
pendingQ.enqueue(post, images);
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Interruption was caught");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
log.debug(String.format("Done enqueuing jobs for %s", post.getUrl()));
|
||||
} else {
|
||||
post.setStatus(Status.STOPPED);
|
||||
log.debug("Auto start downloads option is disabled");
|
||||
}
|
||||
dataService.updatePostStatus(post.getStatus(), post.getId());
|
||||
}
|
||||
|
||||
public void stopFetchingMetadata(Post post) {
|
||||
this.fetchingMetadata.forEach((k, v) -> {
|
||||
if (k.equals(post.getPostId())) {
|
||||
v.cancel(true);
|
||||
}
|
||||
});
|
||||
fetchingMetadata.remove(post.getPostId());
|
||||
}
|
||||
}
|
||||
+41
-40
@@ -5,18 +5,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tn.mnlr.vripper.download.DownloadService;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Metadata;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.q.ExecutionService;
|
||||
import tn.mnlr.vripper.services.CommonExecutor;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.PathService;
|
||||
import tn.mnlr.vripper.services.VGHandler;
|
||||
import tn.mnlr.vripper.services.post.CachedPost;
|
||||
import tn.mnlr.vripper.services.post.PostService;
|
||||
import tn.mnlr.vripper.web.restendpoints.domain.posts.*;
|
||||
import tn.mnlr.vripper.services.PostService;
|
||||
import tn.mnlr.vripper.services.ThreadPoolService;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostItem;
|
||||
import tn.mnlr.vripper.web.restendpoints.domain.*;
|
||||
import tn.mnlr.vripper.web.restendpoints.exceptions.BadRequestException;
|
||||
import tn.mnlr.vripper.web.restendpoints.exceptions.NotFoundException;
|
||||
import tn.mnlr.vripper.web.restendpoints.exceptions.ServerErrorException;
|
||||
@@ -36,24 +35,20 @@ import java.util.stream.Collectors;
|
||||
public class PostRestEndpoint {
|
||||
|
||||
private static final Pattern VG_URL_PATTERN = Pattern.compile("https://vipergirls\\.to/threads/(\\d+)((.*p=)(\\d+))?");
|
||||
|
||||
private static final Object LOCK = new Object();
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
private final VGHandler vgHandler;
|
||||
private final ExecutionService executionService;
|
||||
private final DownloadService downloadService;
|
||||
private final PostService postService;
|
||||
private final CommonExecutor commonExecutor;
|
||||
|
||||
private static final Byte LOCK = -1;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
|
||||
@Autowired
|
||||
public PostRestEndpoint(DataService dataService, PathService pathService, VGHandler vgHandler, ExecutionService executionService, PostService postService, CommonExecutor commonExecutor) {
|
||||
public PostRestEndpoint(DataService dataService, PathService pathService, DownloadService downloadService, PostService postService, ThreadPoolService threadPoolService) {
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
this.vgHandler = vgHandler;
|
||||
this.executionService = executionService;
|
||||
this.downloadService = downloadService;
|
||||
this.postService = postService;
|
||||
this.commonExecutor = commonExecutor;
|
||||
this.threadPoolService = threadPoolService;
|
||||
}
|
||||
|
||||
@PostMapping("/post")
|
||||
@@ -84,7 +79,7 @@ public class PostRestEndpoint {
|
||||
queuedList.add(new Queued(url, threadId, postId));
|
||||
}
|
||||
try {
|
||||
vgHandler.handle(queuedList);
|
||||
postService.processMultiPost(queuedList);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to parse links", e);
|
||||
throw new ServerErrorException(e.getMessage());
|
||||
@@ -96,7 +91,7 @@ public class PostRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void restartPost(@RequestBody @NonNull List<PostId> postIds) {
|
||||
synchronized (LOCK) {
|
||||
executionService.restartAll(postIds.stream().map(PostId::getPostId).collect(Collectors.toList()));
|
||||
downloadService.restartAll(postIds.stream().map(PostId::getPostId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +100,7 @@ public class PostRestEndpoint {
|
||||
public void addPost(@RequestBody List<PostToAdd> posts) {
|
||||
synchronized (LOCK) {
|
||||
for (PostToAdd post : posts) {
|
||||
commonExecutor.getGeneralExecutor().submit(() -> {
|
||||
threadPoolService.getGeneralExecutor().submit(() -> {
|
||||
try {
|
||||
postService.addPost(post.getPostId(), post.getThreadId());
|
||||
} catch (PostParseException e) {
|
||||
@@ -129,11 +124,11 @@ public class PostRestEndpoint {
|
||||
Optional<Post> _post = dataService.findPostByPostId(postId);
|
||||
if (_post.isPresent()) {
|
||||
Post post = _post.get();
|
||||
if (post.getPostFolderName() == null) {
|
||||
if (post.getDownloadDirectory() == null) {
|
||||
log.error("Download has not been started yet for this post");
|
||||
throw new NotFoundException("Download has not been started yet for this post");
|
||||
} else {
|
||||
return new DownloadPath(pathService.getDownloadDestinationFolder(post).getPath());
|
||||
return new DownloadPath(pathService.calcDownloadDirectory(post).getPath());
|
||||
}
|
||||
} else {
|
||||
log.error(String.format("Unable to find post with postId = %s", postId));
|
||||
@@ -145,7 +140,7 @@ public class PostRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void restartPost() {
|
||||
synchronized (LOCK) {
|
||||
executionService.restartAll(null);
|
||||
downloadService.restartAll(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +148,7 @@ public class PostRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void stop(@RequestBody @NonNull List<PostId> postIds) {
|
||||
synchronized (LOCK) {
|
||||
executionService.stopAll(postIds.stream().map(PostId::getPostId).collect(Collectors.toList()));
|
||||
downloadService.stopAll(postIds.stream().map(PostId::getPostId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +156,7 @@ public class PostRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void stopAll() {
|
||||
synchronized (LOCK) {
|
||||
executionService.stopAll(null);
|
||||
downloadService.stopAll(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +166,7 @@ public class PostRestEndpoint {
|
||||
synchronized (LOCK) {
|
||||
List<RemoveResult> result = new ArrayList<>();
|
||||
List<String> collect = postIds.stream().map(PostId::getPostId).peek(e -> result.add(new RemoveResult(e))).collect(Collectors.toList());
|
||||
executionService.stopAll(collect);
|
||||
downloadService.stopAll(collect);
|
||||
dataService.removeAll(collect);
|
||||
return result;
|
||||
}
|
||||
@@ -187,12 +182,14 @@ public class PostRestEndpoint {
|
||||
}
|
||||
|
||||
private void renamePosts(@RequestBody @NonNull List<AltPostName> postToRename) {
|
||||
for (AltPostName altPostName : postToRename) {
|
||||
try {
|
||||
pathService.rename(altPostName.getPostId(), altPostName.getAltName());
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("Failed to rename post with postId = %s", altPostName.getPostId()), e);
|
||||
throw new ServerErrorException(e.getMessage());
|
||||
synchronized (LOCK) {
|
||||
for (AltPostName altPostName : postToRename) {
|
||||
try {
|
||||
pathService.rename(altPostName.getPostId(), altPostName.getAltName());
|
||||
} catch (Exception e) {
|
||||
log.error(String.format("Failed to rename post with postId = %s", altPostName.getPostId()), e);
|
||||
throw new ServerErrorException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,20 +236,24 @@ public class PostRestEndpoint {
|
||||
|
||||
@GetMapping("/grab/{threadId}")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public List<CachedPost> grab(@PathVariable("threadId") @NonNull String threadId) {
|
||||
Queued queued = dataService.findQueuedByThreadId(threadId).orElseThrow(() -> new NotFoundException(String.format("Unable to find links for threadId = %s", threadId)));
|
||||
try {
|
||||
return vgHandler.getCache().get(queued);
|
||||
} catch (ExecutionException e) {
|
||||
log.error(String.format("Failed to get links for threadId = %s", threadId), e);
|
||||
throw new ServerErrorException(String.format("Failed to get links for threadId = %s", threadId));
|
||||
public List<MultiPostItem> grab(@PathVariable("threadId") @NonNull String threadId) {
|
||||
synchronized (LOCK) {
|
||||
Queued queued = dataService.findQueuedByThreadId(threadId).orElseThrow(() -> new NotFoundException(String.format("Unable to find links for threadId = %s", threadId)));
|
||||
try {
|
||||
return postService.getCache().get(queued);
|
||||
} catch (ExecutionException e) {
|
||||
log.error(String.format("Failed to get links for threadId = %s", threadId), e);
|
||||
throw new ServerErrorException(String.format("Failed to get links for threadId = %s", threadId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/grab/remove")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public ThreadId grabRemove(@RequestBody @NonNull ThreadId threadId) {
|
||||
vgHandler.remove(threadId.getThreadId());
|
||||
return threadId;
|
||||
synchronized (LOCK) {
|
||||
postService.remove(threadId.getThreadId());
|
||||
return threadId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-18
@@ -5,8 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tn.mnlr.vripper.exception.ValidationException;
|
||||
import tn.mnlr.vripper.services.AppSettingsService;
|
||||
import tn.mnlr.vripper.services.VipergirlsAuthService;
|
||||
import tn.mnlr.vripper.services.SettingsService;
|
||||
import tn.mnlr.vripper.web.restendpoints.exceptions.BadRequestException;
|
||||
|
||||
@RestController
|
||||
@@ -14,48 +13,45 @@ import tn.mnlr.vripper.web.restendpoints.exceptions.BadRequestException;
|
||||
@CrossOrigin(value = "*")
|
||||
public class SettingsRestEndpoint {
|
||||
|
||||
private final AppSettingsService appSettingsService;
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
private final SettingsService settingsService;
|
||||
|
||||
@Autowired
|
||||
public SettingsRestEndpoint(AppSettingsService appSettingsService, VipergirlsAuthService vipergirlsAuthService) {
|
||||
this.appSettingsService = appSettingsService;
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
public SettingsRestEndpoint(SettingsService settingsService) {
|
||||
this.settingsService = settingsService;
|
||||
}
|
||||
|
||||
@PostMapping("/settings/theme")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public AppSettingsService.Theme postTheme(@RequestBody AppSettingsService.Theme theme) {
|
||||
this.appSettingsService.setTheme(theme);
|
||||
return appSettingsService.getTheme();
|
||||
public SettingsService.Theme postTheme(@RequestBody SettingsService.Theme theme) {
|
||||
this.settingsService.setTheme(theme);
|
||||
return settingsService.getTheme();
|
||||
}
|
||||
|
||||
@GetMapping("/settings/theme")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public AppSettingsService.Theme getTheme() {
|
||||
return appSettingsService.getTheme();
|
||||
public SettingsService.Theme getTheme() {
|
||||
return settingsService.getTheme();
|
||||
}
|
||||
|
||||
@PostMapping("/settings")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public AppSettingsService.Settings postSettings(@RequestBody AppSettingsService.Settings settings) throws Exception {
|
||||
public SettingsService.Settings postSettings(@RequestBody SettingsService.Settings settings) throws Exception {
|
||||
|
||||
try {
|
||||
this.appSettingsService.check(settings);
|
||||
this.settingsService.check(settings);
|
||||
} catch (ValidationException e) {
|
||||
log.error("Invalid settings", e);
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
|
||||
this.appSettingsService.newSettings(settings);
|
||||
vipergirlsAuthService.authenticate();
|
||||
this.settingsService.newSettings(settings);
|
||||
return getAppSettingsService();
|
||||
}
|
||||
|
||||
@GetMapping("/settings")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public AppSettingsService.Settings getAppSettingsService() {
|
||||
public SettingsService.Settings getAppSettingsService() {
|
||||
|
||||
return appSettingsService.getSettings();
|
||||
return settingsService.getSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package tn.mnlr.vripper.web.restendpoints;
|
||||
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(value = "*")
|
||||
public class UserRestEndpoint {
|
||||
|
||||
@RequestMapping("/user")
|
||||
public Principal user(Principal user) {
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web;
|
||||
package tn.mnlr.vripper.web.restendpoints;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -12,4 +12,4 @@ import lombok.ToString;
|
||||
public class AltPostName {
|
||||
private String postId;
|
||||
private String altName;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -15,4 +15,4 @@ public class DownloadPath {
|
||||
public DownloadPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -15,4 +15,4 @@ public class PostId {
|
||||
public PostId(String postId) {
|
||||
this.postId = postId;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -12,4 +12,4 @@ import lombok.ToString;
|
||||
public class PostToAdd {
|
||||
private String threadId;
|
||||
private String postId;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -19,4 +19,4 @@ public class RemoveAllResult {
|
||||
this.removed = postIds.size();
|
||||
this.postIds = postIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -11,4 +11,4 @@ import lombok.ToString;
|
||||
@ToString
|
||||
public class ThreadId {
|
||||
private String threadId;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package tn.mnlr.vripper.web.restendpoints.domain.posts;
|
||||
package tn.mnlr.vripper.web.restendpoints.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -11,4 +11,4 @@ import lombok.ToString;
|
||||
@ToString
|
||||
public class ThreadUrl {
|
||||
private String url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package tn.mnlr.vripper.web.wsendpoints;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.Disposable;
|
||||
import tn.mnlr.vripper.event.ImageUpdateEvent;
|
||||
import tn.mnlr.vripper.event.MetadataUpdateEvent;
|
||||
import tn.mnlr.vripper.event.PostUpdateEvent;
|
||||
import tn.mnlr.vripper.event.QueuedUpdateEvent;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.listener.*;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.DownloadSpeedService;
|
||||
import tn.mnlr.vripper.services.GlobalStateService;
|
||||
import tn.mnlr.vripper.services.VGAuthService;
|
||||
import tn.mnlr.vripper.services.domain.DownloadSpeed;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DataBroadcast {
|
||||
|
||||
private final SimpMessagingTemplate template;
|
||||
private final VGAuthService VGAuthService;
|
||||
private final GlobalStateService globalStateService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final DataService dataService;
|
||||
|
||||
private final PostUpdateEventListener postUpdateEventListener;
|
||||
private final MetadataUpdateEventListener metadataUpdateEventListener;
|
||||
private final ImageUpdateEventListener imageUpdateEventListener;
|
||||
private final QueuedUpdateEventListener queuedUpdateEventListener;
|
||||
|
||||
private final QueuedRemoveEventListener queuedRemoveEventListener;
|
||||
private final PostRemoveEventListener postRemoveEventListener;
|
||||
|
||||
private final List<Disposable> disposables = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
public DataBroadcast(SimpMessagingTemplate template, VGAuthService VGAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService, PostUpdateEventListener postUpdateEventListener, MetadataUpdateEventListener metadataUpdateEventListener, ImageUpdateEventListener imageUpdateEventListener, QueuedUpdateEventListener queuedUpdateEventListener, QueuedRemoveEventListener queuedRemoveEventListener, PostRemoveEventListener postRemoveEventListener) {
|
||||
this.template = template;
|
||||
this.VGAuthService = VGAuthService;
|
||||
this.globalStateService = globalStateService;
|
||||
this.downloadSpeedService = downloadSpeedService;
|
||||
this.dataService = dataService;
|
||||
this.postUpdateEventListener = postUpdateEventListener;
|
||||
this.metadataUpdateEventListener = metadataUpdateEventListener;
|
||||
this.imageUpdateEventListener = imageUpdateEventListener;
|
||||
this.queuedUpdateEventListener = queuedUpdateEventListener;
|
||||
this.queuedRemoveEventListener = queuedRemoveEventListener;
|
||||
this.postRemoveEventListener = postRemoveEventListener;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void run() {
|
||||
disposables.add(VGAuthService.getLoggedInUser()
|
||||
.map(DataController.LoggedUser::new)
|
||||
.subscribe(user -> template.convertAndSend("/topic/user", user), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(globalStateService.getGlobalState()
|
||||
.subscribe(state -> template.convertAndSend("/topic/download-state", state), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(downloadSpeedService.getReadBytesPerSecond()
|
||||
.map(DownloadSpeed::new)
|
||||
.subscribe(speed -> template.convertAndSend("/topic/speed", speed), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(postUpdateEventListener.getDataFlux()
|
||||
.map(PostUpdateEvent::getId)
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/posts", ids.stream().map(dataService::findById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(metadataUpdateEventListener.getDataFlux()
|
||||
.map(MetadataUpdateEvent::getPostIdRef)
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/posts", ids.stream().map(dataService::findById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(imageUpdateEventListener.getDataFlux()
|
||||
.map(ImageUpdateEvent::getId)
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(id -> id
|
||||
.stream()
|
||||
.map(dataService::findImageById)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(Collectors.groupingBy(Image::getPostId))
|
||||
.forEach((postId, images) -> template.convertAndSend("/topic/images/" + postId, images)),
|
||||
e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(queuedUpdateEventListener.getDataFlux()
|
||||
.map(QueuedUpdateEvent::getId)
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/queued", ids.stream().map(dataService::findQueuedById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(queuedRemoveEventListener.getDataFlux()
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(threadIds -> template.convertAndSend("/topic/queued/deleted", threadIds), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(postRemoveEventListener.getDataFlux()
|
||||
.buffer(Duration.of(500, ChronoUnit.MILLIS))
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(postIds -> template.convertAndSend("/topic/posts/deleted", postIds), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
disposables.forEach(Disposable::dispose);
|
||||
}
|
||||
}
|
||||
+21
-18
@@ -8,7 +8,12 @@ import org.springframework.stereotype.Controller;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.services.*;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.DownloadSpeedService;
|
||||
import tn.mnlr.vripper.services.GlobalStateService;
|
||||
import tn.mnlr.vripper.services.VGAuthService;
|
||||
import tn.mnlr.vripper.services.domain.DownloadSpeed;
|
||||
import tn.mnlr.vripper.services.domain.GlobalState;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -16,36 +21,24 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
@Controller
|
||||
public class AppDataController {
|
||||
public class DataController {
|
||||
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
private final VGAuthService VGAuthService;
|
||||
private final GlobalStateService globalStateService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
|
||||
@Autowired
|
||||
public AppDataController(VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService, PathService pathService) {
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
public DataController(VGAuthService VGAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService) {
|
||||
this.VGAuthService = VGAuthService;
|
||||
this.globalStateService = globalStateService;
|
||||
this.downloadSpeedService = downloadSpeedService;
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class LoggedUser {
|
||||
|
||||
private final String user;
|
||||
|
||||
LoggedUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeMapping("/user")
|
||||
public LoggedUser user() {
|
||||
return new LoggedUser(vipergirlsAuthService.getLoggedUser());
|
||||
return new LoggedUser(VGAuthService.getLoggedUser());
|
||||
}
|
||||
|
||||
@SubscribeMapping("/download-state")
|
||||
@@ -72,4 +65,14 @@ public class AppDataController {
|
||||
public Collection<Queued> queued() {
|
||||
return StreamSupport.stream(dataService.findAllQueued().spliterator(), false).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class LoggedUser {
|
||||
|
||||
private final String user;
|
||||
|
||||
LoggedUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
package tn.mnlr.vripper.web.wsendpoints;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.services.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WebSocketBroadcast {
|
||||
|
||||
private final SimpMessagingTemplate template;
|
||||
private final VipergirlsAuthService vipergirlsAuthService;
|
||||
private final GlobalStateService globalStateService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
|
||||
private final List<Disposable> disposables = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
public WebSocketBroadcast(SimpMessagingTemplate template, VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService, PathService pathService) {
|
||||
this.template = template;
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
this.globalStateService = globalStateService;
|
||||
this.downloadSpeedService = downloadSpeedService;
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void run() {
|
||||
disposables.add(vipergirlsAuthService.getLoggedInUser()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.onBackpressureBuffer()
|
||||
.map(AppDataController.LoggedUser::new)
|
||||
.subscribe(user -> template.convertAndSend("/topic/user", user), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(globalStateService.getLiveGlobalState()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.onBackpressureBuffer()
|
||||
.subscribe(state -> template.convertAndSend("/topic/download-state", state), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(downloadSpeedService.getReadBytesPerSecond()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.onBackpressureBuffer()
|
||||
.map(DownloadSpeed::new)
|
||||
.subscribe(speed -> template.convertAndSend("/topic/speed", speed), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(dataService.livePost()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/posts", ids.stream().map(dataService::findPostById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(dataService.liveImage()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(id -> id
|
||||
.stream()
|
||||
.map(dataService::findImageById)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(Collectors.groupingBy(Image::getPostId))
|
||||
.forEach((postId, images) -> template.convertAndSend("/topic/images/" + postId, images)),
|
||||
e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(dataService.liveQueue()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/queued", ids.stream().map(dataService::findQueuedById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(dataService.queueRemove()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(threadIds -> template.convertAndSend("/topic/queued/deleted", threadIds), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
|
||||
disposables.add(dataService.postRemove()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(postIds -> template.convertAndSend("/topic/posts/deleted", postIds), e -> log.error("Failed to send data to client", e))
|
||||
);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
disposables.forEach(Disposable::dispose);
|
||||
}
|
||||
}
|
||||
@@ -164,4 +164,9 @@
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
referencedColumnNames="ID" referencedTableName="POST"/>
|
||||
</changeSet>
|
||||
<changeSet id="1600798657000-01" author="sysgen">
|
||||
<createIndex tableName="POST" indexName="POST_UQ_POST_ID_IDX">
|
||||
<column name="POST_ID"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
"src/assets",
|
||||
{ "glob": "mdi.svg", "input": "./node_modules/@mdi/angular-material", "output": "./assets" }
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
@@ -42,7 +43,6 @@
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
@@ -91,7 +91,8 @@
|
||||
],
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
"src/assets",
|
||||
{ "glob": "mdi.svg", "input": "./node_modules/@mdi/angular-material", "output": "./assets" }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "commonjs",
|
||||
|
||||
Generated
+1877
-1956
File diff suppressed because it is too large
Load Diff
+21
-20
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "3.0.8",
|
||||
"version": "3.2.1",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
@@ -13,36 +13,37 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "10.0.9",
|
||||
"@angular/cdk": "10.1.3",
|
||||
"@angular/common": "10.0.9",
|
||||
"@angular/compiler": "10.0.9",
|
||||
"@angular/core": "10.0.9",
|
||||
"@angular/flex-layout": "10.0.0-beta.32",
|
||||
"@angular/forms": "10.0.9",
|
||||
"@angular/material": "10.1.3",
|
||||
"@angular/platform-browser": "10.0.9",
|
||||
"@angular/platform-browser-dynamic": "10.0.9",
|
||||
"@angular/router": "10.0.9",
|
||||
"@angular/animations": "11.0.8",
|
||||
"@angular/cdk": "11.0.3",
|
||||
"@angular/common": "11.0.8",
|
||||
"@angular/compiler": "11.0.8",
|
||||
"@angular/core": "11.0.8",
|
||||
"@angular/flex-layout": "11.0.0-beta.33",
|
||||
"@angular/forms": "11.0.8",
|
||||
"@angular/material": "11.0.3",
|
||||
"@angular/platform-browser": "11.0.8",
|
||||
"@angular/platform-browser-dynamic": "11.0.8",
|
||||
"@angular/router": "11.0.8",
|
||||
"@mdi/angular-material": "^5.8.55",
|
||||
"@stomp/rx-stomp": "^0.3.5",
|
||||
"ag-grid-angular": "23.2.1",
|
||||
"ag-grid-angular": "24.1.0",
|
||||
"ag-grid-community": "23.2.1",
|
||||
"core-js": "3.6.5",
|
||||
"ngx-electron": "2.2.0",
|
||||
"rxjs": "6.6.2",
|
||||
"rxjs": "6.6.3",
|
||||
"tslib": "^2.0.1",
|
||||
"zone.js": "0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^0.1000.6",
|
||||
"@angular/cli": "10.0.6",
|
||||
"@angular/compiler-cli": "10.0.9",
|
||||
"@angular/language-service": "10.0.9",
|
||||
"@angular-devkit/build-angular": "^0.1100.6",
|
||||
"@angular/cli": "11.0.6",
|
||||
"@angular/compiler-cli": "11.0.8",
|
||||
"@angular/language-service": "11.0.8",
|
||||
"@types/jasmine": "3.5.12",
|
||||
"@types/jasminewd2": "2.0.8",
|
||||
"@types/node": "12.12.21",
|
||||
"codelyzer": "6.0.0",
|
||||
"electron": "9.2.0",
|
||||
"electron": "11.1.1",
|
||||
"jasmine-core": "~3.6.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~5.1.1",
|
||||
@@ -53,6 +54,6 @@
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "8.10.2",
|
||||
"tslint": "~6.1.3",
|
||||
"typescript": "3.9.7"
|
||||
"typescript": "4.0.5"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.8</version>
|
||||
<version>3.2.1</version>
|
||||
</parent>
|
||||
<artifactId>vripper-ui</artifactId>
|
||||
<name>vripper-ui</name>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule} from '@angular/router';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
@@ -10,10 +10,11 @@ const routes: Routes = [
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forRoot(routes)
|
||||
RouterModule.forRoot(routes, {relativeLinkResolution: 'legacy'})
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
export class AppRoutingModule {
|
||||
}
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
animation: sk-chase-dot 2.0s infinite ease-in-out both;
|
||||
top: 0;
|
||||
animation: sk-chase-dot 2.0s infinite ease-in-out both;
|
||||
}
|
||||
|
||||
.sk-chase-dot:before {
|
||||
@@ -43,34 +43,74 @@
|
||||
height: 25%;
|
||||
background-color: #fff;
|
||||
border-radius: 100%;
|
||||
animation: sk-chase-dot-before 2.0s infinite ease-in-out both;
|
||||
animation: sk-chase-dot-before 2.0s infinite ease-in-out both;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(1) { animation-delay: -1.1s; }
|
||||
.sk-chase-dot:nth-child(2) { animation-delay: -1.0s; }
|
||||
.sk-chase-dot:nth-child(3) { animation-delay: -0.9s; }
|
||||
.sk-chase-dot:nth-child(4) { animation-delay: -0.8s; }
|
||||
.sk-chase-dot:nth-child(5) { animation-delay: -0.7s; }
|
||||
.sk-chase-dot:nth-child(6) { animation-delay: -0.6s; }
|
||||
.sk-chase-dot:nth-child(1):before { animation-delay: -1.1s; }
|
||||
.sk-chase-dot:nth-child(2):before { animation-delay: -1.0s; }
|
||||
.sk-chase-dot:nth-child(3):before { animation-delay: -0.9s; }
|
||||
.sk-chase-dot:nth-child(4):before { animation-delay: -0.8s; }
|
||||
.sk-chase-dot:nth-child(5):before { animation-delay: -0.7s; }
|
||||
.sk-chase-dot:nth-child(6):before { animation-delay: -0.6s; }
|
||||
.sk-chase-dot:nth-child(1) {
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(2) {
|
||||
animation-delay: -1.0s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(3) {
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(4) {
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(5) {
|
||||
animation-delay: -0.7s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(6) {
|
||||
animation-delay: -0.6s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(1):before {
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(2):before {
|
||||
animation-delay: -1.0s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(3):before {
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(4):before {
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(5):before {
|
||||
animation-delay: -0.7s;
|
||||
}
|
||||
|
||||
.sk-chase-dot:nth-child(6):before {
|
||||
animation-delay: -0.6s;
|
||||
}
|
||||
|
||||
@keyframes sk-chase {
|
||||
100% { transform: rotate(360deg); }
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sk-chase-dot {
|
||||
80%, 100% { transform: rotate(360deg); }
|
||||
80%, 100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sk-chase-dot-before {
|
||||
50% {
|
||||
transform: scale(0.4);
|
||||
} 100%, 0% {
|
||||
transform: scale(1.0);
|
||||
}
|
||||
}
|
||||
transform: scale(0.4);
|
||||
}
|
||||
100%, 0% {
|
||||
transform: scale(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
background-color: mat-color($background, background);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {AppService} from './app.service';
|
||||
import {ClipboardService} from './clipboard.service';
|
||||
import {AppService} from './services/app.service';
|
||||
import {ClipboardService} from './services/clipboard.service';
|
||||
import {ElectronService} from 'ngx-electron';
|
||||
import {AfterViewInit, ChangeDetectionStrategy, Component, NgZone, OnDestroy, Renderer2} from '@angular/core';
|
||||
import {MatDialog} from '@angular/material/dialog';
|
||||
import {BehaviorSubject, merge, Subject, Subscription} from 'rxjs';
|
||||
import {WsConnectionService} from './ws-connection.service';
|
||||
import {WsConnectionService} from './services/ws-connection.service';
|
||||
import {RxStompState} from '@stomp/rx-stomp';
|
||||
|
||||
@Component({
|
||||
@@ -14,6 +14,10 @@ import {RxStompState} from '@stomp/rx-stomp';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AppComponent implements OnDestroy, AfterViewInit {
|
||||
electron: Subject<boolean>;
|
||||
loaded: Subject<boolean> = new BehaviorSubject(false);
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
public ws: WsConnectionService,
|
||||
@@ -26,11 +30,6 @@ export class AppComponent implements OnDestroy, AfterViewInit {
|
||||
this.electron = new BehaviorSubject(electronService.isElectronApp);
|
||||
}
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
electron: Subject<boolean>;
|
||||
|
||||
loaded: Subject<boolean> = new BehaviorSubject(false);
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.appService.renderer = this.renderer;
|
||||
this.subscriptions.push(
|
||||
|
||||
@@ -1,62 +1,50 @@
|
||||
import {PostContextMenuComponent} from './posts/context-menu/post-context-menu.component';
|
||||
import {PostDetailsContextMenuComponent} from './post-progress/context-menu/post-details-context-menu.component';
|
||||
import {AppPreviewDirective} from './domain/preview-tooltip.directive';
|
||||
import {AppPreviewDirective} from './preview-tooltip/preview-tooltip.directive';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
import {AppComponent} from './app.component';
|
||||
import {MaterialModule} from './material.module';
|
||||
import {PostsComponent} from './posts/posts.component';
|
||||
import {PostDetailComponent} from './post-progress/post-detail.component';
|
||||
import {PhotosComponent} from './photos/photos.component';
|
||||
import {FlexLayoutModule} from '@angular/flex-layout';
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {AgGridModule} from 'ag-grid-angular';
|
||||
import {PostProgressRendererComponent} from './posts/renderer/post-progress.renderer.component';
|
||||
import {PostDetailsProgressRendererComponent} from './post-progress/renderer/post-details-progress.component';
|
||||
import {LoginComponent} from './login/login.component';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
import {SettingsComponent} from './settings/settings.component';
|
||||
|
||||
import {ConfirmDialogComponent} from './confirmation-component/confirmation-dialog';
|
||||
import {MultiPostComponent} from './multi-post/multi-post.component';
|
||||
import {MultiPostItemsComponent} from './multi-post-items/multi-post-items.component';
|
||||
import {OverlayModule} from '@angular/cdk/overlay';
|
||||
import {AppPreviewComponent} from './domain/preview-tooltip.component';
|
||||
import {UrlRendererComponent} from './multi-post/renderer/url-renderer.component';
|
||||
import {FilterComponent} from './filter/filter.component';
|
||||
import {AppPreviewComponent} from './preview-tooltip/preview-tooltip.component';
|
||||
import {ScanComponent} from './scan/scan.component';
|
||||
import {StatusBarComponent} from './status-bar/status-bar.component';
|
||||
import {ToolbarComponent} from './toolbar/toolbar.component';
|
||||
import {GrabQueueComponent} from './grab-queue/grab-queue.component';
|
||||
import {UrlGrabRendererComponent} from './grab-queue/renderer/url-renderer.component';
|
||||
import {MultiPostGridComponent} from './multi-post-grid/multi-post-grid.component';
|
||||
import {AlternativeTitleComponent} from './posts/alternative-title/alternative-title.component';
|
||||
import {NgxElectronModule} from 'ngx-electron';
|
||||
import {MatIconRegistry} from '@angular/material/icon';
|
||||
import {DomSanitizer} from '@angular/platform-browser';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
PostsComponent,
|
||||
PostDetailComponent,
|
||||
PostProgressRendererComponent,
|
||||
PostDetailsProgressRendererComponent,
|
||||
LoginComponent,
|
||||
PhotosComponent,
|
||||
HomeComponent,
|
||||
SettingsComponent,
|
||||
ConfirmDialogComponent,
|
||||
MultiPostComponent,
|
||||
MultiPostItemsComponent,
|
||||
AppPreviewComponent,
|
||||
AppPreviewDirective,
|
||||
UrlRendererComponent,
|
||||
UrlGrabRendererComponent,
|
||||
FilterComponent,
|
||||
ScanComponent,
|
||||
StatusBarComponent,
|
||||
ToolbarComponent,
|
||||
GrabQueueComponent,
|
||||
MultiPostGridComponent,
|
||||
PostContextMenuComponent,
|
||||
PostDetailsContextMenuComponent,
|
||||
AlternativeTitleComponent
|
||||
AlternativeTitleComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
@@ -66,16 +54,16 @@ import {NgxElectronModule} from 'ngx-electron';
|
||||
FlexLayoutModule,
|
||||
AppRoutingModule,
|
||||
ReactiveFormsModule,
|
||||
AgGridModule.withComponents([
|
||||
PostProgressRendererComponent,
|
||||
PostDetailsProgressRendererComponent,
|
||||
UrlRendererComponent,
|
||||
UrlGrabRendererComponent
|
||||
]),
|
||||
AgGridModule,
|
||||
OverlayModule,
|
||||
NgxElectronModule
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
constructor(matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer) {
|
||||
matIconRegistry.addSvgIconSet(
|
||||
domSanitizer.bypassSecurityTrustResourceUrl('./assets/mdi.svg')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,6 @@ export interface DialogConfirmation {
|
||||
templateUrl: 'confirmation-dialog.html'
|
||||
})
|
||||
export class ConfirmDialogComponent {
|
||||
constructor(public dialogRef: MatDialogRef<ConfirmDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: DialogConfirmation) {}
|
||||
constructor(public dialogRef: MatDialogRef<ConfirmDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: DialogConfirmation) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface Credentials {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export interface DownloadPath {
|
||||
path: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export class DownloadSpeed {
|
||||
constructor(public speed: string) {}
|
||||
constructor(public speed: string) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export class GlobalState {
|
||||
constructor(public running: number, public remaining: number, public error: number) {
|
||||
}
|
||||
constructor(public running: number, public remaining: number, public error: number) {
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
export class GrabQueueState {
|
||||
export class MultiPostModel {
|
||||
constructor(
|
||||
public type: string,
|
||||
public link: string,
|
||||
@@ -7,5 +7,6 @@ export class GrabQueueState {
|
||||
public removed: boolean,
|
||||
public total: number,
|
||||
public loading: boolean
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user