diff options
author | you | 2017-05-27 13:52:55 +0300 |
---|---|---|
committer | you | 2017-05-27 13:52:55 +0300 |
commit | dc430dec23586fd8a6ed3a0cc272f7cb1d8a8d88 (patch) | |
tree | f811cab95de96dd94f7dc6bf9f031944901883b8 /juick-www/src/main/java/com/juick/www/controllers | |
parent | 97e743385c94ac8a6084726d499c33373e255177 (diff) |
readonly mode is now provided by Cloudflare
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers')
9 files changed, 45 insertions, 63 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Help.java b/juick-www/src/main/java/com/juick/www/controllers/Help.java index 847f5d88..602850de 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Help.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Help.java @@ -72,7 +72,6 @@ public class Help { model.addAttribute("navigation", navigation); model.addAttribute("content", content); model.addAttribute("visitor", visitor); - model.addAttribute("readonly", messagesService.isReadonly()); return "views/help"; } diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index 6aa18526..8e875f2f 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -164,7 +164,6 @@ public class Home { model.addAttribute("title", title); model.addAttribute("headers", head); model.addAttribute("visitor", visitor); - model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("noindex", paramShow == null && paramBefore == 0); List<com.juick.Message> msgs = messagesService.getMessages(mids); diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index 4de4f5e9..7875f52b 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -105,30 +105,27 @@ public class NewMessage { templates.pageNavigation(out, visitor, null); out.println("<section id=\"content\" class=\"pagetext\">"); - if (messagesService.isReadonly()) { - out.println("<p>Временно недоступно</p>"); + + out.println("<form action=\"/post2\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">"); + out.println("<p style=\"text-align: left\"><b>Место: <span id=\"location\"></span></b> <span id=\"locationclear\">— <a href=\"#\" onclick=\"clearLocation()\">Отменить</a></span></p>"); + out.println("<p style=\"text-align: left\"><b>Фото:</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>(JPG, PNG, до 10Мб)</i></span></p>"); + + String body = request.getParameter("body"); + if (body == null) { + body = StringUtils.EMPTY; } else { - out.println("<form action=\"/post2\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">"); - out.println("<p style=\"text-align: left\"><b>Место: <span id=\"location\"></span></b> <span id=\"locationclear\">— <a href=\"#\" onclick=\"clearLocation()\">Отменить</a></span></p>"); - out.println("<p style=\"text-align: left\"><b>Фото:</b> <span id=\"attachmentfile\"><input type=\"file\" name=\"attach\"/> <i>(JPG, PNG, до 10Мб)</i></span></p>"); - - String body = request.getParameter("body"); - if (body == null) { - body = StringUtils.EMPTY; - } else { - if (body.length() > 4096) { - body = body.substring(0, 4096); - } - body = StringEscapeUtils.escapeHtml4(body); + if (body.length() > 4096) { + body = body.substring(0, 4096); } - out.println("<p><textarea name=\"body\" class=\"newmessage\" rows=\"7\" cols=\"10\">" + body + "</textarea><br/>"); - - out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" Отправить \"/></p>"); - out.println("</form>"); - out.println("<div id=\"geomap\"></div>"); - out.println("<p style=\"text-align: left\"><b>Теги:</b></p>"); - printUserTags(out, visitor); + body = StringEscapeUtils.escapeHtml4(body); } + out.println("<p><textarea name=\"body\" class=\"newmessage\" rows=\"7\" cols=\"10\">" + body + "</textarea><br/>"); + + out.println("<input type=\"hidden\" name=\"place_id\"/>" + "" + "<input type=\"submit\" class=\"subm\" value=\" Отправить \"/></p>"); + out.println("</form>"); + out.println("<div id=\"geomap\"></div>"); + out.println("<p style=\"text-align: left\"><b>Теги:</b></p>"); + printUserTags(out, visitor); out.println("</section>"); templates.pageFooter(request, out, visitor, false); diff --git a/juick-www/src/main/java/com/juick/www/controllers/PM.java b/juick-www/src/main/java/com/juick/www/controllers/PM.java index 82edb901..90fd14f8 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PM.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PM.java @@ -74,7 +74,6 @@ public class PM { model.addAttribute("visitor", visitor); model.addAttribute("msgs", msgs); model.addAttribute("tags", tagService.getPopularTags()); - model.addAttribute("readonly", messagesService.isReadonly()); return "views/pm_inbox"; } @@ -97,7 +96,6 @@ public class PM { model.addAttribute("msgs", msgs); model.addAttribute("tags", tagService.getPopularTags()); model.addAttribute("uname", uname); - model.addAttribute("readonly", messagesService.isReadonly()); return "views/pm_sent"; } diff --git a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java index 9c6251b0..925d1013 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PageTemplates.java @@ -84,9 +84,9 @@ public class PageTemplates { out.println("</head>"); out.flush(); if (visitor.getUid() > 0) { - out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\" data-readonly=\"" + messagesService.isReadonly() + "\">"); + out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\">"); } else { - out.println("<body id=\"body\" data-readonly=\"" + messagesService.isReadonly() + "\">"); + out.println("<body id=\"body\">"); } } @@ -112,9 +112,7 @@ public class PageTemplates { out.print("<li><a href=\"/?show=recommended\">Рекомендации</a></li>"); out.println("</ul></nav>"); out.print(" <nav id=\"actions\"><ul>"); - if (!messagesService.isReadonly()) { - out.print("<li><a href=\"/#post\">Написать</a></li>"); - } + out.print("<li><a href=\"/#post\">Написать</a></li>"); out.print("<li><a href=\"/" + visitor.getName() + "\">@" + visitor.getName() + "</a></li>"); out.print("<li><a href=\"/logout\">Выйти</a></li>"); out.println("</ul></nav>"); @@ -334,29 +332,27 @@ public class PageTemplates { if (msg.getAttachmentType() != null) { out.println(" <div class=\"irbr\"></div>"); } - if (!messagesService.isReadonly()) { - out.print(" <nav class=\"l\">"); - msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid()); - if (visitor.getUid() == 0) { - out.print("<a href=\"#\" class=\"a-login\">Рекомендовать</a>"); - } else { - out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Рекомендовать</a>"); - } - if (visitor.getUid() == 0 && !msg.ReadOnly) { - out.print("<a href=\"/" + msg.getMid() + "\" class=\"a-login\">Комментировать</a> "); - } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) { - out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> "); - } - if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) { - out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>"); - } - if (visitor.getUid() > 0 && visitor.getUid() == 3694) { - out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>"); - out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>"); - out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>"); - } - out.println("</nav>"); + out.print(" <nav class=\"l\">"); + msg.ReadOnly |= blUIDs.contains(msg.getUser().getUid()); + if (visitor.getUid() == 0) { + out.print("<a href=\"#\" class=\"a-login\">Рекомендовать</a>"); + } else { + out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Рекомендовать</a>"); } + if (visitor.getUid() == 0 && !msg.ReadOnly) { + out.print("<a href=\"/" + msg.getMid() + "\" class=\"a-login\">Комментировать</a> "); + } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) { + out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> "); + } + if (visitor.getUid() > 0 && msg.getPrivacy() < 0 && msg.getUser().getUid() == visitor.getUid()) { + out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>"); + } + if (visitor.getUid() > 0 && visitor.getUid() == 3694) { + out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>"); + out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>"); + out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>"); + } + out.println("</nav>"); out.print(" <nav class=\"s\">"); if (msg.getLikes() > 0) { diff --git a/juick-www/src/main/java/com/juick/www/controllers/Settings.java b/juick-www/src/main/java/com/juick/www/controllers/Settings.java index ad5d3d27..3c4511c1 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Settings.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Settings.java @@ -112,7 +112,6 @@ public class Settings { model.addAttribute("telegram_name", crosspostService.getTelegramName(visitor.getUid())); model.addAttribute("notify_options", subscriptionService.getNotifyOptions(visitor)); model.addAttribute("userinfo", userService.getUserInfo(visitor)); - model.addAttribute("readonly", messagesService.isReadonly()); if (page.equals("auth-email")) { if (emailService.verifyAddressByCode(visitor.getUid(), request.getParameter("code"))) { ; @@ -285,7 +284,6 @@ public class Settings { model.addAttribute("title", "Настройки"); model.addAttribute("visitor", visitor); model.addAttribute("result", result); - model.addAttribute("readonly", messagesService.isReadonly()); return "views/settings_result"; } } diff --git a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java index f459f3c0..77971165 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java +++ b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java @@ -84,7 +84,6 @@ public class SignUp { model.addAttribute("account", account); model.addAttribute("type", type); model.addAttribute("hash", hash); - model.addAttribute("readonly", messagesService.isReadonly()); return "views/signup"; } diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java index 461a2403..ef79a4b8 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/User.java +++ b/juick-www/src/main/java/com/juick/www/controllers/User.java @@ -139,7 +139,6 @@ public class User { model.addAttribute("visitor", visitor); model.addAttribute("user", user); model.addAttribute("noindex", paramShow == null && before == 0); - model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); @@ -197,7 +196,6 @@ public class User { model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex,nofollow\"/>"); model.addAttribute("visitor", visitor); model.addAttribute("user", user); - model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); @@ -225,7 +223,6 @@ public class User { model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>"); model.addAttribute("visitor", visitor); model.addAttribute("user", user); - model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); @@ -252,7 +249,6 @@ public class User { model.addAttribute("headers", "<meta name=\"robots\" content=\"noindex\"/>"); model.addAttribute("visitor", visitor); model.addAttribute("user", user); - model.addAttribute("readonly", messagesService.isReadonly()); model.addAttribute("isSubscribed", userService.isSubscribed(visitor.getUid(), user.getUid())); model.addAttribute("isInBL", userService.isInBL(visitor.getUid(), user.getUid())); model.addAttribute("isInBLAny", userService.isInBLAny(user.getUid(), visitor.getUid())); diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java index 1d1bb30b..1d854b8f 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java @@ -175,7 +175,7 @@ public class UserThread { } } - if (msg.VisitorCanComment && !messagesService.isReadonly()) { + if (msg.VisitorCanComment) { out.println(" <form action=\"/comment\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + msg.getMid() + "\"/>"); out.println(" <div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Написать комментарий\"></textarea></div></div>"); out.println(" </form>"); @@ -197,7 +197,7 @@ public class UserThread { out.println(" <li class=\"toolbar\"><ul>"); out.println(" <li><a href=\"/" + msg.getMid() + "\"><div style=\"background-position: -64px 0\"></div>" + msg.getMid() + "</a></li>"); - if (visitor.getUid() > 0 && !messagesService.isReadonly()) { + if (visitor.getUid() > 0) { if (visitor.getUid() != msg.getUser().getUid()) { if (messagesService.isSubscribed(visitor.getUid(), msg.getMid())) { out.println(" <li><a href=\"/post?body=U+%23" + msg.getMid() + "\"><div style=\"background-position: -48px 0\"></div>Подписан</a></li>"); @@ -335,7 +335,7 @@ public class UserThread { if (msg.getReplyto() > 0) { out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>"); } - if (msg.VisitorCanComment && !messagesService.isReadonly()) { + if (msg.VisitorCanComment) { out.println(" · <a href=\"/post?body=%23" + msg.getMid() + "/" + msg.getRid() + "%20\" class=\"a-thread-comment\">Ответить</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); } else if (visitor.getUid() == 0) { @@ -381,7 +381,7 @@ public class UserThread { if (msg.getReplyto() > 0) { out.print(" в ответ на <a href=\"#" + msg.getReplyto() + "\">/" + msg.getReplyto() + "</a>"); } - if (msg.VisitorCanComment && !messagesService.isReadonly()) { + if (msg.VisitorCanComment) { out.println(" · <a href=\"#\" class=\"a-thread-comment\">Ответить</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); } else if (visitor.getUid() == 0) { |