mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5ae5d57d1 | ||
|
|
537d76d7be |
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [3.0.4] - 2020-08-16
|
||||
### Changed
|
||||
- Improve rename UI
|
||||
|
||||
## [3.0.3] - 2020-08-16
|
||||
### Changed
|
||||
- Fix bugs with electron app
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.4</version>
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-electron",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"description": "A ripper for vipergirls.to built using web technolgies",
|
||||
"main": "main.js",
|
||||
"author": "death-claw <53543762+death-claw@users.noreply.github.com>",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-electron</artifactId>
|
||||
<name>vripper-electron</name>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-server</artifactId>
|
||||
<name>vripper-server</name>
|
||||
|
||||
@@ -52,6 +52,8 @@ public class Post {
|
||||
|
||||
private Metadata metadata;
|
||||
|
||||
private boolean renaming;
|
||||
|
||||
public Post(String title, String url, String postId, String threadId, String threadTitle, String forum, String securityToken) {
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
|
||||
@@ -253,4 +253,8 @@ public class DataService {
|
||||
postRepository.updateThanked(thanked, id);
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
|
||||
public void refreshPost(Long id) {
|
||||
livePostsState.onNext(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package tn.mnlr.vripper.services;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -11,10 +12,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -28,6 +26,9 @@ public class PathService {
|
||||
|
||||
private final CommonExecutor commonExecutor;
|
||||
|
||||
@Getter
|
||||
private final Set<String> renaming = Collections.synchronizedSet(new HashSet<>());
|
||||
|
||||
@Autowired
|
||||
public PathService(AppSettingsService appSettingsService, DataService dataService, MutexService mutexService, CommonExecutor commonExecutor) {
|
||||
this.appSettingsService = appSettingsService;
|
||||
@@ -54,19 +55,16 @@ public class PathService {
|
||||
}
|
||||
|
||||
public final void rename(@NonNull String postId, @NonNull String altName) {
|
||||
renaming.add(postId);
|
||||
Post post = dataService.findPostByPostId(postId).orElseThrow();
|
||||
dataService.refreshPost(post.getId());
|
||||
commonExecutor.getGeneralExecutor().submit(() -> {
|
||||
|
||||
ReentrantLock postLock = mutexService.getPostLock(postId);
|
||||
if (postLock != null) {
|
||||
postLock.lock();
|
||||
}
|
||||
|
||||
ReentrantLock postLock = null;
|
||||
try {
|
||||
Optional<Post> _post = dataService.findPostByPostId(postId);
|
||||
if (_post.isEmpty()) {
|
||||
return;
|
||||
postLock = mutexService.getPostLock(postId);
|
||||
if (postLock != null) {
|
||||
postLock.lock();
|
||||
}
|
||||
Post post = _post.get();
|
||||
if (altName.equals(post.getTitle())) {
|
||||
return;
|
||||
}
|
||||
@@ -100,6 +98,9 @@ public class PathService {
|
||||
log.warn(String.format("Failed to remove %s", currentDesFolder.toString()));
|
||||
}
|
||||
} finally {
|
||||
renaming.remove(postId);
|
||||
dataService.refreshPost(post.getId());
|
||||
|
||||
if (postLock != null) {
|
||||
postLock.unlock();
|
||||
}
|
||||
|
||||
+10
-2
@@ -22,13 +22,15 @@ public class AppDataController {
|
||||
private final GlobalStateService globalStateService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
|
||||
@Autowired
|
||||
public AppDataController(VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService) {
|
||||
public AppDataController(VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService, PathService pathService) {
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
this.globalStateService = globalStateService;
|
||||
this.downloadSpeedService = downloadSpeedService;
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -58,7 +60,7 @@ public class AppDataController {
|
||||
|
||||
@SubscribeMapping("/posts")
|
||||
public Collection<Post> posts() {
|
||||
return StreamSupport.stream(dataService.findAllPosts().spliterator(), false).collect(Collectors.toList());
|
||||
return StreamSupport.stream(dataService.findAllPosts().spliterator(), false).peek(this::isRenaming).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@SubscribeMapping("/images/{postId}")
|
||||
@@ -70,4 +72,10 @@ public class AppDataController {
|
||||
public Collection<Queued> queued() {
|
||||
return StreamSupport.stream(dataService.findAllQueued().spliterator(), false).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void isRenaming(Post post) {
|
||||
if (pathService.getRenaming().contains(post.getPostId())) {
|
||||
post.setRenaming(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tn.mnlr.vripper.jpa.domain.Image;
|
||||
import tn.mnlr.vripper.jpa.domain.Post;
|
||||
import tn.mnlr.vripper.services.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -27,16 +28,18 @@ public class WebSocketBroadcast {
|
||||
private final GlobalStateService globalStateService;
|
||||
private final DownloadSpeedService downloadSpeedService;
|
||||
private final DataService dataService;
|
||||
private final PathService pathService;
|
||||
|
||||
private final List<Disposable> disposables = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
public WebSocketBroadcast(SimpMessagingTemplate template, VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService) {
|
||||
public WebSocketBroadcast(SimpMessagingTemplate template, VipergirlsAuthService vipergirlsAuthService, GlobalStateService globalStateService, DownloadSpeedService downloadSpeedService, DataService dataService, PathService pathService) {
|
||||
this.template = template;
|
||||
this.vipergirlsAuthService = vipergirlsAuthService;
|
||||
this.globalStateService = globalStateService;
|
||||
this.downloadSpeedService = downloadSpeedService;
|
||||
this.dataService = dataService;
|
||||
this.pathService = pathService;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@@ -63,7 +66,7 @@ public class WebSocketBroadcast {
|
||||
.buffer(500, TimeUnit.MILLISECONDS)
|
||||
.map(HashSet::new)
|
||||
.filter(e -> !e.isEmpty())
|
||||
.subscribe(ids -> template.convertAndSend("/topic/posts", ids.stream().map(dataService::findPostById).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e)));
|
||||
.subscribe(ids -> template.convertAndSend("/topic/posts", ids.stream().map(dataService::findPostById).filter(Optional::isPresent).map(Optional::get).peek(this::isRenaming).collect(Collectors.toList())), e -> log.error("Failed to send data to client", e)));
|
||||
|
||||
disposables.add(dataService.liveImage()
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -105,6 +108,12 @@ public class WebSocketBroadcast {
|
||||
);
|
||||
}
|
||||
|
||||
private void isRenaming(Post post) {
|
||||
if (pathService.getRenaming().contains(post.getPostId())) {
|
||||
post.setRenaming(true);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
private void destroy() {
|
||||
disposables.forEach(Disposable::dispose);
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vripper-ui",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>tn.mnlr</groupId>
|
||||
<artifactId>vripper</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.4</version>
|
||||
</parent>
|
||||
<artifactId>vripper-ui</artifactId>
|
||||
<name>vripper-ui</name>
|
||||
|
||||
@@ -11,7 +11,8 @@ export class PostState {
|
||||
public hosts: string[],
|
||||
public thanked: boolean,
|
||||
public previews: string[],
|
||||
public metadata: Metadata
|
||||
public metadata: Metadata,
|
||||
public renaming: boolean
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<mat-icon class="icon" fxFlex="none" color="primary" [appPreview]="postState.previews">image</mat-icon>
|
||||
<span class="title">
|
||||
<p [title]="postState.title">{{
|
||||
postState.title
|
||||
postState.renaming ? 'Renaming gallery...' : postState.title
|
||||
}}</p>
|
||||
<p><label>Alternative titles: </label><span
|
||||
[title]="postState.metadata?.resolvedNames?.join(', ')">{{postState.metadata?.resolvedNames?.join(', ') || 'none'}}</span></p>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
</section>
|
||||
</form>
|
||||
</mat-tab>
|
||||
<mat-tab label="Desktop Integration">
|
||||
<mat-tab label="Desktop Integration" *ngIf="electronService.isElectronApp">
|
||||
<form [formGroup]="desktopSettingsForm" autocomplete="off">
|
||||
<mat-checkbox *ngIf="electronService.isElectronApp" color="primary" formControlName="desktopClipboard"
|
||||
name="desktopClipboard"
|
||||
|
||||
@@ -139,7 +139,8 @@ export class WsConnectionService {
|
||||
element.hosts,
|
||||
element.thanked,
|
||||
element.previews,
|
||||
element.metadata
|
||||
element.metadata,
|
||||
element.renaming
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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.0.3'
|
||||
version: '3.0.4'
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export const environment = {
|
||||
production: false,
|
||||
localhost: 'http://localhost:8080',
|
||||
ws: 'ws://localhost:8080',
|
||||
version: '3.0.3'
|
||||
version: '3.0.4'
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user