Get following list working correctly

master
teknomunk 1 year ago
parent a47f16837b
commit e75061335c

@ -373,21 +373,33 @@ bool route_mastodon_api( struct http_request* req )
bool res = handle_timeline( req, id );
account_free(a);
return res;
} else if( http_request_route( req, "following" ) ) {
// TODO: implement stub
} else if( http_request_route( req, "followers" ) ) {
struct {
int* items;
int count;
} accounts;
account_list_followers( a, 0, 32, &accounts );
struct json_writer jw = {
.f = http_request_get_response_body( req ),
.indentation = "\t",
.indent = 0,
};
http_request_send_headers( req, 200, "application/json", true );
FILE* f = http_request_get_response_body( req );
fprintf( f, "[" );
fprintf( f, "]" );
json_write_array( &jw, &api_Account_type, &accounts );
free(accounts.items);
return true;
} else if( http_request_route( req, "followers" ) ) {
} else if( http_request_route( req, "following" ) ) {
struct {
int* items;
int count;
} accounts;
account_list_followers( a, 0, 32, &accounts );
account_list_following( a, 0, 32, &accounts );
struct json_writer jw = {
.f = http_request_get_response_body( req ),

Loading…
Cancel
Save