aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-17 21:29:02 +0300
committerGravatar Vitaly Takmazov2018-02-17 21:29:02 +0300
commitae265f84efc37619411fb21d92b51183a4744478 (patch)
tree1a118171152c464866cb9eb0565f0d83389bce7e /juick-server
parent318f19c63477e7ba21cf1abc62e62a5249c670a7 (diff)
drop vk top
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/build.gradle1
-rw-r--r--juick-server/src/main/java/com/juick/server/TopManager.java7
-rw-r--r--juick-server/src/main/java/com/juick/server/VKWallManager.java57
3 files changed, 0 insertions, 65 deletions
diff --git a/juick-server/build.gradle b/juick-server/build.gradle
index d88e0b77..f0d29f98 100644
--- a/juick-server/build.gradle
+++ b/juick-server/build.gradle
@@ -18,7 +18,6 @@ dependencies {
compile 'com.github.pengrad:java-telegram-bot-api:3.5.2'
compile 'com.github.messenger4j:messenger4j:1.0.0-M3'
compile 'org.springframework.social:spring-social-twitter:1.1.2.RELEASE'
- compile 'com.vk.api:sdk:0.5.11'
compile 'org.apache.commons:commons-email:1.5'
compile 'org.imgscalr:imgscalr-lib:4.2'
diff --git a/juick-server/src/main/java/com/juick/server/TopManager.java b/juick-server/src/main/java/com/juick/server/TopManager.java
index 66e1d6d2..0f2373b4 100644
--- a/juick-server/src/main/java/com/juick/server/TopManager.java
+++ b/juick-server/src/main/java/com/juick/server/TopManager.java
@@ -22,8 +22,6 @@ import com.juick.User;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
import com.juick.util.MessageUtils;
-import com.vk.api.sdk.exceptions.ApiException;
-import com.vk.api.sdk.exceptions.ClientException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,8 +42,6 @@ public class TopManager {
@Inject
private FacebookPageManager facebookPageManager;
@Inject
- private VKWallManager vkWallManager;
- @Inject
private CrosspostManager crosspostManager;
@Inject
private UserService userService;
@@ -70,13 +66,10 @@ public class TopManager {
String link = "https://juick.com/" + jmsg.getMid();
try {
facebookPageManager.post(status, link);
- vkWallManager.post(status, link);
} catch (HttpClientErrorException ex) {
HttpStatus statusCode = ex.getStatusCode();
String responseString = ex.getResponseBodyAsString();
logger.warn("facebook error {}: {}", statusCode.value(), responseString);
- } catch (ClientException | ApiException e) {
- logger.warn("vk error: {}", e);
}
jmsg.setUser(serviceUser);
crosspostManager.twitterPost(jmsg);
diff --git a/juick-server/src/main/java/com/juick/server/VKWallManager.java b/juick-server/src/main/java/com/juick/server/VKWallManager.java
deleted file mode 100644
index 5c0fee81..00000000
--- a/juick-server/src/main/java/com/juick/server/VKWallManager.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.juick.server;
-
-import com.juick.User;
-import com.juick.service.CrosspostService;
-import com.juick.service.UserService;
-import com.vk.api.sdk.client.TransportClient;
-import com.vk.api.sdk.client.VkApiClient;
-import com.vk.api.sdk.client.actors.UserActor;
-import com.vk.api.sdk.exceptions.ApiException;
-import com.vk.api.sdk.exceptions.ClientException;
-import com.vk.api.sdk.httpclient.HttpTransportClient;
-import com.vk.api.sdk.objects.apps.responses.GetResponse;
-import com.vk.api.sdk.objects.wall.responses.PostResponse;
-import org.apache.commons.lang3.tuple.Pair;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-@Component
-public class VKWallManager {
- @Value("${vk_appid}")
- private String VK_APPID;
- @Value("${vk_secret}")
- private String VK_SECRET;
- @Inject
- private UserService userService;
- @Inject
- private CrosspostService crosspostService;
- @Value("${vk_user:juick}")
- private String serviceUsername;
- @Value("${vk_group:-1}")
- private String vkGroup;
-
- private User serviceUser;
- private VkApiClient vk;
- private UserActor actor;
-
-
- @PostConstruct
- public void init() throws ClientException, ApiException {
- serviceUser = userService.getUserByName(serviceUsername);
- TransportClient transportClient = HttpTransportClient.getInstance();
- vk = new VkApiClient(transportClient);
- Pair<String, String> tokens = crosspostService.getVkTokens(serviceUser.getUid()).orElse(Pair.of("0", "0"));
- actor = new UserActor(Integer.valueOf(tokens.getLeft()), tokens.getRight());
- }
- public void post(String status, String link) throws ClientException, ApiException {
- vk.wall().post(actor)
- .ownerId(Integer.valueOf(vkGroup))
- .fromGroup(true)
- .message(status)
- .attachments(link)
- .execute();
- }
-}