mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
335cbf70b4 | ||
|
|
e25d306f1d | ||
|
|
f395338a9d | ||
|
|
58a40682cc | ||
|
|
ccc4032bb0 | ||
|
|
1c5b8a0397 | ||
|
|
cc2ce9482d | ||
|
|
41f1775360 | ||
|
|
733f1a08ac |
@@ -1,5 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## [3.3.4] - 2021-03-18
|
||||
|
||||
### Changed
|
||||
|
||||
- Bug fixes
|
||||
|
||||
## [3.3.3] - 2021-03-13
|
||||
|
||||
### Changed
|
||||
|
||||
- Remove unnecessary event logs
|
||||
|
||||
## [3.3.2] - 2021-03-11
|
||||
|
||||
### Changed
|
||||
|
||||
- Fix a bug with event logs
|
||||
- Change event names and add some icons
|
||||
|
||||
## [3.3.1] - 2021-02-18
|
||||
|
||||
### Added
|
||||
|
||||
- Add about menu
|
||||
|
||||
### Changed
|
||||
|
||||
- Fix README.md
|
||||
|
||||
## [3.3.0] - 2021-02-16
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Viper Ripper!
|
||||
# VRipper!
|
||||
|
||||
This is my spin for a cross platform gallery ripper app for [vipergirls](https://vipergirls.to) website.
|
||||
The purpose of this project is to build a robust and clean application to conveniently download photo galleries using modern web technologies, Java + Spring boot for the back end and angular + electron for the front end.
|
||||
@@ -15,8 +15,16 @@ Most people will be interested only on the desktop app, however if you have a na
|
||||
To build the server app:
|
||||
|
||||
mvn clean install -DskipTests
|
||||
|
||||
To build the desktop app:
|
||||
|
||||
mvn clean install -Pelectron -DskipTests
|
||||
|
||||
Maven will automatically handle front end compilation. However, for development, you will need to install a recent version of nodejs on your system.
|
||||
Maven will automatically handle front end compilation. However, for development, you will need to install a recent
|
||||
version of nodejs on your system.
|
||||
|
||||
If you feel generous and want to support me, you can donate some coins, and I would be very grateful 🙏
|
||||
|
||||
I accept Bitcoin (BTC) for donations, following is my address
|
||||
|
||||
bc1q9jzzw3st49r9vmxgtylq4vrd67cl7zfclf3lsq
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.3.4</version>
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
Generated
-2486
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "3.3.0",
|
||||
"version": "3.3.4",
|
||||
"description": "A ripper for vipergirls.to built using web technolgies",
|
||||
"main": "main.js",
|
||||
"author": "death-claw <53543762+death-claw@users.noreply.github.com>",
|
||||
|
||||
+10
-11
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.3.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-electron</artifactId>
|
||||
<name>vripper-electron</name>
|
||||
@@ -39,34 +39,33 @@
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.11.2</version>
|
||||
<configuration>
|
||||
<nodeVersion>v12.2.0</nodeVersion>
|
||||
<npmVersion>6.9.0</npmVersion>
|
||||
<nodeVersion>v14.16.0</nodeVersion>
|
||||
<yarnVersion>v1.22.10</yarnVersion>
|
||||
<workingDirectory>build-dir</workingDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
<id>install node and yarn</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
<goal>install-node-and-yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<id>yarn install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm run build</id>
|
||||
<id>yarn run build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run dist</arguments>
|
||||
</configuration>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.3.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<name>vripper-server</name>
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package tn.mnlr.vripper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@Slf4j
|
||||
public class Utils {
|
||||
|
||||
public static String throwableToString(Throwable th) throws IOException {
|
||||
public static String throwableToString(Throwable th) {
|
||||
try (StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter)) {
|
||||
th.printStackTrace(printWriter);
|
||||
printWriter.flush();
|
||||
stringWriter.flush();
|
||||
return stringWriter.toString();
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to convert throwable to string", e);
|
||||
}
|
||||
return "Cannot display error, please check the log file for details";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ public class Event {
|
||||
METADATA,
|
||||
SCAN,
|
||||
DOWNLOAD,
|
||||
|
||||
// Below are deprecated events
|
||||
METADATA_CACHE_MISS,
|
||||
QUEUED_CACHE_MISS
|
||||
}
|
||||
|
||||
@@ -14,9 +14,18 @@ public class Metadata {
|
||||
|
||||
private Long postIdRef;
|
||||
|
||||
private String PostId;
|
||||
private String postId;
|
||||
|
||||
private String postedBy;
|
||||
|
||||
private List<String> resolvedNames = Collections.emptyList();
|
||||
|
||||
public static Metadata from(Metadata metadata) {
|
||||
Metadata copy = new Metadata();
|
||||
copy.postIdRef = metadata.postIdRef;
|
||||
copy.postId = metadata.postId;
|
||||
copy.postedBy = metadata.postedBy;
|
||||
copy.resolvedNames = List.copyOf(metadata.resolvedNames);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,16 @@ import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import tn.mnlr.vripper.exception.DownloadException;
|
||||
import tn.mnlr.vripper.exception.PostParseException;
|
||||
import tn.mnlr.vripper.jpa.domain.Event;
|
||||
import tn.mnlr.vripper.jpa.domain.Metadata;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.repositories.IEventRepository;
|
||||
import tn.mnlr.vripper.services.domain.tasks.MetadataRunnable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -43,16 +39,13 @@ public class MetadataService {
|
||||
private final XpathService xpathService;
|
||||
private final Map<String, MetadataRunnable> fetchingMetadata = new ConcurrentHashMap<>();
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final IEventRepository eventRepository;
|
||||
|
||||
@Autowired
|
||||
public MetadataService(ConnectionService cm, VGAuthService VGAuthService, HtmlProcessorService htmlProcessorService, XpathService xpathService, ThreadPoolService threadPoolService, IEventRepository eventRepository) {
|
||||
public MetadataService(ConnectionService cm, VGAuthService VGAuthService, HtmlProcessorService htmlProcessorService, XpathService xpathService, ThreadPoolService threadPoolService) {
|
||||
this.cm = cm;
|
||||
this.VGAuthService = VGAuthService;
|
||||
this.htmlProcessorService = htmlProcessorService;
|
||||
this.xpathService = xpathService;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.eventRepository = eventRepository;
|
||||
|
||||
CacheLoader<Key, Metadata> loader = new CacheLoader<>() {
|
||||
@Override
|
||||
@@ -65,30 +58,9 @@ public class MetadataService {
|
||||
.build(loader);
|
||||
}
|
||||
|
||||
public Metadata get(Post post) {
|
||||
Metadata metadata = new Metadata();
|
||||
public Metadata get(Post post) throws ExecutionException {
|
||||
Key key = new Key(post.getPostId(), post.getThreadId(), post.getUrl());
|
||||
Metadata cachedMetadata = cache.getIfPresent(key);
|
||||
if (cachedMetadata == null) {
|
||||
Event event = new Event(Event.Type.METADATA_CACHE_MISS, Event.Status.PROCESSING, LocalDateTime.now(), "Loading metadata for " + post.getUrl());
|
||||
eventRepository.save(event);
|
||||
try {
|
||||
cachedMetadata = cache.get(key);
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
} catch (ExecutionException e) {
|
||||
String error = "Failed to load metadata for " + post.getUrl();
|
||||
log.error(error, e);
|
||||
event.setStatus(Event.Status.ERROR);
|
||||
event.setMessage(error + ": " + e.getMessage());
|
||||
eventRepository.update(event);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
metadata.setPostedBy(cachedMetadata.getPostedBy());
|
||||
metadata.setPostId(cachedMetadata.getPostId());
|
||||
metadata.setResolvedNames(List.copyOf(cachedMetadata.getResolvedNames()));
|
||||
return metadata;
|
||||
return Metadata.from(cache.get(key));
|
||||
}
|
||||
|
||||
public void startFetchingMetadata(Post post) {
|
||||
|
||||
@@ -7,23 +7,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.jpa.domain.Event;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.jpa.domain.Queued;
|
||||
import tn.mnlr.vripper.jpa.repositories.IEventRepository;
|
||||
import tn.mnlr.vripper.services.domain.ApiThreadParser;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostItem;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostScanParser;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostScanResult;
|
||||
import tn.mnlr.vripper.services.domain.tasks.AddPostRunnable;
|
||||
import tn.mnlr.vripper.services.domain.tasks.AddQueuedRunnable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static tn.mnlr.vripper.jpa.domain.Event.Status.DONE;
|
||||
import static tn.mnlr.vripper.jpa.domain.Event.Status.PROCESSING;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PostService {
|
||||
@@ -31,21 +25,18 @@ public class PostService {
|
||||
private final DataService dataService;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final MetadataService metadataService;
|
||||
private final IEventRepository eventRepository;
|
||||
private final LoadingCache<Queued, List<MultiPostItem>> cache;
|
||||
private final LoadingCache<Queued, MultiPostScanResult> cache;
|
||||
|
||||
@Autowired
|
||||
public PostService(DataService dataService, ThreadPoolService threadPoolService, MetadataService metadataService, IEventRepository eventRepository) {
|
||||
public PostService(DataService dataService, ThreadPoolService threadPoolService, MetadataService metadataService) {
|
||||
this.dataService = dataService;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.metadataService = metadataService;
|
||||
this.eventRepository = eventRepository;
|
||||
|
||||
CacheLoader<Queued, List<MultiPostItem>> loader = new CacheLoader<>() {
|
||||
CacheLoader<Queued, MultiPostScanResult> loader = new CacheLoader<>() {
|
||||
@Override
|
||||
public List<MultiPostItem> load(@NonNull Queued multiPostItem) throws Exception {
|
||||
ApiThreadParser apiThreadParser = new ApiThreadParser(multiPostItem);
|
||||
return apiThreadParser.parse();
|
||||
public MultiPostScanResult load(@NonNull Queued multiPostItem) throws Exception {
|
||||
return new MultiPostScanParser(multiPostItem).parse();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,27 +59,8 @@ public class PostService {
|
||||
}
|
||||
}
|
||||
|
||||
public List<MultiPostItem> get(Queued queued) {
|
||||
List<MultiPostItem> multiPostItems;
|
||||
multiPostItems = cache.getIfPresent(queued);
|
||||
if (multiPostItems == null) {
|
||||
Event event = new Event(Event.Type.QUEUED_CACHE_MISS, PROCESSING, LocalDateTime.now(), "Loading posts from " + queued.getLink());
|
||||
eventRepository.save(event);
|
||||
try {
|
||||
multiPostItems = cache.get(queued);
|
||||
event.setStatus(DONE);
|
||||
event.setMessage("Loaded " + multiPostItems.size() + " posts from " + queued.getLink());
|
||||
eventRepository.update(event);
|
||||
} catch (ExecutionException e) {
|
||||
String error = String.format("Failed to parse link %s", queued.getLink());
|
||||
log.error(error, e);
|
||||
event.setStatus(Event.Status.ERROR);
|
||||
event.setMessage(error + ": " + e.getMessage());
|
||||
eventRepository.update(event);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return multiPostItems;
|
||||
public MultiPostScanResult get(Queued queued) throws ExecutionException {
|
||||
return cache.get(queued);
|
||||
}
|
||||
|
||||
public void remove(String threadId) {
|
||||
|
||||
@@ -268,6 +268,10 @@ public class SettingsService {
|
||||
if (settings.getMaxEventLog() < 100 || settings.getMaxEventLog() > 10_000) {
|
||||
throw new ValidationException(String.format("Invalid maximum event log record settings, values must be in [%d,%d]", 100, 10_000));
|
||||
}
|
||||
|
||||
if (!settings.getVThanks() && settings.getLeaveThanksOnStart() != null && settings.getLeaveThanksOnStart()) {
|
||||
throw new ValidationException("Invalid value, leave thanks must be checked");
|
||||
}
|
||||
}
|
||||
|
||||
public Theme getTheme() {
|
||||
|
||||
+10
-4
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -12,14 +11,14 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ApiThreadHandler extends DefaultHandler {
|
||||
public class MultiPostScanHandler extends DefaultHandler {
|
||||
|
||||
private final Queued queued;
|
||||
private final Collection<Host> supportedHosts;
|
||||
private final SettingsService settingsService;
|
||||
private final Map<Host, AtomicInteger> hostMap = new HashMap<>();
|
||||
@Getter
|
||||
private final List<MultiPostItem> posts = new ArrayList<>();
|
||||
private String error;
|
||||
private List<String> previews = new ArrayList<>();
|
||||
private String threadTitle;
|
||||
private String postId;
|
||||
@@ -28,12 +27,16 @@ public class ApiThreadHandler extends DefaultHandler {
|
||||
private int postCounter;
|
||||
private int previewCounter = 0;
|
||||
|
||||
public ApiThreadHandler(Queued queued) {
|
||||
public MultiPostScanHandler(Queued queued) {
|
||||
this.queued = queued;
|
||||
supportedHosts = SpringContext.getBeansOfType(Host.class).values();
|
||||
settingsService = SpringContext.getBean(SettingsService.class);
|
||||
}
|
||||
|
||||
public MultiPostScanResult getScanResult() {
|
||||
return new MultiPostScanResult(posts, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDocument() {
|
||||
}
|
||||
@@ -42,6 +45,9 @@ public class ApiThreadHandler extends DefaultHandler {
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
|
||||
switch (qName.toLowerCase()) {
|
||||
case "error":
|
||||
error = attributes.getValue("details");
|
||||
break;
|
||||
case "thread":
|
||||
threadTitle = attributes.getValue("title").trim();
|
||||
break;
|
||||
+9
-9
@@ -18,11 +18,10 @@ 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 {
|
||||
public class MultiPostScanParser {
|
||||
|
||||
private static final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
private final Queued queued;
|
||||
@@ -30,14 +29,14 @@ public class ApiThreadParser {
|
||||
private final VGAuthService VGAuthService;
|
||||
private final SettingsService settingsService;
|
||||
|
||||
public ApiThreadParser(Queued queued) {
|
||||
public MultiPostScanParser(Queued queued) {
|
||||
this.queued = queued;
|
||||
cm = SpringContext.getBean(ConnectionService.class);
|
||||
VGAuthService = SpringContext.getBean(VGAuthService.class);
|
||||
settingsService = SpringContext.getBean(SettingsService.class);
|
||||
}
|
||||
|
||||
public List<MultiPostItem> parse() throws PostParseException {
|
||||
public MultiPostScanResult parse() throws PostParseException {
|
||||
|
||||
log.debug(String.format("Parsing thread %s", queued));
|
||||
HttpGet httpGet;
|
||||
@@ -49,10 +48,10 @@ public class ApiThreadParser {
|
||||
throw new PostParseException(e);
|
||||
}
|
||||
|
||||
ApiThreadHandler apiThreadHandler = new ApiThreadHandler(queued);
|
||||
MultiPostScanHandler multiPostScanHandler = new MultiPostScanHandler(queued);
|
||||
AtomicReference<Throwable> thr = new AtomicReference<>();
|
||||
log.debug(String.format("Requesting %s", httpGet));
|
||||
List<MultiPostItem> posts = Failsafe.with(cm.getRetryPolicy())
|
||||
MultiPostScanResult multiPostScanResult = Failsafe.with(cm.getRetryPolicy())
|
||||
.onFailure(e -> thr.set(e.getFailure()))
|
||||
.get(() -> {
|
||||
HttpClient connection = cm.getClient().build();
|
||||
@@ -62,8 +61,9 @@ public class ApiThreadParser {
|
||||
}
|
||||
|
||||
try {
|
||||
factory.newSAXParser().parse(new BufferedInputStream(response.getEntity().getContent()), apiThreadHandler);
|
||||
return apiThreadHandler.getPosts();
|
||||
// System.out.println(EntityUtils.toString(response.getEntity()));
|
||||
factory.newSAXParser().parse(new BufferedInputStream(response.getEntity().getContent()), multiPostScanHandler);
|
||||
return multiPostScanHandler.getScanResult();
|
||||
} catch (Exception e) {
|
||||
throw new PostParseException(String.format("Failed to parse thread %s", queued), e);
|
||||
} finally {
|
||||
@@ -75,6 +75,6 @@ public class ApiThreadParser {
|
||||
log.error(String.format("parsing failed for thread %s", queued), thr.get());
|
||||
throw new PostParseException(thr.get());
|
||||
}
|
||||
return posts;
|
||||
return multiPostScanResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package tn.mnlr.vripper.services.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class MultiPostScanResult {
|
||||
private final List<MultiPostItem> posts;
|
||||
private final String error;
|
||||
|
||||
public MultiPostScanResult(List<MultiPostItem> posts, String error) {
|
||||
this.posts = posts;
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -16,7 +16,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
class ApiPostHandler extends DefaultHandler {
|
||||
class PostScanHandler extends DefaultHandler {
|
||||
|
||||
private final Collection<Host> supportedHosts;
|
||||
|
||||
@@ -32,7 +32,7 @@ class ApiPostHandler extends DefaultHandler {
|
||||
|
||||
private Post parsedPost;
|
||||
|
||||
ApiPostHandler(String threadId, String postId) {
|
||||
PostScanHandler(String threadId, String postId) {
|
||||
this.threadId = threadId;
|
||||
this.postId = postId;
|
||||
supportedHosts = SpringContext.getBeansOfType(Host.class).values();
|
||||
@@ -41,8 +41,8 @@ class ApiPostHandler extends DefaultHandler {
|
||||
}
|
||||
|
||||
|
||||
public ApiPost getParsedPost() {
|
||||
return new ApiPost(parsedPost, images);
|
||||
public PostScanResult getParsedPost() {
|
||||
return new PostScanResult(parsedPost, images);
|
||||
}
|
||||
|
||||
@Override
|
||||
+8
-8
@@ -19,7 +19,7 @@ import java.net.URISyntaxException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
public class ApiPostParser {
|
||||
public class PostScanParser {
|
||||
|
||||
private static final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ApiPostParser {
|
||||
private final VGAuthService VGAuthService;
|
||||
private final SettingsService settingsService;
|
||||
|
||||
public ApiPostParser(String threadId, String postId) {
|
||||
public PostScanParser(String threadId, String postId) {
|
||||
this.threadId = threadId;
|
||||
this.postId = postId;
|
||||
cm = SpringContext.getBean(ConnectionService.class);
|
||||
@@ -37,7 +37,7 @@ public class ApiPostParser {
|
||||
settingsService = SpringContext.getBean(SettingsService.class);
|
||||
}
|
||||
|
||||
public ApiPost parse() throws PostParseException {
|
||||
public PostScanResult parse() throws PostParseException {
|
||||
|
||||
log.debug(String.format("Parsing post %s", postId));
|
||||
HttpGet httpGet;
|
||||
@@ -50,9 +50,9 @@ public class ApiPostParser {
|
||||
}
|
||||
|
||||
AtomicReference<Throwable> thr = new AtomicReference<>();
|
||||
ApiPostHandler apiPostHandler = new ApiPostHandler(threadId, postId);
|
||||
PostScanHandler postScanHandler = new PostScanHandler(threadId, postId);
|
||||
log.debug(String.format("Requesting %s", httpGet));
|
||||
ApiPost post = getPost(httpGet, apiPostHandler, thr);
|
||||
PostScanResult post = getPost(httpGet, postScanHandler, 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,7 +60,7 @@ public class ApiPostParser {
|
||||
return post;
|
||||
}
|
||||
|
||||
private ApiPost getPost(HttpGet httpGet, ApiPostHandler apiPostHandler, AtomicReference<Throwable> thr) {
|
||||
private PostScanResult getPost(HttpGet httpGet, PostScanHandler postScanHandler, AtomicReference<Throwable> thr) {
|
||||
return Failsafe.with(cm.getRetryPolicy())
|
||||
.onFailure(e -> thr.set(e.getFailure()))
|
||||
.get(() -> {
|
||||
@@ -70,9 +70,9 @@ public class ApiPostParser {
|
||||
throw new DownloadException(String.format("Unexpected response code '%d' for %s", response.getStatusLine().getStatusCode(), httpGet));
|
||||
}
|
||||
|
||||
factory.newSAXParser().parse(response.getEntity().getContent(), apiPostHandler);
|
||||
factory.newSAXParser().parse(response.getEntity().getContent(), postScanHandler);
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
return apiPostHandler.getParsedPost();
|
||||
return postScanHandler.getParsedPost();
|
||||
}
|
||||
});
|
||||
}
|
||||
+2
-2
@@ -7,14 +7,14 @@ import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class ApiPost {
|
||||
public class PostScanResult {
|
||||
|
||||
private final Post post;
|
||||
|
||||
@Getter
|
||||
private final Set<Image> images;
|
||||
|
||||
public ApiPost(Post post, Set<Image> images) {
|
||||
public PostScanResult(Post post, Set<Image> images) {
|
||||
this.post = post;
|
||||
this.images = images;
|
||||
}
|
||||
+15
-19
@@ -14,8 +14,8 @@ import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.MetadataService;
|
||||
import tn.mnlr.vripper.services.SettingsService;
|
||||
import tn.mnlr.vripper.services.VGAuthService;
|
||||
import tn.mnlr.vripper.services.domain.ApiPost;
|
||||
import tn.mnlr.vripper.services.domain.ApiPostParser;
|
||||
import tn.mnlr.vripper.services.domain.PostScanParser;
|
||||
import tn.mnlr.vripper.services.domain.PostScanResult;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
@@ -46,7 +46,7 @@ public class AddPostRunnable implements Runnable {
|
||||
this.pendingQueue = SpringContext.getBean(PendingQueue.class);
|
||||
this.VGAuthService = SpringContext.getBean(VGAuthService.class);
|
||||
this.eventRepository = SpringContext.getBean(IEventRepository.class);
|
||||
link = settingsService.getSettings().getVProxy() + String.format("/%s?%s", threadId, (postId != null ? "p=" + postId : ""));
|
||||
link = settingsService.getSettings().getVProxy() + String.format("/threads/%s?%s", threadId, (postId != null ? "p=" + postId : ""));
|
||||
event = new Event(Event.Type.POST, Event.Status.PENDING, LocalDateTime.now(), String.format("Processing %s", link));
|
||||
eventRepository.save(event);
|
||||
}
|
||||
@@ -65,11 +65,11 @@ public class AddPostRunnable implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
ApiPostParser apiPostParser = new ApiPostParser(threadId, postId);
|
||||
PostScanParser postScanParser = new PostScanParser(threadId, postId);
|
||||
|
||||
ApiPost apiPost;
|
||||
PostScanResult postScanResult;
|
||||
try {
|
||||
apiPost = apiPostParser.parse();
|
||||
postScanResult = postScanParser.parse();
|
||||
} catch (PostParseException e) {
|
||||
String error = String.format("parsing failed for gallery %s", link);
|
||||
log.error(error, e);
|
||||
@@ -78,7 +78,7 @@ public class AddPostRunnable implements Runnable {
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
if (apiPost.getPost().isEmpty()) {
|
||||
if (postScanResult.getPost().isEmpty()) {
|
||||
String error = String.format("Gallery %s contains no galleries", link);
|
||||
log.error(error);
|
||||
event.setMessage(error);
|
||||
@@ -86,7 +86,7 @@ public class AddPostRunnable implements Runnable {
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
if (apiPost.getImages().isEmpty()) {
|
||||
if (postScanResult.getImages().isEmpty()) {
|
||||
String error = String.format("Gallery %s contains no images to download", link);
|
||||
log.error(error);
|
||||
event.setMessage(error);
|
||||
@@ -95,8 +95,8 @@ public class AddPostRunnable implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
Post post = apiPost.getPost().get();
|
||||
Set<Image> images = apiPost.getImages();
|
||||
Post post = postScanResult.getPost().get();
|
||||
Set<Image> images = postScanResult.getImages();
|
||||
|
||||
dataService.newPost(post, images);
|
||||
|
||||
@@ -125,15 +125,11 @@ public class AddPostRunnable implements Runnable {
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String error = String.format("Error when adding gallery %s", link);
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception exp) {
|
||||
log.error(exp.getMessage(), exp);
|
||||
}
|
||||
String error = String.format("Error when adding gallery %s", link);
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-16
@@ -9,10 +9,9 @@ import tn.mnlr.vripper.jpa.repositories.IEventRepository;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.PostService;
|
||||
import tn.mnlr.vripper.services.ThreadPoolService;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostItem;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostScanResult;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static tn.mnlr.vripper.jpa.domain.Event.Status.ERROR;
|
||||
import static tn.mnlr.vripper.jpa.domain.Event.Status.PROCESSING;
|
||||
@@ -42,18 +41,30 @@ public class AddQueuedRunnable implements Runnable {
|
||||
try {
|
||||
event.setStatus(PROCESSING);
|
||||
eventRepository.update(event);
|
||||
List<MultiPostItem> multiPostItems = postService.get(queued);
|
||||
if (multiPostItems == null) {
|
||||
MultiPostScanResult multiPostScanResult = postService.get(queued);
|
||||
if (multiPostScanResult == null) {
|
||||
String message = String.format("Fetching multi-post link %s failed", queued.getLink());
|
||||
event.setStatus(ERROR);
|
||||
event.setMessage(message);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
} else if (multiPostScanResult.getError() != null) {
|
||||
String message = "Nothing found for " + queued.getLink() + "\n" + multiPostScanResult.getError();
|
||||
event.setStatus(ERROR);
|
||||
event.setMessage(message);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
} else if (multiPostScanResult.getPosts().isEmpty()) {
|
||||
String message = "Nothing found for " + queued.getLink();
|
||||
event.setStatus(ERROR);
|
||||
event.setMessage(message);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
queued.setTotal(multiPostItems.size());
|
||||
queued.setTotal(multiPostScanResult.getPosts().size());
|
||||
queued.done();
|
||||
if (multiPostItems.size() == 1) {
|
||||
threadPoolService.getGeneralExecutor().submit(new AddPostRunnable(multiPostItems.get(0).getPostId(), multiPostItems.get(0).getThreadId()));
|
||||
if (multiPostScanResult.getPosts().size() == 1) {
|
||||
threadPoolService.getGeneralExecutor().submit(new AddPostRunnable(multiPostScanResult.getPosts().get(0).getPostId(), multiPostScanResult.getPosts().get(0).getThreadId()));
|
||||
event.setStatus(Event.Status.DONE);
|
||||
event.setMessage(String.format("Link %s is added to download queue", queued.getLink()));
|
||||
} else {
|
||||
@@ -69,15 +80,11 @@ public class AddQueuedRunnable implements Runnable {
|
||||
}
|
||||
eventRepository.update(event);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String error = String.format("Error when adding multi-post link %s", queued.getLink());
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception exp) {
|
||||
log.error(exp.getMessage(), exp);
|
||||
}
|
||||
String error = String.format("Error when adding multi-post link %s", queued.getLink());
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-13
@@ -53,25 +53,25 @@ public class LeaveThanksRunnable implements Runnable {
|
||||
event.setStatus(Event.Status.PROCESSING);
|
||||
eventRepository.update(event);
|
||||
if (!settingsService.getSettings().getVLogin()) {
|
||||
event.setMessage(String.format("Will not leave a thanks for %s\nAuthentication with ViperGirls option is disabled", post.getUrl()));
|
||||
event.setMessage(String.format("Will not send a like for %s\nAuthentication with ViperGirls option is disabled", post.getUrl()));
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
if (!settingsService.getSettings().getVThanks()) {
|
||||
event.setMessage(String.format("Will not leave a thanks for %s\nLeave thanks option is disabled", post.getUrl()));
|
||||
event.setMessage(String.format("Will not send a like for %s\nLeave thanks option is disabled", post.getUrl()));
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
if (!authenticated) {
|
||||
event.setMessage(String.format("Will not leave a thanks for %s\nYou are not authenticated", post.getUrl()));
|
||||
event.setMessage(String.format("Will not send a like for %s\nYou are not authenticated", post.getUrl()));
|
||||
event.setStatus(Event.Status.ERROR);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
}
|
||||
if (post.isThanked()) {
|
||||
event.setMessage(String.format("Will not leave a thanks for %s\nAlready left a thanks", post.getUrl()));
|
||||
event.setMessage(String.format("Will not send a like for %s\nAlready left a thanks", post.getUrl()));
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
return;
|
||||
@@ -109,15 +109,11 @@ public class LeaveThanksRunnable implements Runnable {
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String error = String.format("Failed to leave a thanks for %s", post.getUrl());
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(Event.Status.ERROR);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception exp) {
|
||||
log.error(exp.getMessage(), exp);
|
||||
}
|
||||
String error = String.format("Failed to leave a thanks for %s", post.getUrl());
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(Event.Status.ERROR);
|
||||
eventRepository.update(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-10
@@ -34,7 +34,7 @@ public class LinkScanRunnable implements Runnable {
|
||||
settingsService = SpringContext.getBean(SettingsService.class);
|
||||
postService = SpringContext.getBean(PostService.class);
|
||||
eventRepository = SpringContext.getBean(EventRepository.class);
|
||||
event = new Event(Event.Type.SCAN, Event.Status.PENDING, LocalDateTime.now(), "Links scan:\n\t" + String.join("\n\t", urlList));
|
||||
event = new Event(Event.Type.SCAN, Event.Status.PENDING, LocalDateTime.now(), "Links to scan:\n\t" + String.join("\n\t", urlList));
|
||||
eventRepository.save(event);
|
||||
}
|
||||
|
||||
@@ -84,15 +84,11 @@ public class LinkScanRunnable implements Runnable {
|
||||
}
|
||||
eventRepository.update(event);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String error = "Error when scanning links";
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception exp) {
|
||||
log.error(exp.getMessage(), exp);
|
||||
}
|
||||
String error = "Error when scanning links";
|
||||
log.error(error, e);
|
||||
event.setMessage(error + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-9
@@ -68,15 +68,11 @@ public class MetadataRunnable implements Runnable {
|
||||
event.setStatus(Event.Status.DONE);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
String message = String.format("Failed to fetch metadata for %s", post.getUrl());
|
||||
log.error(message, e);
|
||||
event.setMessage(message + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
} catch (Exception exp) {
|
||||
log.error(exp.getMessage(), exp);
|
||||
}
|
||||
String message = String.format("Failed to fetch metadata for %s", post.getUrl());
|
||||
log.error(message, e);
|
||||
event.setMessage(message + "\n" + Utils.throwableToString(e));
|
||||
event.setStatus(ERROR);
|
||||
eventRepository.update(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-11
@@ -9,8 +9,12 @@ import tn.mnlr.vripper.download.DownloadService;
|
||||
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.services.*;
|
||||
import tn.mnlr.vripper.services.DataService;
|
||||
import tn.mnlr.vripper.services.PathService;
|
||||
import tn.mnlr.vripper.services.PostService;
|
||||
import tn.mnlr.vripper.services.ThreadPoolService;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostItem;
|
||||
import tn.mnlr.vripper.services.domain.MultiPostScanResult;
|
||||
import tn.mnlr.vripper.services.domain.tasks.AddPostRunnable;
|
||||
import tn.mnlr.vripper.services.domain.tasks.LinkScanRunnable;
|
||||
import tn.mnlr.vripper.web.restendpoints.domain.*;
|
||||
@@ -35,16 +39,14 @@ public class PostRestEndpoint {
|
||||
private final DownloadService downloadService;
|
||||
private final PostService postService;
|
||||
private final ThreadPoolService threadPoolService;
|
||||
private final SettingsService settingsService;
|
||||
|
||||
@Autowired
|
||||
public PostRestEndpoint(DataService dataService, PathService pathService, DownloadService downloadService, PostService postService, ThreadPoolService threadPoolService, SettingsService settingsService) {
|
||||
public PostRestEndpoint(DataService dataService, PathService pathService, DownloadService downloadService, PostService postService, ThreadPoolService threadPoolService) {
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
this.downloadService = downloadService;
|
||||
this.postService = postService;
|
||||
this.threadPoolService = threadPoolService;
|
||||
this.settingsService = settingsService;
|
||||
}
|
||||
|
||||
@PostMapping("/post")
|
||||
@@ -204,13 +206,17 @@ public class PostRestEndpoint {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
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)));
|
||||
List<MultiPostItem> multiPostItems = postService.get(queued);
|
||||
if (multiPostItems == null) {
|
||||
log.error(String.format("Failed to get links for threadId = %s", threadId));
|
||||
throw new ServerErrorException(String.format("Failed to get links for threadId = %s", threadId));
|
||||
} else {
|
||||
return multiPostItems;
|
||||
try {
|
||||
Queued queued = dataService.findQueuedByThreadId(threadId).orElseThrow(() -> new NotFoundException(String.format("Unable to find links for threadId = %s", threadId)));
|
||||
MultiPostScanResult multiPostScanResult = postService.get(queued);
|
||||
if (multiPostScanResult == null) {
|
||||
log.error(String.format("Failed to get links for threadId = %s", threadId));
|
||||
throw new ServerErrorException(String.format("Failed to get links for threadId = %s", threadId));
|
||||
} else {
|
||||
return multiPostScanResult.getPosts();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServerErrorException(String.format("Failed to get links for threadId = %s, %s", threadId, e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
-13960
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "3.3.0",
|
||||
"version": "3.3.4",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
|
||||
+19
-21
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.3.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-ui</artifactId>
|
||||
<name>vripper-ui</name>
|
||||
@@ -33,34 +33,33 @@
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.11.2</version>
|
||||
<configuration>
|
||||
<nodeVersion>v12.2.0</nodeVersion>
|
||||
<npmVersion>6.9.0</npmVersion>
|
||||
<nodeVersion>v14.16.0</nodeVersion>
|
||||
<yarnVersion>v1.22.10</yarnVersion>
|
||||
<workingDirectory>build-dir</workingDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
<id>install node and yarn</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
<goal>install-node-and-yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<id>yarn install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm run build</id>
|
||||
<id>yarn run build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run build-web</arguments>
|
||||
</configuration>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
@@ -77,34 +76,33 @@
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.11.2</version>
|
||||
<configuration>
|
||||
<nodeVersion>v12.2.0</nodeVersion>
|
||||
<npmVersion>6.9.0</npmVersion>
|
||||
<nodeVersion>v14.16.0</nodeVersion>
|
||||
<yarnVersion>v1.22.10</yarnVersion>
|
||||
<workingDirectory>build-dir</workingDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
<id>install node and yarn</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
<goal>install-node-and-yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm install</id>
|
||||
<id>yarn install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm run build</id>
|
||||
<id>yarn run build</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run build-electron</arguments>
|
||||
</configuration>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
@mixin about-component-theme($theme) {
|
||||
$foreground: map-get($theme, foreground);
|
||||
$background: map-get($theme, background);
|
||||
|
||||
.about-link, .about-icon {
|
||||
color: mat-color($foreground, text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<div class="dialog-container" fxLayout="column" style="height: 100%;">
|
||||
<div fxFlex="nogrow" fxLayout="row" fxLayoutAlign="space-between center">
|
||||
<h2 class="no-wrap" mat-dialog-title>About</h2>
|
||||
</div>
|
||||
<mat-dialog-content class="content" fxFlex="grow">
|
||||
<mat-card class="mat-elevation-z4">
|
||||
<mat-card-header class="header" fxLayout="row" fxLayoutAlign="flex-start center" fxLayoutGap="10px">
|
||||
<div class="header-image" mat-card-avatar></div>
|
||||
<mat-card-title>VRipper</mat-card-title>
|
||||
<mat-card-subtitle>{{version}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<section class="section">
|
||||
Due to the lack of cross platform Ripper for vipergirls.to and the official one being no longer maintained,
|
||||
this application was created as a personal project of mine to fulfill the old one's tasks.<br/>
|
||||
Soon after, people were interested in it and i released it to the public.<br/>
|
||||
This project is built to be a robust and clean replacement of the old one, using modern technologies to
|
||||
conveniently download photo galleries from the forum.<br/>
|
||||
I aim to provide you with a software that is easy to use have a nice and intuitive design and interface.<br/>
|
||||
The project is currently maintained by me 'theghooost', a member of the vipergirls.to forum, feel free to PM
|
||||
if you need anything.<br/>
|
||||
</section>
|
||||
<mat-divider></mat-divider>
|
||||
<section class="section">
|
||||
<span fxLayout="row" fxLayoutAlign="flex-start center">
|
||||
<svg class="about-icon" style="width:24px;height:24px" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M11 6H14L17.29 2.7A1 1 0 0 1 18.71 2.7L21.29 5.29A1 1 0 0 1 21.29 6.7L19 9H11V11A1 1 0 0 1 10 12A1 1 0 0 1 9 11V8A2 2 0 0 1 11 6M5 11V15L2.71 17.29A1 1 0 0 0 2.71 18.7L5.29 21.29A1 1 0 0 0 6.71 21.29L11 17H15A1 1 0 0 0 16 16V15H17A1 1 0 0 0 18 14V13H19A1 1 0 0 0 20 12V11H13V12A2 2 0 0 1 11 14H9A2 2 0 0 1 7 12V9Z"
|
||||
fill="currentColor"/>
|
||||
</svg><h2 class="margin-left no-bottom-margin no-top-margin inline-block">Contribution</h2>
|
||||
</span>
|
||||
You can contribute to the project by testing new releases, raising bug reports or coding.<br/>
|
||||
The project is open source and is hosted in github.com.<br/>
|
||||
<h4 class="no-bottom-margin">Github: </h4><a (click)="goTo('https://github.com/death-claw/vripper-project')"
|
||||
class="about-link" href="javascript:void(0)">https://github.com/death-claw/vripper-project</a>
|
||||
<h4 class="no-bottom-margin">Issues: </h4><a
|
||||
(click)="goTo('https://github.com/death-claw/vripper-project/issues')" class="about-link"
|
||||
href="javascript:void(0)">https://github.com/death-claw/vripper-project/issues</a>
|
||||
<h4 class="no-bottom-margin">PM: </h4><a (click)="goTo('https://vipergirls.to/members/244439-theghooost')"
|
||||
class="about-link" href="javascript:void(0)">https://vipergirls.to/members/244439-theghooost</a>
|
||||
</section>
|
||||
<mat-divider></mat-divider>
|
||||
<section class="section">
|
||||
<span fxLayout="row" fxLayoutAlign="flex-start center">
|
||||
<svg class="about-icon" style="width:24px;height:24px" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M9.06,1.93C7.17,1.92 5.33,3.74 6.17,6H3A2,2 0 0,0 1,8V10A1,1 0 0,0 2,11H11V8H13V11H22A1,1 0 0,0 23,10V8A2,2 0 0,0 21,6H17.83C19,2.73 14.6,0.42 12.57,3.24L12,4L11.43,3.22C10.8,2.33 9.93,1.94 9.06,1.93M9,4C9.89,4 10.34,5.08 9.71,5.71C9.08,6.34 8,5.89 8,5A1,1 0 0,1 9,4M15,4C15.89,4 16.34,5.08 15.71,5.71C15.08,6.34 14,5.89 14,5A1,1 0 0,1 15,4M2,12V20A2,2 0 0,0 4,22H20A2,2 0 0,0 22,20V12H13V20H11V12H2Z"
|
||||
fill="currentColor"/>
|
||||
</svg><h2 class="margin-left no-bottom-margin no-top-margin inline-block">Donation</h2>
|
||||
</span>
|
||||
If you feel generous and want to support me, you can donate some coins, and I would be very grateful <span
|
||||
style="font-size: 20px">🙏</span><br/>
|
||||
I accept Bitcoin (BTC) for donations, following is my address
|
||||
<h3>bc1q9jzzw3st49r9vmxgtylq4vrd67cl7zfclf3lsq</h3>
|
||||
</section>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end" fxFlex="nogrow">
|
||||
<button mat-dialog-close mat-raised-button>Close</button>
|
||||
</mat-dialog-actions>
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
.header-image {
|
||||
background-size: cover;
|
||||
background-image: url('../../assets/v.svg');
|
||||
}
|
||||
|
||||
.section {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.mat-card-avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.no-bottom-margin {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.no-top-margin {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-bottom: 10px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.margin-left {
|
||||
margin-left: 5px;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {environment} from '../../environments/environment';
|
||||
import {ElectronService} from 'ngx-electron';
|
||||
|
||||
@Component({
|
||||
selector: 'app-about',
|
||||
templateUrl: './about-component.html',
|
||||
styleUrls: ['./about-component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AboutComponent {
|
||||
|
||||
version = environment.version;
|
||||
|
||||
constructor(
|
||||
public electronService: ElectronService
|
||||
) {
|
||||
}
|
||||
|
||||
goTo(url: string) {
|
||||
if (this.electronService.isElectronApp) {
|
||||
this.electronService.shell.openExternal(url);
|
||||
} else {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import {MatIconRegistry} from '@angular/material/icon';
|
||||
import {DomSanitizer} from '@angular/platform-browser';
|
||||
import {EventLogComponent} from './event-log/event-log.component';
|
||||
import {EventLogMessageDialogComponent} from './event-log/message-dialog/event-log-message-dialog.component';
|
||||
import {AboutComponent} from './about/about-component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -48,7 +49,8 @@ import {EventLogMessageDialogComponent} from './event-log/message-dialog/event-l
|
||||
PostContextMenuComponent,
|
||||
AlternativeTitleComponent,
|
||||
EventLogComponent,
|
||||
EventLogMessageDialogComponent
|
||||
EventLogMessageDialogComponent,
|
||||
AboutComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
|
||||
@@ -34,21 +34,19 @@ export class EventLogComponent implements OnDestroy {
|
||||
valueGetter: (params => {
|
||||
switch (params.data.type) {
|
||||
case 'POST':
|
||||
return 'New gallery';
|
||||
case 'QUEUED':
|
||||
return 'New multi-post link';
|
||||
return '🖼️ New gallery';
|
||||
case 'THANKS':
|
||||
return 'Leave thanks';
|
||||
return '👍 Sending a like ';
|
||||
case 'SCAN':
|
||||
return 'Links scan';
|
||||
return '🔍 Links scan';
|
||||
case 'METADATA':
|
||||
return 'Fetching metadata';
|
||||
case 'METADATA_CACHE_MISS':
|
||||
return 'Loading post metadata';
|
||||
return '🗄️ Loading post metadata';
|
||||
case 'QUEUED':
|
||||
case 'QUEUED_CACHE_MISS':
|
||||
return 'Loading multi-post links';
|
||||
return '📋 Loading multi-post link';
|
||||
case 'DOWNLOAD':
|
||||
return 'Download';
|
||||
return '📥 Download';
|
||||
default:
|
||||
return params.data.type;
|
||||
}
|
||||
|
||||
@@ -161,16 +161,17 @@
|
||||
</mat-form-field>
|
||||
|
||||
<section class="input">
|
||||
<mat-checkbox color="primary" formControlName="vThanks" name="vThanks">Leave thanks</mat-checkbox>
|
||||
<mat-icon matTooltip="Automatically leave a thanks to the poster"
|
||||
<mat-checkbox color="primary" formControlName="vThanks" name="vThanks">Send a like to poster
|
||||
</mat-checkbox>
|
||||
<mat-icon matTooltip="Automatically send a like to the poster"
|
||||
svgIcon="help-circle-outline"></mat-icon>
|
||||
</section>
|
||||
<section class="input">
|
||||
<mat-checkbox color="primary" formControlName="leaveThanksOnStart" name="leaveThanksOnStart">Leave
|
||||
thanks when download starts
|
||||
<mat-checkbox color="primary" formControlName="leaveThanksOnStart" name="leaveThanksOnStart">Send a like
|
||||
when download starts
|
||||
</mat-checkbox>
|
||||
<mat-icon
|
||||
matTooltip="Leave a thanks only when the download starts, if unchecked, leave a thanks once a gallery is added to the download queue"
|
||||
matTooltip="Send a like only when the download starts, if unchecked, send a like once a gallery is added to the download queue"
|
||||
svgIcon="help-circle-outline"></mat-icon>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {finalize} from 'rxjs/operators';
|
||||
import {AppService} from '../services/app.service';
|
||||
import {ClipboardService} from '../services/clipboard.service';
|
||||
import {ChangeDetectionStrategy, Component, NgZone, OnInit} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, NgZone, OnDestroy, OnInit} from '@angular/core';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {FormControl, FormGroup} from '@angular/forms';
|
||||
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||
import {ServerService} from '../services/server-service';
|
||||
import {ElectronService} from 'ngx-electron';
|
||||
import {Settings} from '../domain/settings.model';
|
||||
import {EMPTY, Observable} from 'rxjs';
|
||||
import {EMPTY, Observable, Subscription} from 'rxjs';
|
||||
import OpenDialogReturnValue = Electron.OpenDialogReturnValue;
|
||||
|
||||
@Component({
|
||||
@@ -17,12 +17,14 @@ import OpenDialogReturnValue = Electron.OpenDialogReturnValue;
|
||||
styleUrls: ['./settings.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
export class SettingsComponent implements OnInit, OnDestroy {
|
||||
loading = false;
|
||||
darkTheme = false;
|
||||
|
||||
mirrors: Observable<string[]> = EMPTY;
|
||||
|
||||
subscriptions: Subscription[] = [];
|
||||
|
||||
viperGirlsSettingsForm = new FormGroup({
|
||||
vLogin: new FormControl(false),
|
||||
vUsername: new FormControl(''),
|
||||
@@ -66,6 +68,15 @@ export class SettingsComponent implements OnInit {
|
||||
private appService: AppService,
|
||||
private zone: NgZone
|
||||
) {
|
||||
this.subscriptions.push(this.viperGirlsSettingsForm.get('vThanks').valueChanges.subscribe(c => {
|
||||
const formControl: FormControl = this.viperGirlsSettingsForm.get('leaveThanksOnStart') as FormControl;
|
||||
if (!c) {
|
||||
formControl.setValue(false);
|
||||
formControl.disable();
|
||||
} else {
|
||||
formControl.enable();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
updateTheme() {
|
||||
@@ -93,6 +104,10 @@ export class SettingsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subscriptions.forEach(s => s.unsubscribe());
|
||||
}
|
||||
|
||||
browse() {
|
||||
this.electronService.remote.dialog
|
||||
.showOpenDialog(this.electronService.remote.getCurrentWindow(), {
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
<button (click)="openSettings()" mat-icon-button matTooltip="Preferences">
|
||||
<mat-icon>settings</mat-icon>
|
||||
</button>
|
||||
<button (click)="openAbout()" mat-icon-button matTooltip="About">
|
||||
<mat-icon>info</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</mat-toolbar-row>
|
||||
</mat-toolbar>
|
||||
|
||||
@@ -20,6 +20,7 @@ import {PostsService} from '../services/posts.service';
|
||||
import {HomeTabsService} from '../services/home-tabs.service';
|
||||
import {LinkCollectorService} from '../services/link-collector.service';
|
||||
import {EventLogService} from '../services/event-log.service';
|
||||
import {AboutComponent} from '../about/about-component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toolbar',
|
||||
@@ -237,4 +238,25 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(e => e.unsubscribe());
|
||||
}
|
||||
|
||||
openAbout(): void {
|
||||
const dialogRef = this.dialog.open(AboutComponent, {
|
||||
width: '70%',
|
||||
height: '70%',
|
||||
maxWidth: '100vw',
|
||||
maxHeight: '100vh'
|
||||
});
|
||||
|
||||
const smallDialogSubscription = this.isExtraSmall.subscribe(result => {
|
||||
if (result.matches) {
|
||||
dialogRef.updateSize('100%', '100%');
|
||||
} else {
|
||||
dialogRef.updateSize('70%', '70%');
|
||||
}
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
smallDialogSubscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+30
-31
@@ -1,39 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
height="1024"
|
||||
id="svg8"
|
||||
inkscape:export-filename="C:\Users\Marwen\IdeaProjects\vripper-project\vripper-electron\build\icons\1024x1024.png"
|
||||
inkscape:export-xdpi="96.00956"
|
||||
inkscape:export-ydpi="96.00956"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="v.svg"
|
||||
version="1.1"
|
||||
viewBox="0 0 270.93333 270.93334"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
|
||||
width="1024"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="1024"
|
||||
id="svg8"
|
||||
inkscape:export-filename="C:\Users\Marwen\IdeaProjects\vripper-project\vripper-electron\build\icons\1024x1024.png"
|
||||
inkscape:export-xdpi="96.00956"
|
||||
inkscape:export-ydpi="96.00956"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
sodipodi:docname="v.svg"
|
||||
version="1.1"
|
||||
viewBox="0 0 270.93333 270.93334"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd">
|
||||
<defs
|
||||
id="defs2"/>
|
||||
id="defs2">
|
||||
<rect
|
||||
height="57.580088"
|
||||
id="rect32"
|
||||
width="31.592941"
|
||||
x="46.113095"
|
||||
y="71.423793"/>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
id="base"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:cx="-200.49762"
|
||||
inkscape:cy="299.73785"
|
||||
inkscape:cx="504.85714"
|
||||
inkscape:cy="512"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:zoom="0.35"
|
||||
pagecolor="#ffffff"
|
||||
@@ -61,21 +67,14 @@
|
||||
cy="161.53331"
|
||||
id="path3715"
|
||||
r="135.45317"
|
||||
style="fill:#aa0000;fill-opacity:1;stroke-width:0.35248032"/>
|
||||
<flowRoot
|
||||
id="flowRoot4522"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40.00005341px;line-height:1.25;font-family:'Fira Code';-inkscape-font-specification:'Fira Code, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none"
|
||||
transform="matrix(5.7825687,0,0,5.7825687,-859.25089,-2020.8769)"
|
||||
xml:space="preserve"><flowRegion
|
||||
id="flowRegion4524"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40.00005341px;font-family:'Fira Code';-inkscape-font-specification:'Fira Code, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1"><rect
|
||||
height="380"
|
||||
id="rect4526"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40.00005341px;font-family:'Fira Code';-inkscape-font-specification:'Fira Code, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1"
|
||||
width="514.28571"
|
||||
x="160"
|
||||
y="356.80539" /></flowRegion>
|
||||
<flowPara
|
||||
id="flowPara4534">V</flowPara></flowRoot>
|
||||
style="fill:#aa0000;fill-opacity:1;stroke-width:0.35248"/>
|
||||
<text
|
||||
id="text30"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect32);fill:#000000;fill-opacity:1;stroke:none;"
|
||||
transform="matrix(4.1259458,0,0,4.1259458,-117.77844,-239.46004)"
|
||||
xml:space="preserve"><tspan
|
||||
x="46.113281"
|
||||
y="117.35549"><tspan
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.8px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono Bold';fill:#ffffff">V</tspan></tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.5 KiB |
@@ -2,5 +2,5 @@ export const environment = {
|
||||
production: true,
|
||||
localhost: `${window.location.protocol}//${window.location.host}`,
|
||||
ws: `${window.location.protocol === 'http:' ? 'ws:' : 'wss:'}//${window.location.host}`,
|
||||
version: '3.3.0'
|
||||
version: '3.3.4'
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export const environment = {
|
||||
production: false,
|
||||
localhost: 'http://localhost:8080',
|
||||
ws: 'ws://localhost:8080',
|
||||
version: '3.3.0'
|
||||
version: '3.3.4'
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -32,12 +32,14 @@
|
||||
@import 'src/app/status-bar/status-bar.component.scss-theme';
|
||||
@import 'app/app.component.scss-theme.scss';
|
||||
@import 'src/app/toolbar/toolbar.component.scss-theme';
|
||||
@import 'src/app/about/about-component.component-scss-theme';
|
||||
@import 'grid-theme.scss';
|
||||
|
||||
@mixin custom-components-theme($theme, $dark: false) {
|
||||
@include status-bar-component-theme($theme);
|
||||
@include app-component-theme($theme);
|
||||
@include toolbar-theme($theme, $dark);
|
||||
@include about-component-theme($theme)
|
||||
}
|
||||
|
||||
.dark-theme {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user