diff --git a/Makefile b/Makefile
index 0b501f5..5365f39 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,10 @@ $(PAGES_DIR)/attachments.chtml: $(PAGES_DIR)/attachments.html
./filec $< data_attachments_html > $@
$(PAGES_DIR)/attachment_image.chtml: $(PAGES_DIR)/attachment_image.html
./filec $< data_attachment_image_html > $@
+$(PAGES_DIR)/emoji_reactions.chtml: $(PAGES_DIR)/emoji_reactions.html
+ ./filec $< data_emoji_reactions_html > $@
+$(PAGES_DIR)/emoji_reaction.chtml: $(PAGES_DIR)/emoji_reaction.html
+ ./filec $< data_emoji_reaction_html > $@
$(MASTODONT_DIR):
git clone $(MASTODONT_URL) || true
diff --git a/dist/ratfe20.css b/dist/ratfe20.css
index 817b77e..2d5782d 100644
--- a/dist/ratfe20.css
+++ b/dist/ratfe20.css
@@ -463,3 +463,10 @@ ul li:first-child a.sidebarbtn
color: #fff !important;
text-shadow: 0px 0px 5px #cc4444cc !important;
}
+
+/* Emoji reacts */
+.emoji-react-box
+{
+ border-radius: 4px;
+ border: 1px solid #cacaca;
+}
diff --git a/dist/skel.css b/dist/skel.css
index 4482d60..1b70219 100644
--- a/dist/skel.css
+++ b/dist/skel.css
@@ -484,3 +484,17 @@ ul li:not(:last-child) .split,
{
border: 1px solid #cacaca;
}
+
+/* Emoji reacts */
+.emoji-reactions
+{
+ display: flex;
+ margin-top: 8px;
+}
+
+.emoji-react-box
+{
+ padding: 3px 7px;
+ margin: 0 4px;
+}
+
diff --git a/src/.#attachments.c b/src/.#attachments.c
new file mode 120000
index 0000000..0ae091e
--- /dev/null
+++ b/src/.#attachments.c
@@ -0,0 +1 @@
+nekobit@toomuchram.2139:1646100446
\ No newline at end of file
diff --git a/src/emoji_reaction.c b/src/emoji_reaction.c
new file mode 100644
index 0000000..992e64e
--- /dev/null
+++ b/src/emoji_reaction.c
@@ -0,0 +1,55 @@
+/*
+ * RatFE - Lightweight frontend for Pleroma
+ * Copyright (C) 2022 Nekobit
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "string_helpers.h"
+#include "emoji_reaction.h"
+#include
+#include "easprintf.h"
+
+// Templates
+#include "../static/emoji_reaction.chtml"
+#include "../static/emoji_reactions.chtml"
+
+char* construct_emoji_reaction(struct mstdnt_emoji_reaction* emo, int* str_size)
+{
+ char* emo_html;
+
+ size_t s = easprintf(&emo_html, data_emoji_reaction_html,
+ emo->name, emo->count);
+ if (str_size) *str_size = s;
+ return emo_html;
+}
+
+static char* construct_emoji_reactions_voidwrap(void* passed, size_t index, int* res)
+{
+ return construct_emoji_reaction((struct mstdnt_emoji_reaction*)passed + index, res);
+}
+
+char* construct_emoji_reactions(struct mstdnt_emoji_reaction* emos, size_t emos_len, size_t* str_size)
+{
+ size_t elements_size;
+ char* elements = construct_func_strings(construct_emoji_reactions_voidwrap, emos, emos_len, &elements_size);
+ char* emos_view;
+
+ size_t s = easprintf(&emos_view, data_emoji_reactions_html, elements);
+ if (str_size) *str_size = s;
+ // Cleanup
+ free(elements);
+ return emos_view;
+}
+
diff --git a/src/emoji_reaction.h b/src/emoji_reaction.h
new file mode 100644
index 0000000..4c0872f
--- /dev/null
+++ b/src/emoji_reaction.h
@@ -0,0 +1,26 @@
+/*
+ * RatFE - Lightweight frontend for Pleroma
+ * Copyright (C) 2022 Nekobit
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef EMOJI_REACTION_H
+#define EMOJI_REACTION_H
+#include
+
+char* construct_emoji_reaction(struct mstdnt_emoji_reaction* emo, int* str_len);
+char* construct_emoji_reactions(struct mstdnt_emoji_reaction* emos, size_t emos_len, size_t* str_len);
+
+#endif // EMOJI_REACTION_H
diff --git a/src/status.c b/src/status.c
index 34e8076..2ffa017 100644
--- a/src/status.c
+++ b/src/status.c
@@ -26,6 +26,7 @@
#include "string_helpers.h"
#include "reply.h"
#include "attachments.h"
+#include "emoji_reaction.h"
#include "../config.h"
// Pages
@@ -91,6 +92,7 @@ char* construct_status(struct mstdnt_status* status, int* size)
char* repeat_count = NULL;
char* favourites_count = NULL;
char* attachments = NULL;
+ char* emoji_reactions = NULL;
if (status->replies_count)
easprintf(&reply_count, NUM_STR, status->replies_count);
if (status->reblogs_count)
@@ -99,6 +101,9 @@ char* construct_status(struct mstdnt_status* status, int* size)
easprintf(&favourites_count, NUM_STR, status->favourites_count);
if (status->media_attachments_len)
attachments = construct_attachments(status->media_attachments, status->media_attachments_len, NULL);
+ if (status->pleroma.emoji_reactions_len)
+ emoji_reactions = construct_emoji_reactions(status->pleroma.emoji_reactions, status->pleroma.emoji_reactions_len, NULL);
+
size_t s = easprintf(&stat_html, data_status_html,
status->account.avatar,
@@ -109,6 +114,7 @@ char* construct_status(struct mstdnt_status* status, int* size)
"Public", /* visibility */
status->content,
attachments ? attachments : "",
+ emoji_reactions ? emoji_reactions : "",
config_url_prefix,
status->id,
reply_count ? reply_count : "",
@@ -130,6 +136,7 @@ char* construct_status(struct mstdnt_status* status, int* size)
if (repeat_count) free(repeat_count);
if (favourites_count) free(favourites_count);
if (attachments) free(attachments);
+ if (emoji_reactions) free(emoji_reactions);
return stat_html;
}
diff --git a/src/string_helpers.h b/src/string_helpers.h
index 6adcc0f..04175e8 100644
--- a/src/string_helpers.h
+++ b/src/string_helpers.h
@@ -18,6 +18,7 @@
#ifndef STRING_HELPERS_H
#define STRING_HELPERS_H
+#include
/**
* Constructs a string based on a function
diff --git a/static/emoji_reaction.html b/static/emoji_reaction.html
new file mode 100644
index 0000000..a5ef493
--- /dev/null
+++ b/static/emoji_reaction.html
@@ -0,0 +1,3 @@
+
+ %s %u
+
diff --git a/static/emoji_reactions.html b/static/emoji_reactions.html
new file mode 100644
index 0000000..0036321
--- /dev/null
+++ b/static/emoji_reactions.html
@@ -0,0 +1,3 @@
+
+ %s
+
diff --git a/static/status.html b/static/status.html
index c97b5c8..fb85240 100644
--- a/static/status.html
+++ b/static/status.html
@@ -13,6 +13,7 @@
%s
%s
+ %s