aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);