mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-19 14:33:04 +03:00
Vk SDK impl
This commit is contained in:
parent
e55200f5eb
commit
f06516577b
3 changed files with 41 additions and 0 deletions
|
@ -44,6 +44,7 @@
|
||||||
pack project(':libLauncher')
|
pack project(':libLauncher')
|
||||||
pack project(':LauncherAPI')
|
pack project(':LauncherAPI')
|
||||||
bundle project(':Radon')
|
bundle project(':Radon')
|
||||||
|
bundle 'com.vk.api:sdk:1.0.2'
|
||||||
bundle 'mysql:mysql-connector-java:8.0.16'
|
bundle 'mysql:mysql-connector-java:8.0.16'
|
||||||
bundle 'org.jline:jline:3.11.0'
|
bundle 'org.jline:jline:3.11.0'
|
||||||
bundle 'org.jline:jline-reader:3.11.0'
|
bundle 'org.jline:jline-reader:3.11.0'
|
||||||
|
|
|
@ -161,6 +161,7 @@ public void registerClient(Channel channel) {
|
||||||
|
|
||||||
public void registerResponses() {
|
public void registerResponses() {
|
||||||
registerResponse("auth", AuthResponse.class);
|
registerResponse("auth", AuthResponse.class);
|
||||||
|
registerResponse("oauth", OAuthResponse.class);
|
||||||
registerResponse("checkServer", CheckServerResponse.class);
|
registerResponse("checkServer", CheckServerResponse.class);
|
||||||
registerResponse("joinServer", JoinServerResponse.class);
|
registerResponse("joinServer", JoinServerResponse.class);
|
||||||
registerResponse("profiles", ProfilesResponse.class);
|
registerResponse("profiles", ProfilesResponse.class);
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package ru.gravit.launchserver.websocket.json.auth;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import ru.gravit.launcher.OshiHWID;
|
||||||
|
import ru.gravit.launcher.events.request.OAuthRequestEvent;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
import ru.gravit.launchserver.websocket.json.SimpleResponse;
|
||||||
|
import ru.gravit.utils.HookException;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
public class OAuthResponse extends SimpleResponse {
|
||||||
|
|
||||||
|
public OshiHWID hwid;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(ChannelHandlerContext ctx, Client clientData) throws Exception {
|
||||||
|
try {
|
||||||
|
OAuthRequestEvent result = new OAuthRequestEvent();
|
||||||
|
result.URL = getAcsessURL();
|
||||||
|
sendResult(result);
|
||||||
|
} catch (HookException e) {
|
||||||
|
sendError(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public URL getAcsessURL() throws MalformedURLException {
|
||||||
|
|
||||||
|
String url = "https://oauth.vk.com/authorize?client_id=" + LaunchServer.server.config.OAuthAppID + "&display=page&response_type=code&v=5.69&redirect_uri=" + LaunchServer.server.config.getOAuthBackURL();
|
||||||
|
return new URL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "oauth";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue