Commit d1dc1e7b authored by Drahomír Karchňák's avatar Drahomír Karchňák

Fix up

parent 481645c0
......@@ -225,7 +225,7 @@ public class CheckSettingsTask extends AsyncTask<Void, Void, JSONArray>
// Servers
final Set<String> serverSet;
final JSONArray servers = resultListItem.getJSONArray("servers");
final JSONArray servers = resultListItem.optJSONArray("servers");
if (servers == null || servers.length() == 0) {
Log.i(getClass().getSimpleName(), "No servers found in the response.");
......
......@@ -581,8 +581,6 @@ public class ControlServerConnection
requestData.put("time", time);
requestData.put("client_secret", ClientSecretHelper.prepareClientSecret(getUUID(), clientName, clientVersionName, clientVersionCode, time, BuildConfig.CLIENT_SECRET));
requestData.put("user_server_selection", true); //TODO - Is Developer Options Enabled
final int tcAcceptedVersion = ConfigHelper.getTCAcceptedVersion(context);
requestData.put("terms_and_conditions_accepted_version", tcAcceptedVersion);
if (tcAcceptedVersion > 0) // for server backward compatibility
......
......@@ -482,7 +482,7 @@ public class InformationCollector
Server server;
if((server = ConfigHelper.getUserSelectedServer(ctx)) != null) {
object.put("user_server_selection", true);
object.put("prefer_server", server);
object.put("prefer_server", server.getUuid());
}
}
......
......@@ -55,7 +55,7 @@ public class RegistrationResource extends ServerResource
String name;
int port;
String address;
String key;
String secret;
String type;
}
......@@ -448,7 +448,7 @@ public class RegistrationResource extends ServerResource
else
{
final String data = testUuid + "_" + testSlot;
final String hmac = Helperfunctions.calculateHMAC(server.key, data);
final String hmac = Helperfunctions.calculateHMAC(server.secret, data);
if (hmac.length() == 0)
errorList.addError("ERROR_TEST_TOKEN");
final String token = data + "_" + hmac;
......@@ -634,7 +634,7 @@ public class RegistrationResource extends ServerResource
result.address = address;
result.port = rs.getInt(ssl ? "port_ssl" : "port");
result.name = rs.getString("name") + " (" + rs.getString("city") + ")";
result.key = rs.getString("key");
result.secret = rs.getString("secret");
result.type = rs.getString("server_type");
return result;
......
......@@ -630,7 +630,7 @@ public class ResultResource extends ServerResource
private String selectSecretKeyByServerToken(String serverToken) {
final String sql =
"SELECT ts.key FROM test_server ts, test t " +
"SELECT ts.secret FROM test_server ts, test t " +
"WHERE t.server_id = ts.uid " +
"and t.token = ?";
......@@ -640,11 +640,11 @@ public class ResultResource extends ServerResource
try (ResultSet rs = ps.executeQuery()) {
if(!rs.next()) {
System.out.println("Couldn't find key for serverToken: " + serverToken);
System.out.println("Couldn't find secret for serverToken: " + serverToken);
return null;
}
String secret = rs.getString("key");
String secret = rs.getString("secret");
return secret;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment