Fix CamSoda token label

This commit is contained in:
0xb00bface 2021-07-18 20:07:51 +02:00
parent 0d7393ee5b
commit 7e3073544e
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,7 @@
4.4.4
========================
* Fixed Camsoda token label
4.4.3 4.4.3
======================== ========================
* Changed Camsoda audio codec back to AAC. Sound should be back for recordings * Changed Camsoda audio codec back to AAC. Sound should be back for recordings

View File

@ -64,15 +64,14 @@ public class Camsoda extends AbstractSite {
throw new IOException("Account settings not available"); throw new IOException("Account settings not available");
} }
String username = Config.getInstance().getSettings().camsodaUsername; String url = BASE_URI + "/api/v1/user/current";
String url = BASE_URI + "/api/v1/user/" + username;
Request request = new Request.Builder().url(url).build(); Request request = new Request.Builder().url(url).build();
try(Response response = getHttpClient().execute(request)) { try (Response response = getHttpClient().execute(request)) {
if(response.isSuccessful()) { if (response.isSuccessful()) {
JSONObject json = new JSONObject(response.body().string()); JSONObject json = new JSONObject(response.body().string());
if(json.has("user")) { if (json.has("user")) {
JSONObject user = json.getJSONObject("user"); JSONObject user = json.getJSONObject("user");
if(user.has("tokens")) { if (user.has("tokens")) {
return (double) user.getInt("tokens"); return (double) user.getInt("tokens");
} }
} }