feat: made version on homepage link to repo
This commit is contained in:
3
Makefile
3
Makefile
@@ -6,10 +6,11 @@ PKG_DEPS := libxml-2.0 libcurl openssl
|
|||||||
GIT_HASH := $(shell git rev-parse --short HEAD)
|
GIT_HASH := $(shell git rev-parse --short HEAD)
|
||||||
GIT_DATE := $(shell git log -1 --format='%ad' --date='format:%y.%m.%d')
|
GIT_DATE := $(shell git log -1 --format='%ad' --date='format:%y.%m.%d')
|
||||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
GIT_REMOTE := $(shell git remote get-url origin)
|
||||||
|
|
||||||
VERSION := $(GIT_DATE)+$(GIT_HASH)_$(GIT_BRANCH)
|
VERSION := $(GIT_DATE)+$(GIT_HASH)_$(GIT_BRANCH)
|
||||||
|
|
||||||
CFLAGS := -Wall -Wextra -O2 -Isrc -DVERSION='"$(VERSION)"'
|
CFLAGS := -Wall -Wextra -O2 -Isrc -DVERSION='"$(VERSION)"' -DGIT_REMOTE='"$(GIT_REMOTE)"'
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -11,6 +11,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);
|
context_set(&ctx, "version", VERSION);
|
||||||
|
context_set(&ctx, "git_remote", GIT_REMOTE);
|
||||||
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);
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
#define VERSION "unknown"
|
#define VERSION "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GIT_REMOTE
|
||||||
|
#define GIT_REMOTE "https://git.bwaaa.monster/omnisearch"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LINK_FIELD_COUNT 3
|
#define LINK_FIELD_COUNT 3
|
||||||
|
|
||||||
int hex_to_int(char c);
|
int hex_to_int(char c);
|
||||||
|
|||||||
@@ -145,6 +145,13 @@ img[src=""] {
|
|||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.version-link {
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.version-link:hover {
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
.nav-settings-icon {
|
.nav-settings-icon {
|
||||||
width:24px;
|
width:24px;
|
||||||
height:24px;
|
height:24px;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</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">
|
<footer class="home-footer">
|
||||||
<span class="version">{{version}}</span>
|
<a href="{{git_remote}}" class="version-link" target="_blank" rel="noopener noreferrer">{{version}}</a>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user