aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rw-r--r--src/Routes/Home.c1
-rw-r--r--src/Utility/Utility.h4
-rw-r--r--static/main.css10
-rw-r--r--templates/home.html3
5 files changed, 28 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 6e5b227..ecd6585 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,21 @@ UNAME_S := $(shell uname -s)
PKG_CONFIG ?= pkg-config
PKG_DEPS := libxml-2.0 libcurl openssl
+GIT_HASH := $(shell git rev-parse --short HEAD)
+GIT_DATE := $(shell git log -1 --format='%ad' --date='format:%y.%m.%d')
+GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
+
+VERSION := $(GIT_DATE)+$(GIT_HASH)_$(GIT_BRANCH)
+
+CFLAGS := -Wall -Wextra -O2 -Isrc -DVERSION='"$(VERSION)"'
+
ifeq ($(UNAME_S),Darwin)
DEP_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_DEPS) 2>/dev/null)
DEP_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_DEPS) 2>/dev/null)
-CFLAGS := -Wall -Wextra -O2 -Isrc $(DEP_CFLAGS)
+CFLAGS += $(DEP_CFLAGS)
LIBS := -lbeaker $(DEP_LIBS) -lpthread -lm
else
-CFLAGS := -Wall -Wextra -O2 -Isrc -I/usr/include/libxml2
+CFLAGS += -I/usr/include/libxml2
LIBS := -lbeaker -lcurl -lxml2 -lpthread -lm -lssl -lcrypto
endif
diff --git a/src/Routes/Home.c b/src/Routes/Home.c
index bbd53b7..1e5c3df 100644
--- a/src/Routes/Home.c
+++ b/src/Routes/Home.c
@@ -10,6 +10,7 @@ int home_handler(UrlParams *params) {
TemplateContext ctx = new_context();
context_set(&ctx, "theme", theme);
+ context_set(&ctx, "version", VERSION);
beaker_set_locale(&ctx, locale);
char *rendered_html = render_template("home.html", &ctx);
send_response(rendered_html);
diff --git a/src/Utility/Utility.h b/src/Utility/Utility.h
index 2002307..8d13306 100644
--- a/src/Utility/Utility.h
+++ b/src/Utility/Utility.h
@@ -3,6 +3,10 @@
#include <beaker.h>
+#ifndef VERSION
+#define VERSION "unknown"
+#endif
+
#define LINK_FIELD_COUNT 3
int hex_to_int(char c);
diff --git a/static/main.css b/static/main.css
index 1b56721..2ef60c3 100644
--- a/static/main.css
+++ b/static/main.css
@@ -135,6 +135,16 @@ img[src=""] {
mask-position:center;
text-decoration:none;
}
+.home-footer {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 8px 24px;
+ font-size: 12px;
+ color: var(--text-muted);
+ text-align: center;
+}
.nav-settings-icon {
width:24px;
height:24px;
diff --git a/templates/home.html b/templates/home.html
index 9921ac4..0aef27b 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -39,6 +39,9 @@
</div>
</div>
<a href="/settings" class="home-settings-btn" title="{{l("settings_tab")}}"></a>
+ <footer class="home-footer">
+ <span class="version">{{version}}</span>
+ </footer>
</body>
</html>