From e5219082ef807024b2d485ee92bd4004f834023c Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 14 Feb 2022 05:48:37 +0000 Subject: [PATCH] Cookie fix and ratfe30 theme FossilOrigin-Name: 1982bd08a0fc62cfa6a3bf7c2ef005ebd89e8a30fb7a29e9dca58afa7317cf1e --- dist/ratfe30.css | 378 +++++++++++++++++++++++++++++++++++++++++++++++ src/base_page.c | 21 +-- 2 files changed, 389 insertions(+), 10 deletions(-) create mode 100644 dist/ratfe30.css diff --git a/dist/ratfe30.css b/dist/ratfe30.css new file mode 100644 index 0000000..009cfd5 --- /dev/null +++ b/dist/ratfe30.css @@ -0,0 +1,378 @@ +/* Basic elements */ +body +{ + font-family: Arial, Helvetica, sans-serif; + background-color: #f6f6f6; +} + +a +{ + color: #aa0000; +} + +/* Divs and wrappers */ +#display-wrapper +{ + display: flex; + justify-content: center; +} + +#display +{ + overflow: hidden; + background-color: #ffffff; + width: 1000px; + border-radius: 5px; + border: 1px solid #bababa; + box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3); +} + +#navbar +{ + display: flex; + align-items: center; + padding: 0 5px; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); +} + +#navbar img +{ + display: inline-block; + margin: 2px 2px 2px 8px; +} + +#navbar span.info +{ + margin-left: 15px; + color: #202020; + font-variant: small-caps; + font-size: 28px; +} + +#navbar-right +{ + padding-right: 8px; +} + +.alignend +{ + flex: 1; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: flex-end; +} + +div#content +{ + display: flex; +} + +div#content main +{ + flex: 1; + min-width: 0; + min-height: 600px; +} + +div#content aside +{ + width: 180px; + max-width: 180px; + min-width: 180px; +} + +#leftbar +{ + border-right: 1px solid #cacaca; +} + +#leftbar ul +{ + margin: 0 3px; + padding: 5px 0; +} + +#leftbar ul:not(:last-child) +{ + border-bottom: 1px solid #e4e4e4; +} + +#leftbar ul li +{ + list-style-type: none; +} + +/************************************************* + * BUTTONS * + *************************************************/ +input[type=button], input[type=submit], .sidebarbtn, .btn +{ + margin: 4px; + border-radius: 3px; + border: 1px solid #fcfcfc; + color: #000; + text-decoration: none; + transition: .2s; +} + +input[type=button]:hover, input[type=submit]:hover, .sidebarbtn:hover, .btn:hover +{ + background: #ececec; + border: 1px solid #dadada; + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.05); + cursor: pointer; +} + +input[type=button]:active, input[type=submit]:active, .sidebarbtn:active, .btn:active +{ + background: #e7e7e7; + border: 1px solid #dadada; + box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2); + cursor: pointer; +} + +input[type=button], input[type=submit] +{ + border: 1px solid #cacaca; + padding: 3px 15px; +} + +.sidebarbtn +{ + display: block; + padding: 8px 8px 8px 16px; +} + +#rightbar +{ + border-left: 1px solid #cacaca; +} + +/*************************** + * Statuses * + **************************/ +.status +{ + display: flex; + margin: 7px; +} + +.status:not(:last-child) +{ + border-bottom: 2px dotted #cacaca; +} + +.status .profile-picture +{ + display: inline-block; + width: 52px; + min-width: 52px; + height: 52px; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + border-radius: 4px; + margin-bottom: 5px; +} + +.status .status-info +{ + flex: 1; + display: flex; + margin: 0 5px 5px; + min-width: 0; + flex-direction: column; +} + +.status .instance-info +{ + font-style: italic; + text-decoration: none; + margin: 0 3px; +} + +.status .poster-stats +{ + display: flex; +} + +.status .username +{ + font-weight: bold; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.status .status-content +{ + margin: 2px 0 0 0; + overflow-wrap: break-word; +} + +.status .status-content p +{ + margin: 2px 0 0 0; +} + +.status-visibility +{ + color: #808080; +} + +/*************************** + * Element Grouping * + **************************/ +.group +{ + padding: 0; + margin: 0 !important; + height: 28px; + +} + +/* These are a pain for some reason */ +.group-inputbox +{ + border: 1px solid #cacaca; + padding-left: 5px; + border-right: 0px; + height: 26px; +} + +.group-left +{ + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; +} + +.group-right +{ + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; +} + +/************************* + * Config * + ************************/ +#config-page +{ + padding: 0 12px; +} + +#config-page h1 +{ + padding-left: 12px; + padding-bottom: 6px; + border-bottom: 1px solid #cacaca; +} + +#config-page h3 +{ + margin-left: 15px; +} + +#config-page ul +{ + list-style-type: none; + padding-left: 15px; +} + + +/********************** + * Profiles * + **********************/ +.header-btn +{ + text-decoration: none; + color: #606060; + font-size: 14px; +} + +.header-btn .btn-content +{ + color: #000; +} + +.btn.header-btn:hover span +{ + color: #fff; +} + +.header-btn span +{ + display: block; + text-align: center; +} + +.acct-banner +{ + width: 100%; + display: flex; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + height: 256px; + align-items: end; +} + +.acct-pfp +{ + position: relative; + z-index: 1; + border: 3px solid #cacaca; + background-color: #fff; + border-radius: 8px; + width: 100px; + height: 100px; + top: 38px; + left: 150px; + margin-top: -108px; + margin-left: -108px; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; +} + +.acct-header +{ + display: flex; + padding-left: 160px; + background: linear-gradient(#fff, #f1f1f1); + border-bottom: 1px solid #cacaca; + background-color: #e8e8e8; +} + +.acct-info-data +{ + position: relative; + left: 160px; + top: -10px; + font-weight: bold; + text-shadow: 0px 2px 6px #000; +} + +.acct-displayname +{ + font-size: 26px; + display: block; + color: #fff; +} + +.acct-username +{ + font-size: 14px; + color: #dadada; + display: block; + font-weight: bold; + text-shadow: 0px 0px 5px #000; +} + +.header-btn +{ + display: inline-block; + padding: 8px 15px; + margin: 0; + +} diff --git a/src/base_page.c b/src/base_page.c index d34ff5b..a647679 100644 --- a/src/base_page.c +++ b/src/base_page.c @@ -34,18 +34,19 @@ void render_base_page(struct base_page* page) char* cookie_read = cookie; struct http_cookie_info info = { 0 }; - while (!g_config.changed) - { - cookie_read = parse_cookies(cookie_read, &info); - - if (!(info.key && info.val)) break; - if (strcmp(info.key, "theme") == 0) + if (!g_config.changed && cookie) + while (1) { - g_config.theme = info.val; - } + cookie_read = parse_cookies(cookie_read, &info); + + if (!(info.key && info.val)) break; + if (strcmp(info.key, "theme") == 0) + { + g_config.theme = info.val; + } - if (!cookie_read) break; - } + if (!cookie_read) break; + } char* data; int len = easprintf(&data, data_index_html,