aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/assets/scripts.js3
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java35
2 files changed, 2 insertions, 36 deletions
diff --git a/juick-www/src/main/assets/scripts.js b/juick-www/src/main/assets/scripts.js
index 9da9ce3c..57ab9ee4 100644
--- a/juick-www/src/main/assets/scripts.js
+++ b/juick-www/src/main/assets/scripts.js
@@ -519,7 +519,8 @@ function resultMessage(str) {
function likeMessage(e, mid) {
if (confirm(i18n('message.likeThisMessage?'))) {
- fetch('//juick.com/like?mid=' + mid, {
+ fetch('//api.juick.com/like?mid=' + mid
+ + '&hash=' + document.getElementById('body').getAttribute('data-hash'), {
method: 'POST',
credentials: 'same-origin'
})
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 4192bc11..585a4906 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
@@ -289,41 +289,6 @@ public class NewMessage {
return "redirect:/" + msg.getUser().getName() + "/" + mid + "#" + ridnew;
}
- @PostMapping("/like")
- @ResponseBody
- public Status doPostRecomm(@RequestParam Integer mid) throws IOException {
- com.juick.User visitor = UserUtils.getCurrentUser();
- if (visitor.getUid() == 0) {
- throw new HttpForbiddenException();
- }
- com.juick.Message msg = messagesService.getMessage(mid);
- if (msg == null) {
- throw new HttpNotFoundException();
- }
- if (msg.getUser().getUid() == visitor.getUid()) {
- throw new HttpForbiddenException();
- }
-
- MessagesService.RecommendStatus res = messagesService.recommendMessage(mid, visitor.getUid());
-
- if (res == MessagesService.RecommendStatus.Added) {
- if (xmpp.isConnected()) {
- Message xmsg = new Message();
- xmsg.setFrom(Jid.of("juick@juick.com"));
- xmsg.setTo(Jid.of("recomm@s2s.juick.com"));
- com.juick.Message jmsg = new com.juick.Message();
- jmsg.setMid(mid);
- jmsg.setUser(visitor);
- xmsg.addExtension(jmsg);
- xmpp.send(xmsg);
- } else {
- logger.warn("XMPP unavailable");
- }
- } else if (res == MessagesService.RecommendStatus.Error) {
- throw new HttpBadRequestException();
- }
- return Status.OK;
- }
@PostMapping("/pm/send")
public String doPostPM(@RequestParam(name = "uname", required = false) String unameParam,
@RequestParam String body) throws IOException {