diff --git a/Makefile b/Makefile
index a260ef4..4f0f358 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ GIT ?= git
MASTODONT_DIR = mastodont-c/
MASTODONT = $(MASTODONT_DIR)libmastodont.a
CFLAGS += -Wall -I $(MASTODONT_DIR)include/ -Wno-unused-variable -Wno-ignored-qualifiers -I/usr/include/ $(shell pkg-config --cflags libcurl libcjson libpcre)
-LDFLAGS = -L$(MASTODONT_DIR) -lmastodont $(shell pkg-config --libs libcjson libcurl libpcre) -lfcgi
+LDFLAGS = -lm -L$(MASTODONT_DIR) -lmastodont $(shell pkg-config --libs libcjson libcurl libpcre) -lfcgi
SRC = $(wildcard src/*.c)
OBJ = $(patsubst %.c,%.o,$(SRC))
HEADERS = $(wildcard src/*.h)
diff --git a/dist/treebird20.css b/dist/treebird20.css
index 72f9caa..0df503a 100644
--- a/dist/treebird20.css
+++ b/dist/treebird20.css
@@ -619,6 +619,29 @@ svg.in-reply-to-icon
width: auto;
}
+.seperator
+{
+ padding-left: 5px;
+ padding-right: 5px;
+ color: #606060;
+ vertical-align: middle;
+ font-size: 10px;
+}
+
+.time::before
+{
+ content: "•";
+ padding-right: 10px;
+ font-size: 10px;
+}
+
+.time
+{
+ color: #606060;
+ vertical-align: middle;
+ font-size: 15px;
+ padding-left: 5px;
+}
.status .status-info,
.notification-info-format,
@@ -640,6 +663,7 @@ svg.in-reply-to-icon
border-spacing: 0px;
padding: 0;
margin: 0;
+ vertical-align: middle;
}
.status .instance-info
@@ -1173,6 +1197,12 @@ p}
border: 1px solid #cacaca;
}
+.emoji-btn
+{
+ position: relative;
+ top: 2px;
+}
+
/* Emojo picker */
.emoji-picker
{
diff --git a/src/status.c b/src/status.c
index 9ddd0e8..82839c3 100644
--- a/src/status.c
+++ b/src/status.c
@@ -187,6 +187,7 @@ char* construct_interaction_buttons(struct session* ssn,
char* favourites_count = NULL;
char* emoji_picker_html = NULL;
char* reactions_btn_html = NULL;
+ char* time_str;
size_t s;
// Emojo picker
@@ -211,6 +212,8 @@ char* construct_interaction_buttons(struct session* ssn,
easprintf(&likeboost_html, data_likeboost_html,
config_url_prefix,
status->id);
+
+ time_str = reltime_to_str(status->created_at);
s = easprintf(&interaction_html, data_interaction_buttons_html,
config_url_prefix,
@@ -231,16 +234,18 @@ char* construct_interaction_buttons(struct session* ssn,
reactions_btn_html ? reactions_btn_html : "",
config_url_prefix,
status->id,
- status->id);
+ status->id,
+ reltime_to_str(status->created_at));
if (size) *size = s;
// Cleanup
- if (emoji_picker_html) free(emoji_picker_html);
- if (reply_count) free(reply_count);
- if (repeat_count) free(repeat_count);
- if (favourites_count) free(favourites_count);
- if (reactions_btn_html) free(reactions_btn_html);
- if (likeboost_html) free(likeboost_html);
+ free(emoji_picker_html);
+ free(reply_count);
+ free(repeat_count);
+ free(favourites_count);
+ free(reactions_btn_html);
+ free(likeboost_html);
+ free(time_str);
return interaction_html;
}
diff --git a/src/string.c b/src/string.c
index 17f5066..8453170 100644
--- a/src/string.c
+++ b/src/string.c
@@ -16,6 +16,11 @@
* along with this program. If not, see .
*/
+#define _XOPEN_SOURCE
+#define _DEFAULT_SOURCE
+#include
+#include
+#include "easprintf.h"
#include
#include
#include
@@ -23,10 +28,26 @@
char* reltime_to_str(time_t stime)
{
- char str[16];
- // Get current time
+ char* str;
+ // Get current time and convert it to GMT
time_t curr_time = time(NULL);
+ int since = curr_time - stime;
+ // Timezone likely off
+ if (since < 60)
+ easprintf(&str, "%ds", since);
+ else if (since < 60 * 60)
+ easprintf(&str, "%dm", since / 60);
+ else if (since < 60 * 60 * 24)
+ easprintf(&str, "%dh", since / (60 * 60));
+ else if (since < 60 * 60 * 24 * 31) // Not truly but werks
+ easprintf(&str, "%dd", since / (60 * 60 * 24));
+ else if (since < 60 * 60 * 24 * 365)
+ easprintf(&str, "%dmon", since / (60 * 60 * 24 * 31));
+ else
+ easprintf(&str, "%dyr", since / (60 * 60 * 24 * 365));
+
+ return str;
}
int streql(char* cmp1, char* cmp2)
diff --git a/static/interaction_buttons.html b/static/interaction_buttons.html
index 492533f..20d8a30 100644
--- a/static/interaction_buttons.html
+++ b/static/interaction_buttons.html
@@ -40,6 +40,9 @@
+
+ %s
+ |
diff --git a/static/reactions_btn.html b/static/reactions_btn.html
index d5a2a41..54ead9d 100644
--- a/static/reactions_btn.html
+++ b/static/reactions_btn.html
@@ -4,6 +4,6 @@
+ %s
- %s