diff options
Diffstat (limited to 'src/main/java/com/juick/http/www/User.java')
-rw-r--r-- | src/main/java/com/juick/http/www/User.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/juick/http/www/User.java b/src/main/java/com/juick/http/www/User.java index 9ccf43ac..1f2b7dc0 100644 --- a/src/main/java/com/juick/http/www/User.java +++ b/src/main/java/com/juick/http/www/User.java @@ -18,6 +18,7 @@ package com.juick.http.www; import com.juick.Tag; +import com.juick.server.Endpoints; import com.juick.server.MessagesQueries; import com.juick.server.TagQueries; import com.juick.server.UserQueries; @@ -271,7 +272,7 @@ public class User { String hReferer = request.getHeader("Referer"); String ref = Utils.getCookie(request, "ref"); - if (ref == null && (hReferer == null || !(hReferer.startsWith("http://juick.com/") || hReferer.startsWith("https://juick.com/")))) { + if (ref == null && (hReferer == null || !(hReferer.startsWith("http://"+ Endpoints.wwwJuickCom+"/") || hReferer.startsWith("https://"+Endpoints.wwwJuickCom+"/")))) { Cookie c = new Cookie("ref", Integer.toString(uid)); c.setMaxAge(7 * 24 * 60 * 60); c.setPath("/"); @@ -361,7 +362,7 @@ public class User { }), user.getUID()); } - int maxUsageCnt = tags.stream().mapToInt(tag -> tag.UsageCnt).max().getAsInt(); + int maxUsageCnt = tags.size() > 0 ? tags.stream().mapToInt(tag -> tag.UsageCnt).max().getAsInt() : 1; return tags.stream().map(tag -> "<a href=\"./?tag=" + URLEncoder.encode(tag.Name) + "\" title=\"" + tag.UsageCnt + "\" rel=\"nofollow\">" + tag.Name + "</a>") |