Merge branch 'addRoutes' of github.com:Peer-at-Code/peer-at-code-backend into addRoutes
This commit is contained in:
commit
1c951e8581
3 changed files with 3 additions and 4 deletions
|
@ -27,7 +27,7 @@ public class Player implements Comparable<Player> {
|
|||
|
||||
public Player(String pseudo, String email, String firstname, String lastname, String description, String sgroup,
|
||||
byte[] avatar) {
|
||||
this(pseudo, email, firstname, lastname, description, sgroup, null, null);
|
||||
this(pseudo, email, firstname, lastname, description, sgroup, avatar, null);
|
||||
}
|
||||
public Player(String pseudo, String email, String firstname, String lastname, String description, String sgroup,
|
||||
byte[] avatar, String badges) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.password4j.Hash;
|
|||
import com.password4j.Password;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.Configuration;
|
||||
import be.jeffcheasey88.peeratcode.model.Badge;
|
||||
import be.jeffcheasey88.peeratcode.model.Chapter;
|
||||
import be.jeffcheasey88.peeratcode.model.Completion;
|
||||
import be.jeffcheasey88.peeratcode.model.Player;
|
||||
|
|
|
@ -11,6 +11,7 @@ import be.jeffcheasey88.peeratcode.webserver.User;
|
|||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.SortedSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -45,9 +46,8 @@ public class PlayerDetails implements Response {
|
|||
playerJSON.put("completions", player.getTotalCompletion());
|
||||
playerJSON.put("tries", player.getTotalTries());
|
||||
playerJSON.put("badges", player.getBadges());
|
||||
//playerJSON.put("avatar", Base64.getEncoder().encode(player.getAvatar()).toString());
|
||||
if(player.getAvatar() != null) playerJSON.put("avatar", new String(Base64.getEncoder().encode(player.getAvatar())));
|
||||
writer.write(playerJSON.toJSONString());
|
||||
writer.write(player.getAvatar());
|
||||
} else {
|
||||
HttpUtil.responseHeaders(writer, 400, "Access-Control-Allow-Origin: *");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue