feat: added version to homepage

This commit is contained in:
frosty
2026-04-03 15:15:41 -04:00
parent c9709029ca
commit db02c4cc80
5 changed files with 28 additions and 2 deletions

View File

@@ -3,13 +3,21 @@ UNAME_S := $(shell uname -s)
PKG_CONFIG ?= pkg-config PKG_CONFIG ?= pkg-config
PKG_DEPS := libxml-2.0 libcurl openssl 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) ifeq ($(UNAME_S),Darwin)
DEP_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_DEPS) 2>/dev/null) DEP_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_DEPS) 2>/dev/null)
DEP_LIBS := $(shell $(PKG_CONFIG) --libs $(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 LIBS := -lbeaker $(DEP_LIBS) -lpthread -lm
else else
CFLAGS := -Wall -Wextra -O2 -Isrc -I/usr/include/libxml2 CFLAGS += -I/usr/include/libxml2
LIBS := -lbeaker -lcurl -lxml2 -lpthread -lm -lssl -lcrypto LIBS := -lbeaker -lcurl -lxml2 -lpthread -lm -lssl -lcrypto
endif endif

View File

@@ -10,6 +10,7 @@ int home_handler(UrlParams *params) {
TemplateContext ctx = new_context(); TemplateContext ctx = new_context();
context_set(&ctx, "theme", theme); context_set(&ctx, "theme", theme);
context_set(&ctx, "version", VERSION);
beaker_set_locale(&ctx, locale); beaker_set_locale(&ctx, locale);
char *rendered_html = render_template("home.html", &ctx); char *rendered_html = render_template("home.html", &ctx);
send_response(rendered_html); send_response(rendered_html);

View File

@@ -3,6 +3,10 @@
#include <beaker.h> #include <beaker.h>
#ifndef VERSION
#define VERSION "unknown"
#endif
#define LINK_FIELD_COUNT 3 #define LINK_FIELD_COUNT 3
int hex_to_int(char c); int hex_to_int(char c);

View File

@@ -135,6 +135,16 @@ img[src=""] {
mask-position:center; mask-position:center;
text-decoration:none; 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 { .nav-settings-icon {
width:24px; width:24px;
height:24px; height:24px;

View File

@@ -39,6 +39,9 @@
</div> </div>
</div> </div>
<a href="/settings" class="home-settings-btn" title="{{l("settings_tab")}}"></a> <a href="/settings" class="home-settings-btn" title="{{l("settings_tab")}}"></a>
<footer class="home-footer">
<span class="version">{{version}}</span>
</footer>
</body> </body>
</html> </html>