feat: added version to homepage
This commit is contained in:
12
Makefile
12
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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <beaker.h>
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "unknown"
|
||||
#endif
|
||||
|
||||
#define LINK_FIELD_COUNT 3
|
||||
|
||||
int hex_to_int(char c);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user