1
0
Fork 0
forked from mirror/pixelfed
pixelfed/routes/api.php

224 lines
16 KiB
PHP
Raw Normal View History

2018-04-15 23:56:48 +00:00
<?php
use Illuminate\Http\Request;
2021-11-04 05:47:00 +00:00
$middleware = ['auth:api','validemail'];
2019-10-07 07:39:21 +00:00
2020-11-26 07:39:01 +00:00
Route::post('/f/inbox', 'FederationController@sharedInbox');
2018-12-24 02:42:04 +00:00
Route::post('/users/{username}/inbox', 'FederationController@userInbox');
2021-01-17 21:00:26 +00:00
Route::get('i/actor', 'InstanceActorController@profile');
Route::post('i/actor/inbox', 'InstanceActorController@inbox');
Route::get('i/actor/outbox', 'InstanceActorController@outbox');
2021-09-04 05:57:07 +00:00
Route::get('/stories/{username}/{id}', 'StoryController@getActivityObject');
2019-09-14 01:53:58 +00:00
Route::get('.well-known/webfinger', 'FederationController@webfinger')->name('well-known.webfinger');
Route::get('.well-known/nodeinfo', 'FederationController@nodeinfoWellKnown')->name('well-known.nodeinfo');
Route::get('.well-known/host-meta', 'FederationController@hostMeta')->name('well-known.hostMeta');
Route::redirect('.well-known/change-password', '/settings/password');
Route::get('api/nodeinfo/2.0.json', 'FederationController@nodeinfo');
2019-10-07 07:39:21 +00:00
Route::group(['prefix' => 'api'], function() use($middleware) {
2020-05-16 03:13:48 +00:00
2019-10-07 07:39:21 +00:00
Route::group(['prefix' => 'v1'], function() use($middleware) {
2019-09-21 03:25:02 +00:00
Route::post('apps', 'Api\ApiV1Controller@apps');
Route::get('apps/verify_credentials', 'Api\ApiV1Controller@getApp')->middleware($middleware);
2019-09-21 03:25:02 +00:00
Route::get('instance', 'Api\ApiV1Controller@instance');
2020-05-16 04:55:01 +00:00
Route::get('bookmarks', 'Api\ApiV1Controller@bookmarks')->middleware($middleware);
2021-05-25 05:24:42 +00:00
2019-10-07 07:39:21 +00:00
Route::get('accounts/verify_credentials', 'Api\ApiV1Controller@verifyCredentials')->middleware($middleware);
Route::match(['post', 'patch'], 'accounts/update_credentials', 'Api\ApiV1Controller@accountUpdateCredentials')->middleware($middleware);
2019-10-07 07:39:21 +00:00
Route::get('accounts/relationships', 'Api\ApiV1Controller@accountRelationshipsById')->middleware($middleware);
Route::get('accounts/search', 'Api\ApiV1Controller@accountSearch')->middleware($middleware);
Route::get('accounts/{id}/statuses', 'Api\ApiV1Controller@accountStatusesById')->middleware($middleware);
Route::get('accounts/{id}/following', 'Api\ApiV1Controller@accountFollowingById')->middleware($middleware);
Route::get('accounts/{id}/followers', 'Api\ApiV1Controller@accountFollowersById')->middleware($middleware);
Route::post('accounts/{id}/follow', 'Api\ApiV1Controller@accountFollowById')->middleware($middleware);
Route::post('accounts/{id}/unfollow', 'Api\ApiV1Controller@accountUnfollowById')->middleware($middleware);
Route::post('accounts/{id}/block', 'Api\ApiV1Controller@accountBlockById')->middleware($middleware);
Route::post('accounts/{id}/unblock', 'Api\ApiV1Controller@accountUnblockById')->middleware($middleware);
Route::post('accounts/{id}/pin', 'Api\ApiV1Controller@accountEndorsements')->middleware($middleware);
Route::post('accounts/{id}/unpin', 'Api\ApiV1Controller@accountEndorsements')->middleware($middleware);
Route::post('accounts/{id}/mute', 'Api\ApiV1Controller@accountMuteById')->middleware($middleware);
Route::post('accounts/{id}/unmute', 'Api\ApiV1Controller@accountUnmuteById')->middleware($middleware);
Route::get('accounts/{id}/lists', 'Api\ApiV1Controller@accountListsById')->middleware($middleware);
Route::get('lists/{id}/accounts', 'Api\ApiV1Controller@accountListsById')->middleware($middleware);
Route::get('accounts/{id}', 'Api\ApiV1Controller@accountById')->middleware($middleware);
2019-10-01 06:13:13 +00:00
2019-10-07 07:39:21 +00:00
Route::post('avatar/update', 'ApiController@avatarUpdate')->middleware($middleware);
Route::get('blocks', 'Api\ApiV1Controller@accountBlocks')->middleware($middleware);
Route::get('conversations', 'Api\ApiV1Controller@conversations')->middleware($middleware);
2019-10-01 06:13:13 +00:00
Route::get('custom_emojis', 'Api\ApiV1Controller@customEmojis');
2019-10-07 07:39:21 +00:00
Route::get('domain_blocks', 'Api\ApiV1Controller@accountDomainBlocks')->middleware($middleware);
Route::post('domain_blocks', 'Api\ApiV1Controller@accountDomainBlocks')->middleware($middleware);
Route::delete('domain_blocks', 'Api\ApiV1Controller@accountDomainBlocks')->middleware($middleware);
Route::get('endorsements', 'Api\ApiV1Controller@accountEndorsements')->middleware($middleware);
Route::get('favourites', 'Api\ApiV1Controller@accountFavourites')->middleware($middleware);
Route::get('filters', 'Api\ApiV1Controller@accountFilters')->middleware($middleware);
Route::get('follow_requests', 'Api\ApiV1Controller@accountFollowRequests')->middleware($middleware);
Route::post('follow_requests/{id}/authorize', 'Api\ApiV1Controller@accountFollowRequestAccept')->middleware($middleware);
Route::post('follow_requests/{id}/reject', 'Api\ApiV1Controller@accountFollowRequestReject')->middleware($middleware);
Route::get('lists', 'Api\ApiV1Controller@accountLists')->middleware($middleware);
Route::post('media', 'Api\ApiV1Controller@mediaUpload')->middleware($middleware);
Route::get('media/{id}', 'Api\ApiV1Controller@mediaGet')->middleware($middleware);
2019-10-07 07:39:21 +00:00
Route::put('media/{id}', 'Api\ApiV1Controller@mediaUpdate')->middleware($middleware);
Route::get('mutes', 'Api\ApiV1Controller@accountMutes')->middleware($middleware);
Route::get('notifications', 'Api\ApiV1Controller@accountNotifications')->middleware($middleware);
Route::get('suggestions', 'Api\ApiV1Controller@accountSuggestions')->middleware($middleware);
2019-10-01 06:13:13 +00:00
2019-10-07 07:39:21 +00:00
Route::post('statuses/{id}/favourite', 'Api\ApiV1Controller@statusFavouriteById')->middleware($middleware);
Route::post('statuses/{id}/unfavourite', 'Api\ApiV1Controller@statusUnfavouriteById')->middleware($middleware);
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@statusContext')->middleware($middleware);
Route::get('statuses/{id}/card', 'Api\ApiV1Controller@statusCard')->middleware($middleware);
Route::get('statuses/{id}/reblogged_by', 'Api\ApiV1Controller@statusRebloggedBy')->middleware($middleware);
Route::get('statuses/{id}/favourited_by', 'Api\ApiV1Controller@statusFavouritedBy')->middleware($middleware);
Route::post('statuses/{id}/reblog', 'Api\ApiV1Controller@statusShare')->middleware($middleware);
Route::post('statuses/{id}/unreblog', 'Api\ApiV1Controller@statusUnshare')->middleware($middleware);
2020-05-19 20:55:26 +00:00
Route::post('statuses/{id}/bookmark', 'Api\ApiV1Controller@bookmarkStatus')->middleware($middleware);
Route::post('statuses/{id}/unbookmark', 'Api\ApiV1Controller@unbookmarkStatus')->middleware($middleware);
2019-10-07 07:39:21 +00:00
Route::delete('statuses/{id}', 'Api\ApiV1Controller@statusDelete')->middleware($middleware);
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById')->middleware($middleware);
Route::post('statuses', 'Api\ApiV1Controller@statusCreate')->middleware($middleware);
2019-10-01 06:13:13 +00:00
2019-10-07 07:39:21 +00:00
Route::get('timelines/home', 'Api\ApiV1Controller@timelineHome')->middleware($middleware);
2021-07-07 03:21:16 +00:00
Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic')->middleware($middleware);
2022-12-31 06:23:39 +00:00
Route::get('timelines/tag/{hashtag}', 'Api\ApiV1Controller@timelineHashtag')->middleware($middleware);
2021-12-19 07:51:57 +00:00
Route::get('discover/posts', 'Api\ApiV1Controller@discoverPosts')->middleware($middleware);
Route::get('preferences', 'Api\ApiV1Controller@getPreferences')->middleware($middleware);
Route::get('trends', 'Api\ApiV1Controller@getTrends')->middleware($middleware);
Route::get('announcements', 'Api\ApiV1Controller@getAnnouncements')->middleware($middleware);
Route::get('markers', 'Api\ApiV1Controller@getMarkers')->middleware($middleware);
Route::post('markers', 'Api\ApiV1Controller@setMarkers')->middleware($middleware);
2023-05-09 06:21:46 +00:00
Route::get('followed_tags', 'Api\ApiV1Controller@getFollowedTags')->middleware($middleware);
2021-12-19 07:51:57 +00:00
});
2021-09-04 04:26:39 +00:00
2020-05-16 03:13:48 +00:00
Route::group(['prefix' => 'v2'], function() use($middleware) {
Route::get('search', 'Api\ApiV1Controller@searchV2')->middleware($middleware);
Route::post('media', 'Api\ApiV1Controller@mediaUploadV2')->middleware($middleware);
2022-06-26 22:06:08 +00:00
Route::get('streaming/config', 'Api\ApiV1Controller@getWebsocketConfig');
2020-05-16 03:13:48 +00:00
});
2020-05-16 04:55:01 +00:00
2022-07-20 02:05:00 +00:00
Route::group(['prefix' => 'v1.1'], function() use($middleware) {
Route::post('report', 'Api\ApiV1Dot1Controller@report')->middleware($middleware);
2022-09-25 02:52:19 +00:00
Route::group(['prefix' => 'accounts'], function () use($middleware) {
Route::delete('avatar', 'Api\ApiV1Dot1Controller@deleteAvatar')->middleware($middleware);
Route::get('{id}/posts', 'Api\ApiV1Dot1Controller@accountPosts')->middleware($middleware);
Route::post('change-password', 'Api\ApiV1Dot1Controller@accountChangePassword')->middleware($middleware);
Route::get('login-activity', 'Api\ApiV1Dot1Controller@accountLoginActivity')->middleware($middleware);
Route::get('two-factor', 'Api\ApiV1Dot1Controller@accountTwoFactor')->middleware($middleware);
Route::get('emails-from-pixelfed', 'Api\ApiV1Dot1Controller@accountEmailsFromPixelfed')->middleware($middleware);
Route::get('apps-and-applications', 'Api\ApiV1Dot1Controller@accountApps')->middleware($middleware);
});
2022-09-07 04:52:22 +00:00
2022-09-29 05:15:54 +00:00
Route::group(['prefix' => 'collections'], function () use($middleware) {
Route::get('accounts/{id}', 'CollectionController@getUserCollections')->middleware($middleware);
Route::get('items/{id}', 'CollectionController@getItems')->middleware($middleware);
Route::get('view/{id}', 'CollectionController@getCollection')->middleware($middleware);
2022-10-01 11:36:07 +00:00
Route::post('add', 'CollectionController@storeId')->middleware($middleware);
Route::post('update/{id}', 'CollectionController@store')->middleware($middleware);
Route::delete('delete/{id}', 'CollectionController@delete')->middleware($middleware);
Route::post('remove', 'CollectionController@deleteId')->middleware($middleware);
2022-09-29 05:15:54 +00:00
});
2022-09-07 04:52:22 +00:00
Route::group(['prefix' => 'direct'], function () use($middleware) {
Route::get('thread', 'DirectMessageController@thread')->middleware($middleware);
Route::post('thread/send', 'DirectMessageController@create')->middleware($middleware);
Route::delete('thread/message', 'DirectMessageController@delete')->middleware($middleware);
Route::post('thread/mute', 'DirectMessageController@mute')->middleware($middleware);
Route::post('thread/unmute', 'DirectMessageController@unmute')->middleware($middleware);
Route::post('thread/media', 'DirectMessageController@mediaUpload')->middleware($middleware);
Route::post('thread/read', 'DirectMessageController@read')->middleware($middleware);
Route::post('lookup', 'DirectMessageController@composeLookup')->middleware($middleware);
});
2022-08-16 04:54:59 +00:00
2023-01-28 02:29:44 +00:00
Route::group(['prefix' => 'archive'], function () use($middleware) {
Route::post('add/{id}', 'Api\ApiV1Dot1Controller@archive')->middleware($middleware);
Route::post('remove/{id}', 'Api\ApiV1Dot1Controller@unarchive')->middleware($middleware);
Route::get('list', 'Api\ApiV1Dot1Controller@archivedPosts')->middleware($middleware);
});
2023-01-28 03:52:12 +00:00
Route::group(['prefix' => 'places'], function () use($middleware) {
Route::get('posts/{id}/{slug}', 'Api\ApiV1Dot1Controller@placesById')->middleware($middleware);
});
2022-08-16 04:54:59 +00:00
Route::group(['prefix' => 'stories'], function () use($middleware) {
2023-04-02 11:48:25 +00:00
Route::get('carousel', 'Stories\StoryApiV1Controller@carousel')->middleware($middleware);
Route::post('add', 'Stories\StoryApiV1Controller@add')->middleware($middleware);
Route::post('publish', 'Stories\StoryApiV1Controller@publish')->middleware($middleware);
Route::post('seen', 'Stories\StoryApiV1Controller@viewed')->middleware($middleware);
Route::post('self-expire/{id}', 'Stories\StoryApiV1Controller@delete')->middleware($middleware);
Route::post('comment', 'Stories\StoryApiV1Controller@comment')->middleware($middleware);
2022-08-16 04:54:59 +00:00
});
2022-08-18 09:48:40 +00:00
2022-09-19 06:31:28 +00:00
Route::group(['prefix' => 'compose'], function () use($middleware) {
Route::get('search/location', 'ComposeController@searchLocation')->middleware($middleware);
Route::get('settings', 'ComposeController@composeSettings')->middleware($middleware);
2022-08-18 09:48:40 +00:00
});
2022-08-24 03:49:05 +00:00
Route::group(['prefix' => 'discover'], function () use($middleware) {
Route::get('accounts/popular', 'Api\ApiV1Controller@discoverAccountsPopular')->middleware($middleware);
2022-08-24 04:34:22 +00:00
Route::get('posts/trending', 'DiscoverController@trendingApi')->middleware($middleware);
Route::get('posts/hashtags', 'DiscoverController@trendingHashtags')->middleware($middleware);
2022-08-24 03:49:05 +00:00
});
2022-11-14 03:11:07 +00:00
Route::group(['prefix' => 'directory'], function () use($middleware) {
Route::get('listing', 'PixelfedDirectoryController@get');
});
2022-11-26 03:49:06 +00:00
Route::group(['prefix' => 'auth'], function () use($middleware) {
Route::get('iarpfc', 'Api\ApiV1Dot1Controller@inAppRegistrationPreFlightCheck');
Route::post('iar', 'Api\ApiV1Dot1Controller@inAppRegistration');
Route::post('iarc', 'Api\ApiV1Dot1Controller@inAppRegistrationConfirm');
2022-12-02 12:29:26 +00:00
Route::get('iarer', 'Api\ApiV1Dot1Controller@inAppRegistrationEmailRedirect');
2022-12-20 05:30:50 +00:00
Route::post('invite/admin/verify', 'AdminInviteController@apiVerifyCheck')->middleware('throttle:20,120');
Route::post('invite/admin/uc', 'AdminInviteController@apiUsernameCheck')->middleware('throttle:20,120');
Route::post('invite/admin/ec', 'AdminInviteController@apiEmailCheck')->middleware('throttle:10,1440');
2022-11-26 03:49:06 +00:00
});
2022-07-20 02:05:00 +00:00
});
2022-05-26 07:59:54 +00:00
Route::group(['prefix' => 'live'], function() use($middleware) {
Route::post('create_stream', 'LiveStreamController@createStream')->middleware($middleware);
Route::post('stream/edit', 'LiveStreamController@editStream')->middleware($middleware);
Route::get('active/list', 'LiveStreamController@getActiveStreams')->middleware($middleware);
Route::get('accounts/stream', 'LiveStreamController@getUserStream')->middleware($middleware);
2022-06-26 22:06:08 +00:00
Route::get('accounts/stream/guest', 'LiveStreamController@getUserStreamAsGuest');
2022-05-26 07:59:54 +00:00
Route::delete('accounts/stream', 'LiveStreamController@deleteStream')->middleware($middleware);
Route::get('chat/latest', 'LiveStreamController@getLatestChat')->middleware($middleware);
Route::post('chat/message', 'LiveStreamController@addChatComment')->middleware($middleware);
Route::post('chat/delete', 'LiveStreamController@deleteChatComment')->middleware($middleware);
2022-06-26 22:06:08 +00:00
Route::post('chat/ban-user', 'LiveStreamController@banChatUser')->middleware($middleware);
Route::post('chat/pin', 'LiveStreamController@pinChatComment')->middleware($middleware);
Route::post('chat/unpin', 'LiveStreamController@unpinChatComment')->middleware($middleware);
Route::get('config', 'LiveStreamController@getConfig');
2022-06-15 06:46:57 +00:00
Route::post('broadcast/publish', 'LiveStreamController@clientBroadcastPublish');
Route::post('broadcast/finish', 'LiveStreamController@clientBroadcastFinish');
2022-05-26 07:59:54 +00:00
});
2023-01-15 03:33:46 +00:00
Route::group(['prefix' => 'admin'], function() use($middleware) {
Route::post('moderate/post/{id}', 'Api\ApiV1Dot1Controller@moderatePost')->middleware($middleware);
2023-01-15 03:33:46 +00:00
Route::get('supported', 'Api\AdminApiController@supported')->middleware($middleware);
Route::get('stats', 'Api\AdminApiController@getStats')->middleware($middleware);
Route::get('autospam/list', 'Api\AdminApiController@autospam')->middleware($middleware);
Route::post('autospam/handle', 'Api\AdminApiController@autospamHandle')->middleware($middleware);
Route::get('mod-reports/list', 'Api\AdminApiController@modReports')->middleware($middleware);
Route::post('mod-reports/handle', 'Api\AdminApiController@modReportHandle')->middleware($middleware);
Route::get('config', 'Api\AdminApiController@getConfiguration')->middleware($middleware);
Route::post('config/update', 'Api\AdminApiController@updateConfiguration')->middleware($middleware);
Route::get('users/list', 'Api\AdminApiController@getUsers')->middleware($middleware);
Route::get('users/get', 'Api\AdminApiController@getUser')->middleware($middleware);
Route::post('users/action', 'Api\AdminApiController@userAdminAction')->middleware($middleware);
2023-01-15 09:36:55 +00:00
Route::get('instances/list', 'Api\AdminApiController@instances')->middleware($middleware);
Route::get('instances/get', 'Api\AdminApiController@getInstance')->middleware($middleware);
Route::post('instances/moderate', 'Api\AdminApiController@moderateInstance')->middleware($middleware);
Route::post('instances/refresh-stats', 'Api\AdminApiController@refreshInstanceStats')->middleware($middleware);
2023-01-15 03:33:46 +00:00
});
2023-04-08 04:35:51 +00:00
Route::group(['prefix' => 'landing/v1'], function() use($middleware) {
Route::get('directory', 'LandingController@getDirectoryApi');
});
2019-09-21 03:25:02 +00:00
});