commit 3a808745bd7fe837adb606174d77d0891e3966dd from: Omar Polo date: Thu Mar 02 15:15:40 2023 UTC more tweaks for the navigation - move the user home for last - adjust how "up" works - include the user name in the "home" link commit - ceba53a60fdfdb73913897fa179ac191312efaf9 commit + 3a808745bd7fe837adb606174d77d0891e3966dd blob - 345dabf5fe01de8381a5218722481f97d1ba4a64 blob + 0a15e33f2954fcf9b6d0bb279c0b0599a680d3bf --- fragments.tmpl +++ fragments.tmpl @@ -95,10 +95,10 @@ gemini://{{ pc->proxy_name }}{{ path }} {{ define tp_navigation(struct template *tp) }} {! struct client *clt = tp->tp_arg; - const char *prfx = clt->clt_script_name; + const char *dname, *dsufx = "/", *prfx = clt->clt_script_name; char *path = clt->clt_path_info; char *tilde, *t, home[GEMINI_MAXLEN], up[GEMINI_MAXLEN]; - char *dname; + char usr[64]; char c; *home = '\0'; @@ -108,23 +108,34 @@ gemini://{{ pc->proxy_name }}{{ path }} *t = '\0'; (void) strlcpy(home, path + 1, sizeof(home)); *t = c; + + c = *--t; + *t = '\0'; + (void) strlcpy(usr, tilde + 2, sizeof(usr)); + *t = c; } (void) strlcpy(up, path + 1, sizeof(up)); dname = dirname(up); + if (!strcmp(dname, ".")) { + dname = ""; + dsufx = ""; + } !}