forked from mirrors/treebird
Fix cookies
FossilOrigin-Name: b45522c33710cac416f8faa7684a92c5721306d9d2a3d06a0d8f4bdffa1ed260
This commit is contained in:
parent
90e5ac7259
commit
869c992aca
5 changed files with 31 additions and 5 deletions
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "base_page.h"
|
||||
|
@ -33,7 +34,7 @@ void render_base_page(struct base_page* page)
|
|||
char* cookie_read = cookie;
|
||||
struct http_cookie_info info = { 0 };
|
||||
|
||||
/*while (1)
|
||||
while (!g_config.changed)
|
||||
{
|
||||
cookie_read = parse_cookies(cookie_read, &info);
|
||||
|
||||
|
@ -44,13 +45,12 @@ void render_base_page(struct base_page* page)
|
|||
}
|
||||
|
||||
if (!cookie_read) break;
|
||||
}*/
|
||||
}
|
||||
|
||||
char* data;
|
||||
int len = easprintf(&data, data_index_html,
|
||||
L10N[locale][L10N_APP_NAME],
|
||||
g_config.theme,
|
||||
g_config.theme,
|
||||
L10N[locale][L10N_APP_NAME],
|
||||
L10N[locale][L10N_SEARCH_PLACEHOLDER],
|
||||
L10N[locale][L10N_SEARCH_BUTTON],
|
||||
|
|
24
src/local_config.c
Normal file
24
src/local_config.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* RatFE - Lightweight frontend for Pleroma
|
||||
* Copyright (C) 2022 Nekobit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "local_config.h"
|
||||
|
||||
struct local_config g_config = {
|
||||
.changed = 0,
|
||||
.theme = "ratfe20"
|
||||
};
|
|
@ -21,9 +21,10 @@
|
|||
|
||||
struct local_config
|
||||
{
|
||||
int changed;
|
||||
char* theme;
|
||||
};
|
||||
|
||||
static struct local_config g_config;
|
||||
extern struct local_config g_config;
|
||||
|
||||
#endif // LOCAL_CONFIG_H
|
||||
|
|
|
@ -64,10 +64,12 @@ void content_config(mastodont_t* api, char** data, size_t size)
|
|||
g_config.theme = info.val;
|
||||
printf("Set-Cookie: %s=%s; HttpOnly; SameSite=Strict;",
|
||||
"theme", info.val);
|
||||
g_config.changed = 1;
|
||||
}
|
||||
|
||||
if (!p_query_read) break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct base_page b = {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<!-- <link rel="stylesheet" type="text/css" href="../dist/ratfe.css"> -->
|
||||
</head>
|
||||
<body>
|
||||
%s
|
||||
<div id="display-wrapper">
|
||||
<div id="display">
|
||||
<header id="navbar">
|
||||
|
|
Loading…
Reference in a new issue