diff --git a/index.php b/index.php index 9de40f3..39d10f2 100644 --- a/index.php +++ b/index.php @@ -182,6 +182,11 @@ // Number of users $totalItems = count( $following_files ); + // Sort users by most recent first + usort( $following_files, function( $a, $b ) { + return filemtime($b) - filemtime($a); + }); + // Create a list of all accounts being followed $items = array(); foreach ( $following_files as $following_file ) { @@ -210,6 +215,11 @@ // Number of users $totalItems = count( $follower_files ); + // Sort users by most recent first + usort( $follower_files, function( $a, $b ) { + return filemtime($b) - filemtime($a); + }); + // Create a list of everyone being followed $items = array(); foreach ( $follower_files as $follower_file ) { @@ -1224,8 +1234,9 @@ HTML; // Create an ordered list $orderedItems = []; foreach ( $posts as $post ) { + $postData = json_decode( file_get_contents( $post ), true ); $orderedItems[] = array( - "type" => "Create", + "type" => $postData["type"], "actor" => "https://{$server}/{$username}", "object" => "https://{$server}/{$post}" );