From 9407408044d2b674da900b0eacdf370b2a44b690 Mon Sep 17 00:00:00 2001 From: nekobit Date: Mon, 31 Oct 2022 18:48:48 +0000 Subject: [PATCH] Comment out some code FossilOrigin-Name: 5a25a51a723fbd2ce3e19bdae48ad95c638bae147b4fa77632738d3b8ae9c451 --- src/local_config_set.c | 26 +++++++++++++------------- src/local_config_set.h | 8 ++++---- src/main.c | 15 ++++++++++++--- src/timeline.c | 8 ++++---- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/local_config_set.c b/src/local_config_set.c index 595f6d0..d0fcb67 100644 --- a/src/local_config_set.c +++ b/src/local_config_set.c @@ -75,20 +75,20 @@ void set_config_int(FCGX_Request* req, // Shorthand for the arguments passed into functions below #define LOAD_CFG_SIM(strcookie, varname) req, ssn, &(ssn->config.varname), (strcookie), &(ssn->post.varname), &(ssn->cookies.varname), page -struct mstdnt_storage* load_config(FCGX_Request* req, - struct session* ssn, - mastodont_t* api, - enum config_page page) +void load_config(FCGX_Request* req, + struct session* ssn, + mastodont_t* api, + enum config_page page) { - struct mstdnt_attachment* attachments = NULL; - struct mstdnt_storage* storage = NULL; - size_t attachments_len = 0; - if (ssn->post.set.is_set) - { - try_upload_media(&storage, ssn, api, &attachments, NULL); - } - struct key atm = { .type.s = attachments ? attachments[0].url : NULL, .is_set = attachments ? 1 : 0 }; - set_config_str(req, ssn, &(ssn->config.background_url), "background_url", &(atm), &(ssn->cookies.background_url), page, CONFIG_APPEARANCE); + /* struct mstdnt_attachment* attachments = NULL; */ + /* struct mstdnt_storage* storage = NULL; */ + /* size_t attachments_len = 0; */ + /* if (ssn->post.set.is_set) */ + /* { */ + /* try_upload_media(&storage, ssn, api, &attachments, NULL); */ + /* } */ + /* struct key atm = { .type.s = attachments ? attachments[0].url : NULL, .is_set = attachments ? 1 : 0 }; */ + /* set_config_str(req, ssn, &(ssn->config.background_url), "background_url", &(atm), &(ssn->cookies.background_url), page, CONFIG_APPEARANCE); */ set_config_int(LOAD_CFG_SIM("sidebaropacity", sidebar_opacity), CONFIG_APPEARANCE); set_config_str(LOAD_CFG_SIM("theme", theme), CONFIG_APPEARANCE); set_config_int(LOAD_CFG_SIM("jsactions", jsactions), CONFIG_GENERAL); diff --git a/src/local_config_set.h b/src/local_config_set.h index 63fc447..751cacd 100644 --- a/src/local_config_set.h +++ b/src/local_config_set.h @@ -79,9 +79,9 @@ void set_config_int(FCGX_Request* req, * @param page Page enum, to ensure that config changes on different pages don't effect other cookies * @return Storage if files were uploaded, must free. This might change */ -struct mstdnt_storage* load_config(FCGX_Request* req, - struct session* ssn, - mastodont_t* api, - enum config_page page); +void load_config(FCGX_Request* req, + struct session* ssn, + mastodont_t* api, + enum config_page page); #endif // LOCAL_CONFIG_SET_H diff --git a/src/main.c b/src/main.c index 1e6bb45..a8e99ce 100644 --- a/src/main.c +++ b/src/main.c @@ -175,13 +175,19 @@ static int application(mastodont_t* api, REQUEST_T req) char* path_info = GET_ENV("PATH_INFO", req); if (path_info && strcmp(path_info, "/config/appearance") == 0) page = CONFIG_APPEARANCE; - struct mstdnt_storage* attachments = load_config(req, ssn, api, page); + load_config(req, ssn, api, page); // Load current account information - get_account_info(api, ssn); + //get_account_info(api, ssn); rc = handle_paths(req, ssn, api, paths, sizeof(paths)/sizeof(paths[0])); + // This is a direct page, no requests made, so cleanup now + if (rc == 0) + { + session_cleanup(ssn); + } + return rc; } @@ -213,8 +219,11 @@ static void fcgi_start(mastodont_t* api) rc = application(api, req); - if (rc != 1) + if (rc == 0) + { FCGX_Finish_r(req); + + } } } #else diff --git a/src/timeline.c b/src/timeline.c index 932c5cb..c545a70 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -141,7 +141,8 @@ int tl_direct(REQUEST_T req, struct session* ssn, mastodont_t* api) static void request_cb_tl_public(mstdnt_request_cb_data_t data, void* args) { - + struct request_args* cb_args = args; + content_timeline(req, ssn, api, &storage, statuses, statuses_len, cat, NULL, 1, 0); } int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, enum base_category cat) @@ -169,12 +170,11 @@ int tl_public(REQUEST_T req, struct session* ssn, mastodont_t* api, int local, e try_post_status(ssn, api); - struct request_args cb_args + struct request_args cb_args = + request_args_create(req, ssn); mstdnt_timeline_public(api, &m_args, request_cb_tl_public, ssn, &args, &storage, &statuses, &statuses_len); return 1; - - content_timeline(req, ssn, api, &storage, statuses, statuses_len, cat, NULL, 1, 0); } int tl_list(REQUEST_T req, struct session* ssn, mastodont_t* api, char* list_id)