From 269c3c4b83083e130b0e2f86733069b4b706a100 Mon Sep 17 00:00:00 2001 From: xdevelnet Date: Wed, 2 Aug 2023 01:05:01 +0300 Subject: [PATCH] Remove useless links on top of page, but instead add link to "Add" which leads to /page --- src/app.c | 11 ++++++++--- static/minimalist/index (copy).html | 2 +- static/minimalist/index (copy).ssb | Bin 1636 -> 1552 bytes static/minimalist/index.html | 4 +--- static/minimalist/index.ssb | Bin 2152 -> 2052 bytes 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app.c b/src/app.c index 4618648..37125bd 100644 --- a/src/app.c +++ b/src/app.c @@ -82,6 +82,7 @@ const char default_header_nocache_3[] = "Expires: 0"; #define LI_AND_A_TAGS_PREF "
  • " +#define LI_AND_A_PAGE_FULL_STR "
  • Add" LI_A_SUFF #define LI_AND_A_USER "
  • " #define LI_FULL_LOGIN_STR LI_AND_A_USER "Login" LI_A_SUFF #define LI_AND_A_LOGOUT_FULL_STR "
  • Logout" LI_A_SUFF @@ -256,7 +257,7 @@ bool is_user_legit(struct layer_context *l, struct usr *u) { return true; } -#define BUF_USERDISPLAY_CALC (sizeof(u->display_name)+strizeof(LI_AND_A_LOGOUT_FULL_STR)+strizeof(LI_AND_A_USER)+strizeof(LI_A_SUFF)+sizeof(char)) +#define BUF_USERDISPLAY_CALC (strizeof(LI_AND_A_PAGE_FULL_STR)+sizeof(u->display_name)+strizeof(LI_AND_A_LOGOUT_FULL_STR)+strizeof(LI_AND_A_USER)+strizeof(LI_A_SUFF)+sizeof(char)) static void internal_server_error(reqargs a, const char *error) { struct appcontext *con = CONTEXT; @@ -281,7 +282,7 @@ static void internal_server_error(reqargs a, const char *error) { char buffer[CBL_MAX(KEY_VAL_MAXKEYLEN, BUF_USERDISPLAY_CALC)]; ssize_t size = - ((ssize_t) sizeof(struct usr)); if (find_cookie_existence(a, "id", buffer) != 0 and key_val(buffer, u, &size, l, NULL) == true and is_user_valid(u) == true) { - size_t strsize = (size_t) sprintf(buffer, LI_AND_A_USER "%s" LI_A_SUFF LI_AND_A_LOGOUT_FULL_STR, u->display_name); + size_t strsize = (size_t) sprintf(buffer, LI_AND_A_PAGE_FULL_STR LI_AND_A_USER "%s" LI_A_SUFF LI_AND_A_LOGOUT_FULL_STR, u->display_name); out[USER_PAGE_PART] = buffer; outsizes[USER_PAGE_PART] = strsize; } @@ -315,7 +316,7 @@ static void notfound(reqargs a) { char buffer[CBL_MAX(KEY_VAL_MAXKEYLEN, BUF_USERDISPLAY_CALC)]; ssize_t size = - ((ssize_t) sizeof(struct usr)); if (find_cookie_existence(a, "id", buffer) != 0 and key_val(buffer, u, &size, l, NULL) == true and is_user_valid(u) == true) { - size_t strsize = (size_t) sprintf(buffer, LI_AND_A_USER "%s" LI_A_SUFF LI_AND_A_LOGOUT_FULL_STR, u->display_name); + size_t strsize = (size_t) sprintf(buffer, LI_AND_A_PAGE_FULL_STR LI_AND_A_USER "%s" LI_A_SUFF LI_AND_A_LOGOUT_FULL_STR, u->display_name); out[USER_PAGE_PART] = buffer; outsizes[USER_PAGE_PART] = strsize; } @@ -373,6 +374,7 @@ static inline void selector_show_tag_processing(reqargs a, struct blog_record *b APP_WRITE(LI_FULL_LOGIN_STR, strizeof(LI_FULL_LOGIN_STR)); break; } + APP_WRITECS(LI_AND_A_PAGE_FULL_STR); APP_WRITE(LI_AND_A_USER, strizeof(LI_AND_A_USER)); APP_WRITE(u->display_name, strlen(u->display_name)); APP_WRITE(LI_A_SUFF, strizeof(LI_A_SUFF)); @@ -532,6 +534,7 @@ static inline void record_show_tag_processing(reqargs a, int32_t tag, struct blo APP_WRITE(LI_FULL_LOGIN_STR, strizeof(LI_FULL_LOGIN_STR)); break; } + APP_WRITECS(LI_AND_A_PAGE_FULL_STR); APP_WRITE(LI_AND_A_USER, strizeof(LI_AND_A_USER)); APP_WRITE(u->display_name, strlen(u->display_name)); APP_WRITE(LI_A_SUFF, strizeof(LI_A_SUFF)); @@ -639,6 +642,7 @@ static inline void user_panel_processing(reqargs a, int32_t tag, struct usr *u) APP_WRITE(u->display_name, strlen(u->display_name)); break; case USER_PAGE_PART: + APP_WRITECS(LI_AND_A_PAGE_FULL_STR); APP_WRITE(LI_AND_A_USER, strizeof(LI_AND_A_USER)); APP_WRITE(u->display_name, strlen(u->display_name)); APP_WRITE(LI_A_SUFF, strizeof(LI_A_SUFF)); @@ -846,6 +850,7 @@ static inline void editor_processing(reqargs a, int32_t tag, struct usr *u, char APP_WRITE(default_add_edit_form_html, strizeof(default_add_edit_form_html)); break; case USER_PAGE_PART: + APP_WRITECS(LI_AND_A_PAGE_FULL_STR); APP_WRITE(LI_AND_A_USER, strizeof(LI_AND_A_USER)); APP_WRITE(u->display_name, strlen(u->display_name)); APP_WRITE(LI_A_SUFF, strizeof(LI_A_SUFF)); diff --git a/static/minimalist/index (copy).html b/static/minimalist/index (copy).html index 849f252..6018903 100644 --- a/static/minimalist/index (copy).html +++ b/static/minimalist/index (copy).html @@ -1 +1 @@ -{{title}} - {{sitename}}
    {{repeat_1}}
      {{tags}}

    {{title}}

    {{content}}
    {{repeat_2}}
    {{footer}}
    +{{title}} - {{sitename}}
    {{repeat_1}}
      {{tags}}

    {{title}}

    {{content}}
    {{repeat_2}}
    {{footer}}
    diff --git a/static/minimalist/index (copy).ssb b/static/minimalist/index (copy).ssb index 9af6ef03cb6100075782559e2ef8bcb16d6f7c8d..bf10667af393199b52a150a2140916f5142b9483 100644 GIT binary patch delta 41 xcmaFDGl54iIM^w~)i=P$F~rqCl!1X^#YVwsmd$%v0vIO?ut_kQPu66!1_1KM3abDB delta 118 zcmbQh^Mpq*IM^w~)i=P$F~rqCl!1Za=SIP377v@8Ogo!Ig^Z%qG+QP8#H9Sv5?wnI)2u8EEX}J**Op9h0xJS_1${ C(IfT% diff --git a/static/minimalist/index.html b/static/minimalist/index.html index de5fadb..7946833 100644 --- a/static/minimalist/index.html +++ b/static/minimalist/index.html @@ -42,11 +42,9 @@
    diff --git a/static/minimalist/index.ssb b/static/minimalist/index.ssb index e7c16335127f193fd1bf69e82e0d7df54751b484..6185a07bcb404cb1b782b4a6b785dc95dfe8777f 100644 GIT binary patch delta 50 zcmaDM&>|od9PAY0>KowW7~*Om$iTp`nth{?66<7B)_~2=SZ$a%oq%G$|NsB5Ia!y( F8USYr4=4Zt delta 135 zcmZn>cp)GZ9PAY0>KowW7~*Om$iTqB%dt^NiIq`dvI%QIfK5)OolT-bMp0^-t&)CX zQhsTPuA!2hBZy(6pJ->J4^+U*#R&$eij(v6N)nSxbd8kkoFPnw(&Ej{ Pi+=zA|G#_kNp@=hgGDDk