mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50c4d947ed | ||
|
|
b9b20e86dd | ||
|
|
64b93ce7e1 | ||
|
|
0bde4399e3 | ||
|
|
9b7818c5a7 | ||
|
|
1f2dcff353 | ||
|
|
4d82622fdb | ||
|
|
e7393caf01 | ||
|
|
8e5cb958ea | ||
|
|
bc2cf02ec6 | ||
|
|
7a8ecb306f | ||
|
|
76c3901afa | ||
|
|
f16b2227a1 | ||
|
|
d8d7ca5408 | ||
|
|
28c6b71e99 | ||
|
|
c40d3e2377 | ||
|
|
2217fea0ad | ||
|
|
94746441b5 | ||
|
|
c3e861fa8b | ||
|
|
ae1d644dba | ||
|
|
1fcb7e4e42 | ||
|
|
646cbba21c | ||
|
|
eef4d13235 | ||
|
|
9d1fe4c6b6 | ||
|
|
610d08f4ca | ||
|
|
7e52d0d6de | ||
|
|
4f0c5925ad | ||
|
|
245668b374 | ||
|
|
d3f5a70bfb | ||
|
|
5fd70a821b | ||
|
|
6e9c912118 | ||
|
|
19a98ea056 | ||
|
|
229bc46227 |
@@ -2,4 +2,5 @@
|
||||
/**/*/node_modules
|
||||
/**/*/target
|
||||
/**/*/build-dir
|
||||
/**/*/java-runtime
|
||||
.idea
|
||||
@@ -1,5 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
## [2.2.3] - 2019-10-01
|
||||
### Changed
|
||||
- Strip libjvm.so for debian
|
||||
|
||||
## [2.2.2] - 2019-10-01
|
||||
### Changed
|
||||
- Update product name
|
||||
|
||||
## [2.2.1] - 2019-10-01
|
||||
### Changed
|
||||
- Update dependency list for deb package
|
||||
|
||||
## [2.2.0] - 2019-10-01
|
||||
### Added
|
||||
- Embedd JRE within the app
|
||||
### Changed
|
||||
- Fix 'Start' on pending items
|
||||
- Upgrade to Java 11
|
||||
|
||||
## [2.1.0] - 2019-09-30
|
||||
### Added
|
||||
- Add a create a subfolder per thread option
|
||||
|
||||
## [2.0.4] - 2019-09-27
|
||||
### Changed
|
||||
- Fix some issues with ImxHost
|
||||
|
||||
## [2.0.3] - 2019-09-23
|
||||
### Changed
|
||||
- Update deb dependencies
|
||||
|
||||
## [2.0.2] - 2019-09-23
|
||||
### Changed
|
||||
- Add portable mode
|
||||
|
||||
## [2.0.1] - 2019-09-22
|
||||
### Changed
|
||||
- Change app name
|
||||
|
||||
## [2.0.0] - 2019-09-22
|
||||
### Added
|
||||
- Add sub folder option
|
||||
- Add clear finished option
|
||||
### Changed
|
||||
- UI enhancements
|
||||
- Bug fixes
|
||||
- Change data and log paths
|
||||
|
||||
## [1.6.5] - 2019-09-18
|
||||
### Changed
|
||||
- electron update
|
||||
|
||||
## [1.6.4] - 2019-09-18
|
||||
### Changed
|
||||
- Change menu item name
|
||||
|
||||
## [1.6.3] - 2019-09-18
|
||||
### Changed
|
||||
- Better multithread management
|
||||
- Fix partial state UI
|
||||
|
||||
## [1.6.2] - 2019-09-17
|
||||
### Changed
|
||||
- Rework UI colors
|
||||
- Fix scan input bug
|
||||
|
||||
## [1.6.1] - 2019-09-16
|
||||
### Changed
|
||||
- Rework UI
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<version>2.2.3</version>
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -34,16 +34,15 @@ if (!commandExists("java")) {
|
||||
function createWindow() {
|
||||
let icon;
|
||||
if(process.platform === "win32") {
|
||||
icon = path.join(__dirname, `icon.ico`);
|
||||
icon = __dirname + '/icon.ico';
|
||||
} else {
|
||||
icon = path.join(__dirname, `icon.icns`);
|
||||
icon = __dirname + '/icon.png';
|
||||
}
|
||||
win = new BrowserWindow({
|
||||
width: 1024,
|
||||
height: 800,
|
||||
minWidth: 640,
|
||||
minHeight: 480,
|
||||
frame: false,
|
||||
minWidth: 800,
|
||||
minHeight: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
},
|
||||
@@ -51,6 +50,8 @@ function createWindow() {
|
||||
});
|
||||
|
||||
win.removeMenu();
|
||||
win.setMenu(null);
|
||||
win.setMenuBarVisibility(false);
|
||||
|
||||
win.loadURL(
|
||||
url.format({
|
||||
@@ -72,7 +73,8 @@ getPort().then(port => {
|
||||
ipcMain.on("get-port", event => {
|
||||
event.reply("port", port);
|
||||
});
|
||||
vripperServer = spawn("java", [
|
||||
vripperServer = spawn(appDir !== undefined ? path.join(appDir, "java-runtime/bin/java") :
|
||||
path.join(app.getPath('exe'), "../java-runtime/bin/java"), [
|
||||
"-Xms256m",
|
||||
"-Xmx1024m",
|
||||
"-Dvripper.server.port=" + port,
|
||||
|
||||
Generated
+234
-416
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "1.6.1",
|
||||
"description": "",
|
||||
"version": "2.2.3",
|
||||
"description": "A ripper for vipergirls.to built using web technolgies",
|
||||
"main": "main.js",
|
||||
"author": "",
|
||||
"author": "death-claw <53543762+death-claw@users.noreply.github.com>",
|
||||
"homepage": "https://github.com/death-claw/vripper-project",
|
||||
"license": "ISC",
|
||||
"build": {
|
||||
"appId": "tn.mnlr.vripper",
|
||||
"productName": "vripper",
|
||||
"files": [
|
||||
"**/*",
|
||||
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
|
||||
@@ -29,24 +31,50 @@
|
||||
{
|
||||
"from": "../vripper-server/target/vripper-server-${version}-electron.jar",
|
||||
"to": "bin/vripper-server.jar"
|
||||
},
|
||||
{
|
||||
"from": "java-runtime",
|
||||
"to": "java-runtime"
|
||||
}
|
||||
],
|
||||
"win": {
|
||||
"target": "nsis"
|
||||
"icon": "icon.png",
|
||||
"target": [
|
||||
"nsis"
|
||||
]
|
||||
},
|
||||
"nsis": {
|
||||
"createDesktopShortcut": "always",
|
||||
"oneClick": false,
|
||||
"perMachine": false
|
||||
},
|
||||
"linux": {
|
||||
"synopsis": "vipergirls.to ripper",
|
||||
"category": "Utility",
|
||||
"packageCategory": "Utility",
|
||||
"icon": "icons",
|
||||
"target": [
|
||||
"zip"
|
||||
"deb"
|
||||
]
|
||||
},
|
||||
"deb": {
|
||||
"depends": [
|
||||
"gconf2",
|
||||
"gconf-service",
|
||||
"libnotify4",
|
||||
"libappindicator1",
|
||||
"libxtst6",
|
||||
"libnss3"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"dist": "node pre-build.js && build"
|
||||
"dist": "node pre-build.js && electron-builder"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^6.0.4",
|
||||
"electron-builder": "^20.44.4"
|
||||
"electron": "^6.0.9",
|
||||
"electron-builder": "^21.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<version>2.2.3</version>
|
||||
</parent>
|
||||
<artifactId>vripper-electron</artifactId>
|
||||
<name>vripper-electron</name>
|
||||
|
||||
@@ -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");
|
||||
|
||||
rimraf.sync('./build/vripper-ui');
|
||||
copydir.sync('../vripper-ui/dist/vripper-ui', './build/vripper-ui', {});
|
||||
@@ -16,3 +16,10 @@ $('body').prepend(`<script>require('../renderer.js')</script>`);
|
||||
|
||||
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') {
|
||||
console.log('Stripping libjvm.so');
|
||||
execSync('strip -p --strip-unneeded java-runtime/lib/server/libjvm.so');
|
||||
}
|
||||
@@ -1,15 +1,3 @@
|
||||
console.log("renderer intialized");
|
||||
const customTitlebar = require("custom-electron-titlebar");
|
||||
const electron = require("electron").remote;
|
||||
const contextMenu = require("electron-context-menu");
|
||||
|
||||
contextMenu({});
|
||||
const menu = new electron.Menu();
|
||||
const titlebar = new customTitlebar.Titlebar({
|
||||
backgroundColor: customTitlebar.Color.fromHex("#000000"),
|
||||
titleHorizontalAlignment: 'left',
|
||||
icon: 'favicon.ico',
|
||||
shadow: true,
|
||||
menu: menu
|
||||
});
|
||||
titlebar.updateTitle("Viper Ripper");
|
||||
contextMenu({});
|
||||
@@ -5,14 +5,14 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<version>2.2.3</version>
|
||||
</parent>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<name>vripper-server</name>
|
||||
<description>vripper-server</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package tn.mnlr.vripper;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -10,9 +12,9 @@ import org.springframework.stereotype.Component;
|
||||
import tn.mnlr.vripper.exception.VripperException;
|
||||
import tn.mnlr.vripper.services.AppSettingsService;
|
||||
import tn.mnlr.vripper.services.PersistenceService;
|
||||
import tn.mnlr.vripper.services.PostParser;
|
||||
import tn.mnlr.vripper.services.VipergirlsAuthService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -22,7 +24,7 @@ public class VripperApplication {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(VripperApplication.class);
|
||||
|
||||
public static final String dataPath = System.getProperty("vripper.datapath", ".") + File.separator + "data.json";
|
||||
// public static final String dataPath = System.getProperty("user.home", ".") + File.separator + ".vripper" + File.separator + "data.json";
|
||||
|
||||
public static final ExecutorService commonExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
@@ -47,6 +49,17 @@ public class VripperApplication {
|
||||
@Autowired
|
||||
private AppSettingsService appSettingsService;
|
||||
|
||||
@Value("${base.dir}")
|
||||
private String baseDir;
|
||||
|
||||
@Getter
|
||||
private String dataPath;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
dataPath = baseDir + File.separator + ".vripper" + File.separator + "data.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
|
||||
@@ -65,23 +78,4 @@ public class VripperApplication {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(SpringContext::close));
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
public class TestRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private PostParser postParser;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
// long start = System.currentTimeMillis();
|
||||
// PostParser.VRThreadParser vrThreadParser = postParser.new VRThreadParser("600408");
|
||||
// vrThreadParser.getPostPublishProcessor().subscribe(e -> System.out.println("new Post: " + e.getPostId()));
|
||||
// vrThreadParser.parse();
|
||||
// System.out.println("Total time: " + (System.currentTimeMillis() - start));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ public class Post {
|
||||
|
||||
private String postId;
|
||||
|
||||
private String threadTitle;
|
||||
|
||||
private String threadId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String postCounter;
|
||||
|
||||
private String url;
|
||||
|
||||
private List<Image> images;
|
||||
@@ -46,13 +46,17 @@ public class Post {
|
||||
|
||||
private boolean removed = false;
|
||||
|
||||
public Post(String title, String url, List<Image> images, Map<String, Object> metadata, String postId, String threadId) {
|
||||
private String forum;
|
||||
|
||||
public Post(String title, String url, List<Image> images, Map<String, Object> metadata, String postId, String threadId, String threadTitle, String forum) {
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
this.images = images;
|
||||
this.metadata = metadata;
|
||||
this.postId = postId;
|
||||
this.forum = forum;
|
||||
this.threadId = threadId;
|
||||
this.threadTitle = threadTitle;
|
||||
if (this.images.contains(null)) {
|
||||
System.out.println("Oops");
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ abstract public class Host {
|
||||
@Autowired
|
||||
private AppSettingsService appSettingsService;
|
||||
|
||||
@Autowired
|
||||
private AppStateService appStateService;
|
||||
|
||||
@Autowired
|
||||
private ConnectionManager cm;
|
||||
|
||||
@@ -64,6 +67,8 @@ abstract public class Host {
|
||||
|
||||
try {
|
||||
|
||||
appStateService.postDownloadingUpdate(image.getPostId());
|
||||
|
||||
imageFileData.setPageUrl(image.getUrl());
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,25 +41,34 @@ public class ImxHost extends Host {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNameAndUrl(final String url, final ImageFileData imageFileData) throws HostException {
|
||||
protected void setNameAndUrl(final String _url, final ImageFileData imageFileData) throws HostException {
|
||||
|
||||
Document doc = getResponse(url).getDocument();
|
||||
String url = _url.replace("http://", "https://");
|
||||
Response resp = getResponse(url);
|
||||
Document doc = resp.getDocument();
|
||||
|
||||
Node contDiv;
|
||||
String value = null;
|
||||
try {
|
||||
logger.info(String.format("Looking for xpath expression %s in %s", CONTINUE_BUTTON_XPATH, url));
|
||||
contDiv = xpathService.getAsNode(doc, CONTINUE_BUTTON_XPATH);
|
||||
Node node = contDiv.getAttributes().getNamedItem("value");
|
||||
if (node != null) {
|
||||
value = node.getTextContent();
|
||||
}
|
||||
} catch (XpathException e) {
|
||||
throw new HostException(e);
|
||||
}
|
||||
|
||||
if (contDiv != null) {
|
||||
if (value == null) {
|
||||
throw new HostException("Failed to obtain value attribute from continue input");
|
||||
}
|
||||
logger.info(String.format("Click button found for %s", url));
|
||||
HttpClient client = cm.getClient().build();
|
||||
HttpPost httpPost = cm.buildHttpPost(url);
|
||||
httpPost.addHeader("Referer", url);
|
||||
List<NameValuePair> params = new ArrayList<>();
|
||||
params.add(new BasicNameValuePair("imgContinue", "Continue to image ... "));
|
||||
params.add(new BasicNameValuePair("imgContinue", value));
|
||||
try {
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(params));
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -34,12 +34,14 @@ public class DownloadQ {
|
||||
@Getter
|
||||
private boolean notPauseQ = true;
|
||||
|
||||
public synchronized void put(Image image) throws InterruptedException {
|
||||
logger.info(String.format("Enqueuing a job for %s", image.getUrl()));
|
||||
image.init();
|
||||
DownloadJob downloadJob = new DownloadJob(image);
|
||||
downloadQ.put(downloadJob);
|
||||
appStateService.newDownloadJob(downloadJob);
|
||||
public void put(Image image) throws InterruptedException {
|
||||
synchronized (appStateService) {
|
||||
logger.info(String.format("Enqueuing a job for %s", image.getUrl()));
|
||||
image.init();
|
||||
DownloadJob downloadJob = new DownloadJob(image);
|
||||
downloadQ.put(downloadJob);
|
||||
appStateService.newDownloadJob(downloadJob);
|
||||
}
|
||||
}
|
||||
|
||||
public DownloadJob take() throws InterruptedException {
|
||||
@@ -48,69 +50,18 @@ public class DownloadQ {
|
||||
return downloadJob;
|
||||
}
|
||||
|
||||
public void enqueue(Post post) throws InterruptedException {
|
||||
public synchronized void enqueue(Post post) throws InterruptedException {
|
||||
for (Image image : post.getImages()) {
|
||||
put(image);
|
||||
}
|
||||
}
|
||||
|
||||
public void restart(String postId) throws InterruptedException {
|
||||
if (appStateService.getRunningPosts().get(postId) != null && appStateService.getRunningPosts().get(postId).get() > 0) {
|
||||
logger.warn(String.format("Cannot restart, jobs are currently running for post id %s", postId));
|
||||
return;
|
||||
}
|
||||
List<Image> images = appStateService.getPost(postId)
|
||||
.getImages()
|
||||
.stream()
|
||||
.filter(e -> !e.getStatus().equals(Image.Status.COMPLETE))
|
||||
.collect(Collectors.toList());
|
||||
if (images.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
appStateService.getPost(postId).setStatus(Post.Status.PENDING);
|
||||
logger.info(String.format("Restarting %d jobs for post id %s", images.size(), postId));
|
||||
for (Image image : images) {
|
||||
put(image);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScheduled(Image image) {
|
||||
image.setStatus(Image.Status.STOPPED);
|
||||
logger.info(String.format("Removing scheduled job for %s", image.getUrl()));
|
||||
|
||||
Iterator<DownloadJob> iterator = downloadQ.iterator();
|
||||
boolean removed = false;
|
||||
while(iterator.hasNext()) {
|
||||
DownloadJob next = iterator.next();
|
||||
if(next.getImage().getPostId().equals(image.getPostId())) {
|
||||
iterator.remove();
|
||||
appStateService.doneDownloadJob(image);
|
||||
logger.info(String.format("Scheduled job for %s is removed", image.getUrl()));
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!removed) {
|
||||
logger.warn(String.format("Job for %s does not exist", image.getUrl()));
|
||||
}
|
||||
|
||||
image.cleanup();
|
||||
}
|
||||
|
||||
public void removeRunning(String postId) {
|
||||
logger.info(String.format("Interrupting running jobs for post id %s", postId));
|
||||
executionService.stop(postId);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void stop(String postId) {
|
||||
try {
|
||||
if (FINISHED.contains(appStateService.getPost(postId).getStatus())) {
|
||||
synchronized (appStateService) {
|
||||
if (appStateService.getRunningPosts().get(postId) != null && appStateService.getRunningPosts().get(postId).get() > 0) {
|
||||
logger.warn(String.format("Cannot restart, jobs are currently running for post id %s", postId));
|
||||
return;
|
||||
}
|
||||
notPauseQ = false;
|
||||
appStateService.getPost(postId).setStatus(Post.Status.STOPPED);
|
||||
List<Image> images = appStateService.getPost(postId)
|
||||
.getImages()
|
||||
.stream()
|
||||
@@ -119,9 +70,66 @@ public class DownloadQ {
|
||||
if (images.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
logger.info(String.format("Stopping %d jobs for post id %s", images.size(), postId));
|
||||
images.forEach(image -> removeScheduled(image));
|
||||
removeRunning(postId);
|
||||
appStateService.getPost(postId).setStatus(Post.Status.PENDING);
|
||||
logger.info(String.format("Restarting %d jobs for post id %s", images.size(), postId));
|
||||
for (Image image : images) {
|
||||
put(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScheduled(Image image) {
|
||||
synchronized (appStateService) {
|
||||
image.setStatus(Image.Status.STOPPED);
|
||||
logger.info(String.format("Removing scheduled job for %s", image.getUrl()));
|
||||
|
||||
Iterator<DownloadJob> iterator = downloadQ.iterator();
|
||||
boolean removed = false;
|
||||
while (iterator.hasNext()) {
|
||||
DownloadJob next = iterator.next();
|
||||
if (next.getImage().getPostId().equals(image.getPostId())) {
|
||||
iterator.remove();
|
||||
appStateService.doneDownloadJob(image);
|
||||
logger.info(String.format("Scheduled job for %s is removed", image.getUrl()));
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!removed) {
|
||||
logger.warn(String.format("Job for %s does not exist", image.getUrl()));
|
||||
}
|
||||
|
||||
image.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeRunning(String postId) {
|
||||
logger.info(String.format("Interrupting running jobs for post id %s", postId));
|
||||
executionService.stop(postId);
|
||||
}
|
||||
|
||||
|
||||
public void stop(String postId) {
|
||||
try {
|
||||
synchronized (appStateService) {
|
||||
if (FINISHED.contains(appStateService.getPost(postId).getStatus())) {
|
||||
return;
|
||||
}
|
||||
notPauseQ = false;
|
||||
appStateService.getPost(postId).setStatus(Post.Status.STOPPED);
|
||||
List<Image> images = appStateService.getPost(postId)
|
||||
.getImages()
|
||||
.stream()
|
||||
.filter(e -> !e.getStatus().equals(Image.Status.COMPLETE))
|
||||
.collect(Collectors.toList());
|
||||
if (images.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
logger.info(String.format("Stopping %d jobs for post id %s", images.size(), postId));
|
||||
images.forEach(image -> removeScheduled(image));
|
||||
removeRunning(postId);
|
||||
}
|
||||
} finally {
|
||||
notPauseQ = true;
|
||||
}
|
||||
@@ -131,14 +139,18 @@ public class DownloadQ {
|
||||
return downloadQ.size();
|
||||
}
|
||||
|
||||
public synchronized void stopAll() {
|
||||
appStateService.getCurrentPosts().values().stream().map(Post::getPostId).forEach(this::stop);
|
||||
public void stopAll() {
|
||||
synchronized (appStateService) {
|
||||
appStateService.getCurrentPosts().values().stream().map(Post::getPostId).forEach(this::stop);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void restartAll() throws InterruptedException {
|
||||
for (Post post : appStateService.getCurrentPosts().values()) {
|
||||
String postId = post.getPostId();
|
||||
restart(postId);
|
||||
public void restartAll() throws InterruptedException {
|
||||
synchronized (appStateService) {
|
||||
for (Post post : appStateService.getCurrentPosts().values()) {
|
||||
String postId = post.getPostId();
|
||||
restart(postId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ public class AppSettingsService {
|
||||
private final String V_THANKS = "VTHANKS";
|
||||
private final String DESKTOP_CLIPBOARD = "DESKTOP_CLIPBOARD";
|
||||
private final String FORCE_ORDER = "FORCE_ORDER";
|
||||
private final String SUBFOLDER = "SUBFOLDER";
|
||||
private final String THREADSUBFOLDER = "THREADSUBFOLDER";
|
||||
private final String CLEAR = "CLEAR";
|
||||
private final String DARK_THEME = "DARK_THEME";
|
||||
|
||||
private String downloadPath;
|
||||
@@ -46,7 +49,10 @@ public class AppSettingsService {
|
||||
private String vPassword;
|
||||
private boolean vThanks;
|
||||
private boolean desktopClipboard;
|
||||
private boolean subLocation;
|
||||
private boolean threadSubLocation;
|
||||
private boolean forceOrder;
|
||||
private boolean clearCompleted;
|
||||
private boolean darkTheme;
|
||||
|
||||
public void setVPassword(String vPassword) {
|
||||
@@ -68,6 +74,9 @@ public class AppSettingsService {
|
||||
vThanks = prefs.getBoolean(V_THANKS, false);
|
||||
desktopClipboard = prefs.getBoolean(DESKTOP_CLIPBOARD, false);
|
||||
forceOrder = prefs.getBoolean(FORCE_ORDER, false);
|
||||
subLocation = prefs.getBoolean(SUBFOLDER, false);
|
||||
threadSubLocation = prefs.getBoolean(THREADSUBFOLDER, false);
|
||||
clearCompleted = prefs.getBoolean(CLEAR, false);
|
||||
darkTheme = prefs.getBoolean(DARK_THEME, false);
|
||||
}
|
||||
|
||||
@@ -83,6 +92,9 @@ public class AppSettingsService {
|
||||
prefs.putBoolean(V_THANKS, vThanks);
|
||||
prefs.putBoolean(DESKTOP_CLIPBOARD, desktopClipboard);
|
||||
prefs.putBoolean(FORCE_ORDER, forceOrder);
|
||||
prefs.putBoolean(SUBFOLDER, subLocation);
|
||||
prefs.putBoolean(THREADSUBFOLDER, threadSubLocation);
|
||||
prefs.putBoolean(CLEAR, clearCompleted);
|
||||
prefs.putBoolean(DARK_THEME, darkTheme);
|
||||
|
||||
try {
|
||||
@@ -153,8 +165,14 @@ public class AppSettingsService {
|
||||
private boolean desktopClipboard;
|
||||
@JsonProperty("forceOrder")
|
||||
private boolean forceOrder;
|
||||
@JsonProperty("subLocation")
|
||||
private boolean subLocation;
|
||||
@JsonProperty("threadSubLocation")
|
||||
private boolean threadSubLocation;
|
||||
@JsonProperty("clearCompleted")
|
||||
private boolean clearCompleted;
|
||||
|
||||
public Settings(String downloadPath, int maxThreads, boolean autoStart, boolean vLogin, String vUsername, String vPassword, boolean vThanks, boolean desktopClipboard, boolean forceOrder) {
|
||||
public Settings(String downloadPath, int maxThreads, boolean autoStart, boolean vLogin, String vUsername, String vPassword, boolean vThanks, boolean desktopClipboard, boolean forceOrder, boolean subLocation, boolean threadSubLocation, boolean clearCompleted) {
|
||||
this.downloadPath = downloadPath;
|
||||
this.maxThreads = maxThreads;
|
||||
this.autoStart = autoStart;
|
||||
@@ -164,6 +182,9 @@ public class AppSettingsService {
|
||||
this.vThanks = vThanks;
|
||||
this.desktopClipboard = desktopClipboard;
|
||||
this.forceOrder = forceOrder;
|
||||
this.subLocation = subLocation;
|
||||
this.threadSubLocation = threadSubLocation;
|
||||
this.clearCompleted = clearCompleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.processors.PublishProcessor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -37,6 +38,11 @@ public class AppStateService {
|
||||
@Autowired
|
||||
private PersistenceService persistenceService;
|
||||
|
||||
@Autowired
|
||||
private AppSettingsService appSettingsService;
|
||||
|
||||
private Disposable subscription;
|
||||
|
||||
public void onImageUpdate(Image imageState) {
|
||||
|
||||
persistenceService.getProcessor().onNext(currentPosts);
|
||||
@@ -56,9 +62,12 @@ public class AppStateService {
|
||||
public synchronized void newDownloadJob(DownloadJob downloadJob) {
|
||||
String postId = downloadJob.getImage().getPostId();
|
||||
checkKeyRunningPosts(postId);
|
||||
int i = runningPosts.get(postId).incrementAndGet();
|
||||
if (i > 0) {
|
||||
Post post = currentPosts.get(postId);
|
||||
runningPosts.get(postId).incrementAndGet();
|
||||
}
|
||||
|
||||
public synchronized void postDownloadingUpdate(String postId) {
|
||||
Post post = currentPosts.get(postId);
|
||||
if (!post.getStatus().equals(Post.Status.DOWNLOADING)) {
|
||||
post.setStatus(Post.Status.DOWNLOADING);
|
||||
livePostsState.onNext(post);
|
||||
}
|
||||
@@ -77,9 +86,11 @@ public class AppStateService {
|
||||
} else {
|
||||
if (!Post.Status.STOPPED.equals(post.getStatus())) {
|
||||
post.setStatus(Post.Status.COMPLETE);
|
||||
if (appSettingsService.isClearCompleted()) {
|
||||
remove(image.getPostId());
|
||||
}
|
||||
}
|
||||
}
|
||||
livePostsState.onNext(post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +135,7 @@ public class AppStateService {
|
||||
return toRemove;
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
public static class CachedThread {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -38,6 +39,7 @@ public class ConnectionManager {
|
||||
public HttpClientBuilder getClient() {
|
||||
return HttpClients.custom()
|
||||
.setConnectionManager(pcm)
|
||||
.setRedirectStrategy(new LaxRedirectStrategy())
|
||||
.setRetryHandler(new DefaultHttpRequestRetryHandler(5, true))
|
||||
.setDefaultRequestConfig(rc);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.entities.Post;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -19,8 +20,12 @@ public class PathService {
|
||||
private AppSettingsService appSettingsService;
|
||||
|
||||
public final File getDownloadDestinationFolder(String postId) {
|
||||
String postTitle = appStateService.getCurrentPosts().get(postId).getTitle();
|
||||
return new File(appSettingsService.getDownloadPath(), sanitize(postTitle + "_" + postId));
|
||||
Post post = appStateService.getCurrentPosts().get(postId);
|
||||
String postTitle = post.getTitle();
|
||||
String threadTitle = post.getThreadTitle();
|
||||
File sourceFolder = appSettingsService.isSubLocation() ? new File(appSettingsService.getDownloadPath(), sanitize(post.getForum())) : new File(appSettingsService.getDownloadPath());
|
||||
sourceFolder = appSettingsService.isThreadSubLocation() ? new File(sourceFolder, threadTitle) : sourceFolder;
|
||||
return new File(sourceFolder, sanitize(postTitle + "_" + postId));
|
||||
}
|
||||
|
||||
public final String sanitize(final String folderName) {
|
||||
|
||||
@@ -8,12 +8,14 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.SpringContext;
|
||||
import tn.mnlr.vripper.VripperApplication;
|
||||
import tn.mnlr.vripper.entities.Image;
|
||||
import tn.mnlr.vripper.entities.Post;
|
||||
import tn.mnlr.vripper.entities.mixin.persistance.ImagePersistanceMixin;
|
||||
import tn.mnlr.vripper.entities.mixin.persistance.PostPersistanceMixin;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@@ -23,6 +25,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -36,6 +39,9 @@ public class PersistenceService {
|
||||
@Autowired
|
||||
private AppStateService stateService;
|
||||
|
||||
@Autowired
|
||||
private VripperApplication.AppCommandRunner appCommandRunner;
|
||||
|
||||
private ObjectMapper om;
|
||||
|
||||
private Disposable subscription;
|
||||
@@ -44,22 +50,6 @@ public class PersistenceService {
|
||||
private PublishProcessor<Map<String, Post>> processor = PublishProcessor.create();
|
||||
|
||||
private PersistenceService() {
|
||||
File dataFile = new File(VripperApplication.dataPath);
|
||||
if(!dataFile.exists()) {
|
||||
try {
|
||||
if(dataFile.createNewFile()) {
|
||||
logger.info("Data file successfully created");
|
||||
try (FileWriter fw = new FileWriter(dataFile)) {
|
||||
fw.write("{}");
|
||||
}
|
||||
} else {
|
||||
logger.info("Data file already exists");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to create data file", e);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
om = new ObjectMapper();
|
||||
om.addMixIn(Image.class, ImagePersistanceMixin.class);
|
||||
om.addMixIn(Post.class, PostPersistanceMixin.class);
|
||||
@@ -72,6 +62,32 @@ public class PersistenceService {
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
File dataFile = new File(appCommandRunner.getDataPath());
|
||||
if (!dataFile.exists()) {
|
||||
try {
|
||||
dataFile.getParentFile().mkdirs();
|
||||
if (!dataFile.getParentFile().isDirectory() || !dataFile.getParentFile().canWrite()) {
|
||||
logger.error(String.format("Unable to write in %s", dataFile.getParent()));
|
||||
SpringContext.close();
|
||||
}
|
||||
|
||||
if (dataFile.createNewFile()) {
|
||||
logger.info("Data file successfully created");
|
||||
try (FileWriter fw = new FileWriter(dataFile)) {
|
||||
fw.write("{}");
|
||||
}
|
||||
} else {
|
||||
logger.info("Data file already exists");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to create data file", e);
|
||||
SpringContext.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void preDestroy() {
|
||||
this.subscription.dispose();
|
||||
@@ -82,7 +98,7 @@ public class PersistenceService {
|
||||
|
||||
public void persist(Map<String, Post> currentPosts) {
|
||||
|
||||
try (PrintWriter out = new PrintWriter(VripperApplication.dataPath, "UTF-8")) {
|
||||
try (PrintWriter out = new PrintWriter(appCommandRunner.getDataPath(), "UTF-8")) {
|
||||
out.print(om.writeValueAsString(currentPosts));
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to persist app state", e);
|
||||
@@ -95,6 +111,14 @@ public class PersistenceService {
|
||||
return om.readValue(content, om.getTypeFactory().constructMapType(HashMap.class, String.class, Post.class));
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to read app state", e);
|
||||
long timestamp = new Date().getTime();
|
||||
logger.warn(String.format("trying to rename old data file from %s to %s", appCommandRunner.getDataPath(), appCommandRunner.getDataPath() + "." + timestamp + ".old"));
|
||||
try {
|
||||
Files.move(new File(appCommandRunner.getDataPath()).toPath(), new File(appCommandRunner.getDataPath() + "." + timestamp + ".old").toPath());
|
||||
} catch (IOException ex) {
|
||||
logger.error(String.format("Failed to rename %s to %s", appCommandRunner.getDataPath(), appCommandRunner.getDataPath() + ".old"));
|
||||
SpringContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
return new HashMap<>();
|
||||
@@ -102,12 +126,12 @@ public class PersistenceService {
|
||||
|
||||
public void restore() {
|
||||
|
||||
String jsonContent;
|
||||
String jsonContent = null;
|
||||
try {
|
||||
jsonContent = Files.readAllLines(Paths.get(VripperApplication.dataPath), StandardCharsets.UTF_8).stream().collect(Collectors.joining());
|
||||
jsonContent = Files.readAllLines(Paths.get(appCommandRunner.getDataPath()), StandardCharsets.UTF_8).stream().collect(Collectors.joining());
|
||||
} catch (Exception e) {
|
||||
logger.warn("data file not found, previous state cannot be restored", e);
|
||||
return;
|
||||
logger.error("data file cannot be read, previous state cannot be restored", e);
|
||||
SpringContext.close();
|
||||
}
|
||||
|
||||
Map<String, Post> read = read(jsonContent);
|
||||
|
||||
@@ -309,6 +309,8 @@ public class PostParser {
|
||||
private String postTitle;
|
||||
private int imageCount;
|
||||
|
||||
private String forum;
|
||||
|
||||
private List<String> previews = new ArrayList<>();
|
||||
private List<Image> images = new ArrayList<>();
|
||||
@Getter
|
||||
@@ -327,6 +329,9 @@ public class PostParser {
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
|
||||
switch (qName.toLowerCase()) {
|
||||
case "forum":
|
||||
forum = attributes.getValue("title").trim();
|
||||
break;
|
||||
case "thread":
|
||||
threadTitle = attributes.getValue("title").trim();
|
||||
break;
|
||||
@@ -370,7 +375,9 @@ public class PostParser {
|
||||
images,
|
||||
metadata,
|
||||
postId,
|
||||
threadId
|
||||
threadId,
|
||||
threadTitle,
|
||||
forum
|
||||
);
|
||||
}
|
||||
index = 0;
|
||||
|
||||
+38
-29
@@ -34,9 +34,10 @@ public class SettingsRestEndpoint {
|
||||
@PostMapping("/settings/theme")
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public AppSettingsService.Theme postTheme(@RequestBody AppSettingsService.Theme theme) {
|
||||
|
||||
this.settings.setTheme(theme);
|
||||
return settings.getTheme();
|
||||
synchronized (this.settings) {
|
||||
this.settings.setTheme(theme);
|
||||
return settings.getTheme();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/settings/theme")
|
||||
@@ -49,33 +50,38 @@ public class SettingsRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public ResponseEntity postSettings(@RequestBody AppSettingsService.Settings settings) throws Exception {
|
||||
|
||||
try {
|
||||
this.settings.check(settings);
|
||||
} catch (ValidationException e) {
|
||||
return new ResponseEntity(new Response(e.getMessage()), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
this.settings.setDownloadPath(settings.getDownloadPath());
|
||||
this.settings.setMaxThreads(settings.getMaxThreads());
|
||||
this.settings.setAutoStart(settings.isAutoStart());
|
||||
this.settings.setVLogin(settings.isVLogin());
|
||||
|
||||
if(settings.isVLogin()) {
|
||||
this.settings.setVUsername(settings.getVUsername());
|
||||
if (!this.settings.getVPassword().equals(settings.getVPassword())) {
|
||||
this.settings.setVPassword(settings.getVPassword());
|
||||
synchronized (this.settings) {
|
||||
try {
|
||||
this.settings.check(settings);
|
||||
} catch (ValidationException e) {
|
||||
return new ResponseEntity(new Response(e.getMessage()), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
this.settings.setVThanks(settings.isVThanks());
|
||||
} else {
|
||||
this.settings.setVUsername("");
|
||||
this.settings.setVPassword("");
|
||||
this.settings.setVThanks(false);
|
||||
this.settings.setDownloadPath(settings.getDownloadPath());
|
||||
this.settings.setMaxThreads(settings.getMaxThreads());
|
||||
this.settings.setAutoStart(settings.isAutoStart());
|
||||
this.settings.setVLogin(settings.isVLogin());
|
||||
|
||||
if (settings.isVLogin()) {
|
||||
this.settings.setVUsername(settings.getVUsername());
|
||||
if (!this.settings.getVPassword().equals(settings.getVPassword())) {
|
||||
this.settings.setVPassword(settings.getVPassword());
|
||||
}
|
||||
this.settings.setVThanks(settings.isVThanks());
|
||||
} else {
|
||||
this.settings.setVUsername("");
|
||||
this.settings.setVPassword("");
|
||||
this.settings.setVThanks(false);
|
||||
}
|
||||
this.settings.setDesktopClipboard(settings.isDesktopClipboard());
|
||||
this.settings.setForceOrder(settings.isForceOrder());
|
||||
this.settings.setSubLocation(settings.isSubLocation());
|
||||
this.settings.setThreadSubLocation(settings.isThreadSubLocation());
|
||||
this.settings.setClearCompleted(settings.isClearCompleted());
|
||||
|
||||
this.settings.save();
|
||||
|
||||
vipergirlsAuthService.authenticate();
|
||||
}
|
||||
this.settings.setDesktopClipboard(settings.isDesktopClipboard());
|
||||
this.settings.setForceOrder(settings.isForceOrder());
|
||||
|
||||
this.settings.save();
|
||||
|
||||
vipergirlsAuthService.authenticate();
|
||||
return ResponseEntity.ok(getSettings());
|
||||
}
|
||||
|
||||
@@ -92,7 +98,10 @@ public class SettingsRestEndpoint {
|
||||
settings.getVPassword(),
|
||||
settings.isVThanks(),
|
||||
settings.isDesktopClipboard(),
|
||||
settings.isForceOrder()
|
||||
settings.isForceOrder(),
|
||||
settings.isSubLocation(),
|
||||
settings.isThreadSubLocation(),
|
||||
settings.isClearCompleted()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
base.dir=${user.home}
|
||||
@@ -0,0 +1 @@
|
||||
base.dir=${user.dir}
|
||||
@@ -1,8 +1,10 @@
|
||||
logging.level.org.springframework.web=INFO
|
||||
logging.level.root=INFO
|
||||
logging.level.org.apache.http=INFO
|
||||
logging.file=${user.dir}/vripper.log
|
||||
logging.file=${base.dir}/.vripper/vripper.log
|
||||
server.port=${vripper.server.port:8080}
|
||||
management.endpoints.web.exposure.include=shutdown
|
||||
management.endpoint.shutdown.enabled=true
|
||||
endpoints.shutdown.enabled=true
|
||||
endpoints.shutdown.enabled=true
|
||||
#spring.profiles.active=portable
|
||||
spring.profiles.active=installer
|
||||
Generated
+7
-7
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "1.6.1",
|
||||
"version": "2.2.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -3510,9 +3510,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"electron": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.4.tgz",
|
||||
"integrity": "sha512-zrPi36etADOAjxnVX6TxRNKSWaBscMLd9S7AB+qISzI0dnYIDKycHpc2mB+5QWBd/8cR4m/1NLNTqNhX5KKGFg==",
|
||||
"version": "6.0.9",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.9.tgz",
|
||||
"integrity": "sha512-lFpSmDNyjpvJFwEnK897Soone3DV7D3ASFUb315H2VTVZSbKib9Kbrsovxf4c+e1q5hTdaONsGIm3Lb4CXIW1g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "^10.12.18",
|
||||
@@ -3521,9 +3521,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "10.14.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.16.tgz",
|
||||
"integrity": "sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA==",
|
||||
"version": "10.14.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz",
|
||||
"integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "1.6.1",
|
||||
"version": "2.2.3",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
@@ -42,7 +42,7 @@
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "~8.9.4",
|
||||
"codelyzer": "~4.5.0",
|
||||
"electron": "^6.0.4",
|
||||
"electron": "^6.0.9",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "^4.2.0",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<version>2.2.3</version>
|
||||
</parent>
|
||||
<artifactId>vripper-ui</artifactId>
|
||||
<name>vripper-ui</name>
|
||||
|
||||
@@ -19,7 +19,3 @@
|
||||
.no-connection {
|
||||
color: #eb6060;
|
||||
}
|
||||
|
||||
.electron {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
// mixin name will be used in main style.scss
|
||||
@mixin app-component-theme($theme) {
|
||||
|
||||
// retrieve variables from theme
|
||||
// (all possible variables, use only what you really need)
|
||||
$primary: map-get($theme, primary);
|
||||
$accent: map-get($theme, accent);
|
||||
$warn: map-get($theme, accent);
|
||||
$foreground: map-get($theme, foreground);
|
||||
|
||||
$background: map-get($theme, background);
|
||||
|
||||
// all of these variables contain many additional variables
|
||||
|
||||
button.add-button {
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
<mat-progress-spinner [mode]="spinnerMode" [value]="spinnerValue" style="position: absolute;"></mat-progress-spinner>
|
||||
</div>
|
||||
<div fxLayout="column" fxLayoutGap="10px" style="height: 100%">
|
||||
<div [fxFlex]="electronService.isElectronApp ? '0 0 calc(100% - 117px)' : '0 0 calc(100% - 90px)'">
|
||||
<div fxFlex="0 0 calc(100% - 90px)">
|
||||
<app-posts
|
||||
[ngStyle]="{ height: electronService.isElectronApp ? 'calc(100% - 37px)' : '100%' }"
|
||||
style="width: 100%;"
|
||||
style="width: 100%; height: 100%;"
|
||||
></app-posts>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container" style="height: 100%; background-color: snow">
|
||||
<div class="container" style="height: 100%; background-color: white">
|
||||
<div
|
||||
[ngClass]="{
|
||||
'pending-back': postDetails.status === 'PENDING'
|
||||
error: postDetails.status === 'ERROR'
|
||||
}"
|
||||
class="progress-bar-back"
|
||||
style="position: relative; height: 100%;"
|
||||
@@ -12,19 +12,19 @@
|
||||
fxLayoutAlign="space-between"
|
||||
style="background-color: transparent; width: 100%; height: 100%;"
|
||||
>
|
||||
<div class="progress-bar" style="position: absolute; width: 100%; top: 37px; padding: 0 50px">
|
||||
<div class="progress-bar" style="position: absolute; width: 100%; top: 37px; padding: 0 20px">
|
||||
<mat-progress-bar [value]="postDetails.progress" class="example-margin" color="primary" mode="determinate">
|
||||
</mat-progress-bar>
|
||||
</div>
|
||||
<span fxLayout="row">
|
||||
<span style="padding-left: 50px"
|
||||
<span style="padding-left: 20px"
|
||||
><a (click)="goTo()" href="javascript:void(0)" style="color: rgba(0, 0, 0, 0.87);">{{
|
||||
postDetails.url
|
||||
}}</a></span
|
||||
>
|
||||
<span class="filler" fxFlex="grow"></span>
|
||||
</span>
|
||||
<span class="progress-percentage" style="padding-right: 50px">{{ trunc(postDetails.progress) + '%' }}</span>
|
||||
<span class="progress-percentage" style="padding-right: 20px">{{ trunc(postDetails.progress) + '%' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.progress-bar-back {
|
||||
transition: background-color 0.5s;
|
||||
}
|
||||
.pending {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
@mixin post-detail-renderer-component-theme($theme) {
|
||||
$blue: mat-palette($mat-blue);
|
||||
$red: mat-palette($mat-red);
|
||||
|
||||
.progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($blue, 300);
|
||||
}
|
||||
|
||||
.progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($blue, 100);
|
||||
}
|
||||
|
||||
app-details-cell .error {
|
||||
background-color: mat-color($red, 50);
|
||||
& .progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($red, 300);
|
||||
}
|
||||
& .progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($red, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { ICellRendererParams } from 'ag-grid-community';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
|
||||
@Component({
|
||||
selector: 'app-progress-cell',
|
||||
selector: 'app-details-cell',
|
||||
templateUrl: 'post-details-progress.component.html',
|
||||
styleUrls: ['post-details-progress.component.scss']
|
||||
})
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<div class="container" style="height: 100%; background-color: snow">
|
||||
<div class="container" style="height: 100%; background-color: white">
|
||||
<div
|
||||
[ngClass]="{
|
||||
'pending-back': postState.status === 'PENDING'
|
||||
'error': postState.status === 'ERROR',
|
||||
'downloading': postState.status === 'DOWNLOADING' || postState.status === 'PARTIAL',
|
||||
'complete': postState.status === 'COMPLETE',
|
||||
'stopped': postState.status === 'STOPPED'
|
||||
}"
|
||||
class="progress-bar-back"
|
||||
style="position: relative; height: 100%; max-height: 48px;"
|
||||
@@ -12,7 +15,7 @@
|
||||
fxLayoutAlign="space-between"
|
||||
style="background-color: transparent; width: 100%; height: 100%;"
|
||||
>
|
||||
<div class="progress-bar" style="position: absolute; width: 100%; top: 37px; padding: 0 50px">
|
||||
<div class="progress-bar" color="accent" style="position: absolute; width: 100%; top: 37px; padding: 0 50px">
|
||||
<mat-progress-bar [value]="postState.progress" class="example-margin" color="primary" mode="determinate">
|
||||
</mat-progress-bar>
|
||||
</div>
|
||||
@@ -39,7 +42,6 @@
|
||||
<button
|
||||
(click)="restart()"
|
||||
*ngIf="
|
||||
postState.status === 'PENDING' ||
|
||||
(postState.status === 'COMPLETE' && postState.progress !== 100) ||
|
||||
postState.status === 'ERROR' ||
|
||||
postState.status === 'STOPPED'
|
||||
@@ -51,7 +53,7 @@
|
||||
</button>
|
||||
<button
|
||||
(click)="stop()"
|
||||
*ngIf="postState.status === 'DOWNLOADING' || postState.status === 'PARTIAL'"
|
||||
*ngIf="postState.status === 'DOWNLOADING' || postState.status === 'PARTIAL' || postState.status === 'PENDING'"
|
||||
mat-menu-item
|
||||
>
|
||||
<ng-container>
|
||||
@@ -61,7 +63,7 @@
|
||||
</button>
|
||||
<button (click)="seeDetails()" mat-menu-item>
|
||||
<mat-icon>list</mat-icon>
|
||||
<span>Details</span>
|
||||
<span>Files</span>
|
||||
</button>
|
||||
<button (click)="remove()" mat-menu-item>
|
||||
<mat-icon>delete</mat-icon>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
.progress-bar-back {
|
||||
transition: background-color 0.5s;
|
||||
}
|
||||
.pending-back {
|
||||
background-color: snow;
|
||||
}
|
||||
|
||||
.table {
|
||||
display: table;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
@mixin post-progress-renderer-component-theme($theme) {
|
||||
$red: mat-palette($mat-red);
|
||||
$grey: mat-palette($mat-grey);
|
||||
$green: mat-palette($mat-green);
|
||||
|
||||
app-progress-cell .progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($grey, 400);
|
||||
}
|
||||
|
||||
app-progress-cell .progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($grey, 200);
|
||||
}
|
||||
|
||||
app-progress-cell .error {
|
||||
background-color: mat-color($red, 50);
|
||||
& .progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($red, 300);
|
||||
}
|
||||
& .progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($red, 100);
|
||||
}
|
||||
}
|
||||
|
||||
app-progress-cell .downloading {
|
||||
background-color: mat-color($green, 50);
|
||||
& .progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($green, 300);
|
||||
}
|
||||
& .progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($green, 100);
|
||||
}
|
||||
}
|
||||
|
||||
app-progress-cell .complete {
|
||||
background-color: mat-color($green, 100);
|
||||
& .progress-bar .mat-progress-bar-fill::after {
|
||||
background-color: mat-color($green, 300);
|
||||
}
|
||||
& .progress-bar .mat-progress-bar-buffer {
|
||||
background-color: mat-color($green, 100);
|
||||
}
|
||||
}
|
||||
|
||||
app-progress-cell .stopped {
|
||||
background-color: mat-color($grey, 100);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<h2 class="no-wrap" mat-dialog-title>Scan</h2>
|
||||
</div>
|
||||
<mat-dialog-content fxFlex="grow" fxLayout="column">
|
||||
<div *ngIf="threadId == null || !clipboard">
|
||||
<div *ngIf="!hideScan">
|
||||
<form
|
||||
#f="ngForm"
|
||||
(ngSubmit)="submit(f)"
|
||||
|
||||
@@ -26,10 +26,11 @@ export class ScanComponent implements OnInit {
|
||||
|
||||
input: string;
|
||||
threadId: string;
|
||||
clipboard = false;
|
||||
hideScan = false;
|
||||
|
||||
submit(form: NgForm) {
|
||||
this.ngZone.run(() => {
|
||||
this.hideScan = true;
|
||||
this.threadId = null;
|
||||
this.processUrl(this.input, form);
|
||||
});
|
||||
@@ -93,7 +94,7 @@ export class ScanComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.ngZone.run(() => {
|
||||
if (this.data.url != null) {
|
||||
this.clipboard = true;
|
||||
this.hideScan = true;
|
||||
this.processUrl(this.data.url);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<div fxLayout="column" class="dialog-container" style="height: 100%;">
|
||||
<div fxFlex="nogrow" fxLayout="row" fxLayoutAlign="space-between center">
|
||||
<h2 class="no-wrap" mat-dialog-title>Settings</h2>
|
||||
<mat-slide-toggle (change)="updateTheme()" [(ngModel)]="darkTheme">{{darkTheme ? 'Dark theme' : 'Light theme'}}
|
||||
<mat-slide-toggle (change)="updateTheme()" [(ngModel)]="darkTheme"
|
||||
>{{ darkTheme ? 'Dark theme' : 'Light theme' }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<mat-dialog-content fxFlex="grow">
|
||||
@@ -37,15 +38,27 @@
|
||||
/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox color="primary" formControlName="subLocation" name="subLocation"
|
||||
>Save posts in sub folders
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-checkbox *ngIf="generalSettingsForm.get('subLocation').value" color="primary"
|
||||
formControlName="threadSubLocation" name="threadSubLocation" style="margin-left: 15px"
|
||||
>Create a subfolder per thread
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-checkbox color="primary" formControlName="forceOrder" name="forceOrder"
|
||||
>Force image ordering (prepend incremental numbers)
|
||||
</mat-checkbox
|
||||
>
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-checkbox color="primary" formControlName="autoStart" name="autoStart"
|
||||
>Auto start downloads</mat-checkbox
|
||||
>
|
||||
|
||||
<mat-checkbox color="primary" formControlName="clearCompleted" name="clearCompleted"
|
||||
>Clear Finished
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-slide-toggle color="primary" formControlName="vLogin" name="vLogin">
|
||||
ViperGirls Authentication
|
||||
</mat-slide-toggle>
|
||||
@@ -88,7 +101,11 @@
|
||||
(click)="onSubmit()"
|
||||
color="primary"
|
||||
type="submit"
|
||||
[disabled]="(generalSettingsForm.pristine && desktopSettingsForm.pristine) || generalSettingsForm.invalid || desktopSettingsForm.invalid"
|
||||
[disabled]="
|
||||
(generalSettingsForm.pristine && desktopSettingsForm.pristine) ||
|
||||
generalSettingsForm.invalid ||
|
||||
desktopSettingsForm.invalid
|
||||
"
|
||||
>
|
||||
Apply
|
||||
</button>
|
||||
|
||||
@@ -29,10 +29,13 @@ export class SettingsComponent implements OnInit {
|
||||
maxThreads: new FormControl(''),
|
||||
autoStart: new FormControl(false),
|
||||
forceOrder: new FormControl(false),
|
||||
subLocation: new FormControl(false),
|
||||
threadSubLocation: new FormControl(false),
|
||||
clearCompleted: new FormControl(false),
|
||||
vLogin: new FormControl(false),
|
||||
vUsername: new FormControl(''),
|
||||
vPassword: new FormControl(''),
|
||||
vThanks: new FormControl(false)
|
||||
vThanks: new FormControl(false),
|
||||
});
|
||||
|
||||
desktopSettingsForm = new FormGroup({
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
// mixin name will be used in main style.scss
|
||||
@mixin status-bar-component-theme($theme) {
|
||||
|
||||
// retrieve variables from theme
|
||||
// (all possible variables, use only what you really need)
|
||||
$primary: map-get($theme, primary);
|
||||
$accent: map-get($theme, accent);
|
||||
$warn: map-get($theme, accent);
|
||||
$foreground: map-get($theme, foreground);
|
||||
$background: map-get($theme, background);
|
||||
|
||||
// all of these variables contain many additional variables
|
||||
|
||||
.status-bar {
|
||||
|
||||
background-color: mat-color($background, status-bar);
|
||||
color: mat-color($foreground, base);
|
||||
}
|
||||
}
|
||||
$foreground: map-get($theme, foreground);
|
||||
$background: map-get($theme, background);
|
||||
|
||||
.status-bar {
|
||||
background-color: mat-color($background, status-bar);
|
||||
color: mat-color($foreground, base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>VripperUi</title>
|
||||
<title>V Ripper</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
@import 'mat-theme.scss';
|
||||
@import 'app/status-bar/status-bar.component.scss.theme.scss';
|
||||
@import 'app/app.component.scss-theme.scss';
|
||||
@import 'app/posts/post-progress.renderer.component.scss-theme.scss';
|
||||
@import 'app/post-detail/post-details-progress.component.scss-theme.scss';
|
||||
@import 'grid-theme.scss';
|
||||
|
||||
@mixin custom-components-theme($theme) {
|
||||
@include status-bar-component-theme($theme);
|
||||
@include app-component-theme($theme);
|
||||
@include post-progress-renderer-component-theme($theme);
|
||||
@include post-detail-renderer-component-theme($theme);
|
||||
}
|
||||
|
||||
.dark-theme {
|
||||
|
||||
Reference in New Issue
Block a user