aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-02-19 19:11:25 +0300
committerGravatar Vitaly Takmazov2019-02-19 19:11:25 +0300
commitae3da8bbc97ad839505dc14e3f524249b5802940 (patch)
tree0a1bfb0ebbc0c9624cb9bc0234608db37e0f5cd2 /src/main/java
parent7f937bdffea9b0219f4fce079ccbad8d233a03b9 (diff)
Return legacy avatar url from legacy avatar endpoint
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/server/api/Users.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java
index 03e916d1..216cd68d 100644
--- a/src/main/java/com/juick/server/api/Users.java
+++ b/src/main/java/com/juick/server/api/Users.java
@@ -174,7 +174,8 @@ public class Users {
@Deprecated
@GetMapping("/api/avatar")
public ResponseEntity<Void> getAvatarUrl(@RequestParam(required = false) String uname,
- @RequestParam(required = false) String jid) {
+ @RequestParam(required = false) String jid,
+ @RequestParam(required = false, defaultValue = "48") Integer size) {
User user = AnonymousUser.INSTANCE;
if (StringUtils.isNotEmpty(uname)) {
user = userService.getUserByName(uname);
@@ -183,8 +184,9 @@ public class Users {
user = userService.getUserByJID(jid);
}
if (!user.isAnonymous()) {
+ String imagePrefix = size == 32 ? "as" : "a";
HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.setLocation(URI.create(webApp.getAvatarUrl(user)));
+ httpHeaders.setLocation(URI.create(String.format("http://i.juick.com/%s/%d.png", imagePrefix, user.getUid())));
return new ResponseEntity<>(httpHeaders, HttpStatus.MOVED_PERMANENTLY);
}
return new ResponseEntity<>(HttpStatus.NOT_FOUND);