mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 22:37:06 -04:00
Merge branch 'master' of https://github.com/huanghongxun/HMCL
修改: HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/SkinmeAuthenticator.java 修改: HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties 修改: HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties 修改: README.md
This commit is contained in:
commit
d3372e6a60
@ -18,7 +18,6 @@
|
||||
package org.jackhuang.hellominecraft.launcher.utils.auth;
|
||||
|
||||
import org.jackhuang.hellominecraft.C;
|
||||
import org.jackhuang.hellominecraft.HMCLog;
|
||||
import org.jackhuang.hellominecraft.utils.code.DigestUtils;
|
||||
import org.jackhuang.hellominecraft.utils.NetUtils;
|
||||
import org.jackhuang.hellominecraft.views.Selector;
|
||||
@ -39,15 +38,14 @@ public final class SkinmeAuthenticator extends IAuthenticator {
|
||||
|
||||
public String getCharacter(String user, String hash, String $char) throws Exception {
|
||||
return NetUtils.get(
|
||||
"http://www.skinme.cc/api/login.php?user=" + user + "&hash=" + hash + (($char == null) ? "" : ("&char=" + $char)));
|
||||
"http://www.skinme.cc/api/login.php?user=" + user + "&hash=" + hash + (($char == null) ? "" : ("&char=" + $char)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserProfileProvider login(LoginInfo info) throws AuthenticationException {
|
||||
UserProfileProvider req = new UserProfileProvider();
|
||||
if (info.username == null || !info.username.contains("@")) {
|
||||
if (info.username == null || !info.username.contains("@"))
|
||||
throw new AuthenticationException(C.i18n("login.not_email"));
|
||||
}
|
||||
try {
|
||||
String usr = info.username.toLowerCase();
|
||||
String pwd = info.password;
|
||||
@ -58,45 +56,45 @@ public final class SkinmeAuthenticator extends IAuthenticator {
|
||||
String[] sl = data.split(":");
|
||||
if (null != sl[0])
|
||||
switch (sl[0]) {
|
||||
case "0":
|
||||
if (sl[1].contains("No Valid Character"))
|
||||
sl[1] = C.i18n("login.no_valid_character");
|
||||
throw new AuthenticationException(sl[1]);
|
||||
case "1": {
|
||||
String[] s = parseType1(sl[1]);
|
||||
req.setUserName(s[0]);
|
||||
req.setSession(s[1]);
|
||||
req.setUserId(s[1]);
|
||||
req.setAccessToken(s[1]);
|
||||
break;
|
||||
case "0":
|
||||
if (sl[1].contains("No Valid Character"))
|
||||
sl[1] = C.i18n("login.no_valid_character");
|
||||
throw new AuthenticationException(sl[1]);
|
||||
case "1": {
|
||||
String[] s = parseType1(sl[1]);
|
||||
req.setUserName(s[0]);
|
||||
req.setSession(s[1]);
|
||||
req.setUserId(s[1]);
|
||||
req.setAccessToken(s[1]);
|
||||
break;
|
||||
}
|
||||
case "2": {
|
||||
String[] charators = sl[1].split(";");
|
||||
int len = charators.length;
|
||||
String[] $char = new String[len];
|
||||
String[] user = new String[len];
|
||||
System.out.println(sl[1]);
|
||||
for (int i = 0; i < len; i++) {
|
||||
String[] charator = charators[i].split(",");
|
||||
$char[i] = charator[0];
|
||||
user[i] = charator[1];
|
||||
}
|
||||
case "2": {
|
||||
String[] charators = sl[1].split(";");
|
||||
int len = charators.length;
|
||||
String[] $char = new String[len];
|
||||
String[] user = new String[len];
|
||||
System.out.println(sl[1]);
|
||||
for (int i = 0; i < len; i++) {
|
||||
String[] charator = charators[i].split(",");
|
||||
$char[i] = charator[0];
|
||||
user[i] = charator[1];
|
||||
}
|
||||
Selector s = new Selector(null, user, C.i18n("login.choose_charactor"));
|
||||
s.setVisible(true);
|
||||
if (s.sel == Selector.failedToSel) {
|
||||
throw new AuthenticationException(C.i18n("message.cancelled"));
|
||||
} else {
|
||||
int index = s.sel;
|
||||
String character = $char[index];
|
||||
sl = getCharacter(usr, hashCode, character).split(":");
|
||||
String[] s2 = parseType1(sl[1]);
|
||||
req.setUserName(s2[0]);
|
||||
req.setSession(s2[1]);
|
||||
req.setUserId(s2[1]);
|
||||
req.setAccessToken(s2[1]);
|
||||
}
|
||||
break;
|
||||
Selector s = new Selector(null, user, C.i18n("login.choose_charactor"));
|
||||
s.setVisible(true);
|
||||
if (s.sel == Selector.FAILED_TO_SELECT)
|
||||
throw new AuthenticationException(C.i18n("message.cancelled"));
|
||||
else {
|
||||
int index = s.sel;
|
||||
String character = $char[index];
|
||||
sl = getCharacter(usr, hashCode, character).split(":");
|
||||
String[] s2 = parseType1(sl[1]);
|
||||
req.setUserName(s2[0]);
|
||||
req.setSession(s2[1]);
|
||||
req.setUserId(s2[1]);
|
||||
req.setAccessToken(s2[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
req.setUserType("Legacy");
|
||||
|
@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
# Hello Minecraft! Launcher.
|
||||
# Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
#
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Hello Minecraft! Launcher
|
||||
Hello Minecraft! Launcher is a Minecraft launcher.
|
||||
License is GPL v3, see http://www.gnu.org/licenses/.
|
||||
License is GPL v3, see http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
### Joining
|
||||
If you really want to join the development, here's some requests.
|
||||
|
Loading…
x
Reference in New Issue
Block a user