Restructure mastodont load

FossilOrigin-Name: 8b211677cc57f44ca6491e7ff3cc9a5f387cdb0a6d2dcf8867d5c45c248d31df
This commit is contained in:
me@ow.nekobit.net 2022-04-04 02:08:56 +00:00
parent db0914a348
commit dd723758c4

View file

@ -46,10 +46,6 @@ int main(void)
// API
while (FCGI_Accept() >= 0)
{
mastodont_t api;
api.url = config_instance_url;
mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE | config_library_flags);
struct session ssn = {
.config = {
.changed = 0,
@ -58,15 +54,22 @@ int main(void)
.jsactions = 0,
.jsreply = 0,
.jslive = 0
}
},
.cookies = { 0 },
.post = { 0 },
.query = { 0 }
};
// Load cookies
char* cookies_str = read_cookies_env(&(ssn.cookies));
api.token = ssn.cookies.access_token; // Load token now
char* post_str = read_post_data(&(ssn.post));
char* get_str = read_query_data(&(ssn.query));
mastodont_t api;
api.url = config_instance_url;
mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE | config_library_flags);
api.token = ssn.cookies.access_token; // Load token now
/*******************
* Path handling *
******************/