|
|
|
@ -31,6 +31,12 @@ bool handle_timeline( struct http_request* req, int timeline_id )
|
|
|
|
|
unsigned int limit = 100;
|
|
|
|
|
|
|
|
|
|
struct timeline* tl = timeline_from_id( timeline_id );
|
|
|
|
|
if( !tl ) {
|
|
|
|
|
http_request_send_headers( req, 200, "application/json", true );
|
|
|
|
|
FILE* f = http_request_get_response_body( req );
|
|
|
|
|
fprintf( f, "[]" );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct status* ss[32];
|
|
|
|
|
int count = timeline_load_statuses( tl, 0, 32, ss );
|
|
|
|
@ -88,7 +94,6 @@ bool route_mastodon_api( struct http_request* req )
|
|
|
|
|
printf( "authorization still valid\n" );
|
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
struct account* owner = account_from_id(0);
|
|
|
|
|
|
|
|
|
|
if( http_request_route( req, "notifications" ) ) {
|
|
|
|
|
return handle_notifications(req);
|
|
|
|
@ -112,7 +117,10 @@ bool route_mastodon_api( struct http_request* req )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if( http_request_route_method( req, "POST" ) ) {
|
|
|
|
|
return handle_post(req, owner);
|
|
|
|
|
struct account* owner = account_from_id(0);
|
|
|
|
|
bool res = handle_post(req, owner);
|
|
|
|
|
account_free(owner);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
} else if( http_request_route( req, "timelines/" ) ) {
|
|
|
|
|
if( http_request_route( req, "home" ) ) {
|
|
|
|
@ -139,12 +147,19 @@ bool route_mastodon_api( struct http_request* req )
|
|
|
|
|
if( !a ) { return false; }
|
|
|
|
|
|
|
|
|
|
if( http_request_route( req, "statuses" ) ) {
|
|
|
|
|
return handle_timeline( req, id );
|
|
|
|
|
bool res = handle_timeline( req, id );
|
|
|
|
|
account_free(a);
|
|
|
|
|
return res;
|
|
|
|
|
} else {
|
|
|
|
|
return handle_mastodon_api_show_account( req, a );
|
|
|
|
|
bool res = handle_mastodon_api_show_account( req, a );
|
|
|
|
|
account_free(a);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
} else if( id == 0 ) {
|
|
|
|
|
return handle_mastodon_api_show_account( req, owner );
|
|
|
|
|
struct account* owner = account_from_id(0);
|
|
|
|
|
bool res = handle_mastodon_api_show_account( req, owner );
|
|
|
|
|
account_free(owner);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|