Comment out some code

FossilOrigin-Name: 5a25a51a723fbd2ce3e19bdae48ad95c638bae147b4fa77632738d3b8ae9c451
This commit is contained in:
nekobit 2022-10-31 18:48:48 +00:00
parent bf3af231c8
commit 9407408044
4 changed files with 33 additions and 24 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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)