scope "/api/v1", Pleroma.Web.MastodonAPI do
pipe_through(:authenticated_api)
- patch("/accounts/update_credentials", MastodonAPIController, :update_credentials)
- get("/accounts/verify_credentials", MastodonAPIController, :verify_credentials)
- get("/accounts/relationships", MastodonAPIController, :relationships)
- get("/accounts/search", MastodonAPIController, :account_search)
- post("/accounts/:id/follow", MastodonAPIController, :follow)
- post("/accounts/:id/unfollow", MastodonAPIController, :unfollow)
- post("/accounts/:id/block", MastodonAPIController, :block)
- post("/accounts/:id/unblock", MastodonAPIController, :unblock)
- post("/accounts/:id/mute", MastodonAPIController, :relationship_noop)
- post("/accounts/:id/unmute", MastodonAPIController, :relationship_noop)
- get("/accounts/:id/lists", MastodonAPIController, :account_lists)
+ scope [] do
+ pipe_through(:oauth_read)
+
+ get("/accounts/verify_credentials", MastodonAPIController, :verify_credentials)
+
+ get("/accounts/relationships", MastodonAPIController, :relationships)
+ get("/accounts/search", MastodonAPIController, :account_search)
+
+ get("/accounts/:id/lists", MastodonAPIController, :account_lists)
+
+ get("/follow_requests", MastodonAPIController, :follow_requests)
+ get("/blocks", MastodonAPIController, :blocks)
+ get("/mutes", MastodonAPIController, :empty_array)
+
+ get("/timelines/home", MastodonAPIController, :home_timeline)
+ get("/timelines/direct", MastodonAPIController, :dm_timeline)
+
+ get("/favourites", MastodonAPIController, :favourites)
+ get("/bookmarks", MastodonAPIController, :bookmarks)
- get("/follow_requests", MastodonAPIController, :follow_requests)
- post("/follow_requests/:id/authorize", MastodonAPIController, :authorize_follow_request)
- post("/follow_requests/:id/reject", MastodonAPIController, :reject_follow_request)
+ post("/notifications/clear", MastodonAPIController, :clear_notifications)
+ post("/notifications/dismiss", MastodonAPIController, :dismiss_notification)
+ get("/notifications", MastodonAPIController, :notifications)
+ get("/notifications/:id", MastodonAPIController, :get_notification)
- post("/follows", MastodonAPIController, :follow)
+ get("/lists", MastodonAPIController, :get_lists)
+ get("/lists/:id", MastodonAPIController, :get_list)
+ get("/lists/:id/accounts", MastodonAPIController, :list_accounts)
- get("/blocks", MastodonAPIController, :blocks)
+ get("/domain_blocks", MastodonAPIController, :domain_blocks)
- get("/mutes", MastodonAPIController, :empty_array)
+ get("/filters", MastodonAPIController, :get_filters)
- get("/timelines/home", MastodonAPIController, :home_timeline)
+ get("/suggestions", MastodonAPIController, :suggestions)
- get("/timelines/direct", MastodonAPIController, :dm_timeline)
+ get("/endorsements", MastodonAPIController, :empty_array)
+
- get("/favourites", MastodonAPIController, :favourites)
- get("/bookmarks", MastodonAPIController, :bookmarks)
++ get("/pleroma/flavour", MastodonAPIController, :get_flavour)
+ end
+
+ scope [] do
+ pipe_through(:oauth_write)
+
+ patch("/accounts/update_credentials", MastodonAPIController, :update_credentials)
- post("/statuses", MastodonAPIController, :post_status)
- delete("/statuses/:id", MastodonAPIController, :delete_status)
+ post("/statuses", MastodonAPIController, :post_status)
+ delete("/statuses/:id", MastodonAPIController, :delete_status)
- post("/statuses/:id/reblog", MastodonAPIController, :reblog_status)
- post("/statuses/:id/unreblog", MastodonAPIController, :unreblog_status)
- post("/statuses/:id/favourite", MastodonAPIController, :fav_status)
- post("/statuses/:id/unfavourite", MastodonAPIController, :unfav_status)
- post("/statuses/:id/pin", MastodonAPIController, :pin_status)
- post("/statuses/:id/unpin", MastodonAPIController, :unpin_status)
- post("/statuses/:id/bookmark", MastodonAPIController, :bookmark_status)
- post("/statuses/:id/unbookmark", MastodonAPIController, :unbookmark_status)
- post("/statuses/:id/mute", MastodonAPIController, :mute_conversation)
- post("/statuses/:id/unmute", MastodonAPIController, :unmute_conversation)
+ post("/statuses/:id/reblog", MastodonAPIController, :reblog_status)
+ post("/statuses/:id/unreblog", MastodonAPIController, :unreblog_status)
+ post("/statuses/:id/favourite", MastodonAPIController, :fav_status)
+ post("/statuses/:id/unfavourite", MastodonAPIController, :unfav_status)
+ post("/statuses/:id/pin", MastodonAPIController, :pin_status)
+ post("/statuses/:id/unpin", MastodonAPIController, :unpin_status)
+ post("/statuses/:id/bookmark", MastodonAPIController, :bookmark_status)
+ post("/statuses/:id/unbookmark", MastodonAPIController, :unbookmark_status)
+ post("/statuses/:id/mute", MastodonAPIController, :mute_conversation)
+ post("/statuses/:id/unmute", MastodonAPIController, :unmute_conversation)
- post("/notifications/clear", MastodonAPIController, :clear_notifications)
- post("/notifications/dismiss", MastodonAPIController, :dismiss_notification)
- get("/notifications", MastodonAPIController, :notifications)
- get("/notifications/:id", MastodonAPIController, :get_notification)
+ post("/media", MastodonAPIController, :upload)
+ put("/media/:id", MastodonAPIController, :update_media)
- post("/media", MastodonAPIController, :upload)
- put("/media/:id", MastodonAPIController, :update_media)
+ delete("/lists/:id", MastodonAPIController, :delete_list)
+ post("/lists", MastodonAPIController, :create_list)
+ put("/lists/:id", MastodonAPIController, :rename_list)
- get("/lists", MastodonAPIController, :get_lists)
- get("/lists/:id", MastodonAPIController, :get_list)
- delete("/lists/:id", MastodonAPIController, :delete_list)
- post("/lists", MastodonAPIController, :create_list)
- put("/lists/:id", MastodonAPIController, :rename_list)
- get("/lists/:id/accounts", MastodonAPIController, :list_accounts)
- post("/lists/:id/accounts", MastodonAPIController, :add_to_list)
- delete("/lists/:id/accounts", MastodonAPIController, :remove_from_list)
+ post("/lists/:id/accounts", MastodonAPIController, :add_to_list)
+ delete("/lists/:id/accounts", MastodonAPIController, :remove_from_list)
- get("/domain_blocks", MastodonAPIController, :domain_blocks)
- post("/domain_blocks", MastodonAPIController, :block_domain)
- delete("/domain_blocks", MastodonAPIController, :unblock_domain)
+ post("/filters", MastodonAPIController, :create_filter)
+ get("/filters/:id", MastodonAPIController, :get_filter)
+ put("/filters/:id", MastodonAPIController, :update_filter)
+ delete("/filters/:id", MastodonAPIController, :delete_filter)
++
++ post("/pleroma/flavour/:flavour", MastodonAPIController, :set_flavour)
+ end
- get("/filters", MastodonAPIController, :get_filters)
- post("/filters", MastodonAPIController, :create_filter)
- get("/filters/:id", MastodonAPIController, :get_filter)
- put("/filters/:id", MastodonAPIController, :update_filter)
- delete("/filters/:id", MastodonAPIController, :delete_filter)
+ scope [] do
+ pipe_through(:oauth_follow)
- post("/push/subscription", MastodonAPIController, :create_push_subscription)
- get("/push/subscription", MastodonAPIController, :get_push_subscription)
- put("/push/subscription", MastodonAPIController, :update_push_subscription)
- delete("/push/subscription", MastodonAPIController, :delete_push_subscription)
+ post("/follows", MastodonAPIController, :follow)
+ post("/accounts/:id/follow", MastodonAPIController, :follow)
- get("/suggestions", MastodonAPIController, :suggestions)
+ post("/accounts/:id/unfollow", MastodonAPIController, :unfollow)
+ post("/accounts/:id/block", MastodonAPIController, :block)
+ post("/accounts/:id/unblock", MastodonAPIController, :unblock)
+ post("/accounts/:id/mute", MastodonAPIController, :relationship_noop)
+ post("/accounts/:id/unmute", MastodonAPIController, :relationship_noop)
- get("/endorsements", MastodonAPIController, :empty_array)
+ post("/follow_requests/:id/authorize", MastodonAPIController, :authorize_follow_request)
+ post("/follow_requests/:id/reject", MastodonAPIController, :reject_follow_request)
- post("/pleroma/flavour/:flavour", MastodonAPIController, :set_flavour)
- get("/pleroma/flavour", MastodonAPIController, :get_flavour)
+ post("/domain_blocks", MastodonAPIController, :block_domain)
+ delete("/domain_blocks", MastodonAPIController, :unblock_domain)
+
+ post("/push/subscription", MastodonAPIController, :create_push_subscription)
+ get("/push/subscription", MastodonAPIController, :get_push_subscription)
+ put("/push/subscription", MastodonAPIController, :update_push_subscription)
+ delete("/push/subscription", MastodonAPIController, :delete_push_subscription)
+ end
end
scope "/api/web", Pleroma.Web.MastodonAPI do
scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
pipe_through(:authenticated_api)
- get("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
- post("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
++ get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
++ delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
+
- post("/account/update_profile", TwitterAPI.Controller, :update_profile)
- post("/account/update_profile_banner", TwitterAPI.Controller, :update_banner)
- post("/qvitter/update_background_image", TwitterAPI.Controller, :update_background)
+ scope [] do
+ pipe_through(:oauth_read)
- get("/statuses/home_timeline", TwitterAPI.Controller, :friends_timeline)
- get("/statuses/friends_timeline", TwitterAPI.Controller, :friends_timeline)
- get("/statuses/mentions", TwitterAPI.Controller, :mentions_timeline)
- get("/statuses/mentions_timeline", TwitterAPI.Controller, :mentions_timeline)
- get("/statuses/dm_timeline", TwitterAPI.Controller, :dm_timeline)
- get("/qvitter/statuses/notifications", TwitterAPI.Controller, :notifications)
+ get("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
+ post("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
- # XXX: this is really a pleroma API, but we want to keep the pleroma namespace clean
- # for now.
- post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
+ get("/statuses/home_timeline", TwitterAPI.Controller, :friends_timeline)
+ get("/statuses/friends_timeline", TwitterAPI.Controller, :friends_timeline)
+ get("/statuses/mentions", TwitterAPI.Controller, :mentions_timeline)
+ get("/statuses/mentions_timeline", TwitterAPI.Controller, :mentions_timeline)
+ get("/statuses/dm_timeline", TwitterAPI.Controller, :dm_timeline)
+ get("/qvitter/statuses/notifications", TwitterAPI.Controller, :notifications)
- post("/statuses/update", TwitterAPI.Controller, :status_update)
- post("/statuses/retweet/:id", TwitterAPI.Controller, :retweet)
- post("/statuses/unretweet/:id", TwitterAPI.Controller, :unretweet)
- post("/statuses/destroy/:id", TwitterAPI.Controller, :delete_post)
+ get("/pleroma/friend_requests", TwitterAPI.Controller, :friend_requests)
- post("/statuses/pin/:id", TwitterAPI.Controller, :pin)
- post("/statuses/unpin/:id", TwitterAPI.Controller, :unpin)
+ get("/friends/ids", TwitterAPI.Controller, :friends_ids)
+ get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array)
- get("/pleroma/friend_requests", TwitterAPI.Controller, :friend_requests)
- post("/pleroma/friendships/approve", TwitterAPI.Controller, :approve_friend_request)
- post("/pleroma/friendships/deny", TwitterAPI.Controller, :deny_friend_request)
+ get("/mutes/users/ids", TwitterAPI.Controller, :empty_array)
+ get("/qvitter/mutes", TwitterAPI.Controller, :raw_empty_array)
- post("/friendships/create", TwitterAPI.Controller, :follow)
- post("/friendships/destroy", TwitterAPI.Controller, :unfollow)
- post("/blocks/create", TwitterAPI.Controller, :block)
- post("/blocks/destroy", TwitterAPI.Controller, :unblock)
+ get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
- post("/statusnet/media/upload", TwitterAPI.Controller, :upload)
- post("/media/upload", TwitterAPI.Controller, :upload_json)
- post("/media/metadata/create", TwitterAPI.Controller, :update_media)
+ post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
+ end
- post("/favorites/create/:id", TwitterAPI.Controller, :favorite)
- post("/favorites/create", TwitterAPI.Controller, :favorite)
- post("/favorites/destroy/:id", TwitterAPI.Controller, :unfavorite)
+ scope [] do
+ pipe_through(:oauth_write)
- post("/qvitter/update_avatar", TwitterAPI.Controller, :update_avatar)
+ post("/account/update_profile", TwitterAPI.Controller, :update_profile)
+ post("/account/update_profile_banner", TwitterAPI.Controller, :update_banner)
+ post("/qvitter/update_background_image", TwitterAPI.Controller, :update_background)
- get("/friends/ids", TwitterAPI.Controller, :friends_ids)
- get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array)
+ post("/statuses/update", TwitterAPI.Controller, :status_update)
+ post("/statuses/retweet/:id", TwitterAPI.Controller, :retweet)
+ post("/statuses/unretweet/:id", TwitterAPI.Controller, :unretweet)
+ post("/statuses/destroy/:id", TwitterAPI.Controller, :delete_post)
- get("/mutes/users/ids", TwitterAPI.Controller, :empty_array)
- get("/qvitter/mutes", TwitterAPI.Controller, :raw_empty_array)
+ post("/statuses/pin/:id", TwitterAPI.Controller, :pin)
+ post("/statuses/unpin/:id", TwitterAPI.Controller, :unpin)
- get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
+ post("/statusnet/media/upload", TwitterAPI.Controller, :upload)
+ post("/media/upload", TwitterAPI.Controller, :upload_json)
+ post("/media/metadata/create", TwitterAPI.Controller, :update_media)
- get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
- delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
+ post("/favorites/create/:id", TwitterAPI.Controller, :favorite)
+ post("/favorites/create", TwitterAPI.Controller, :favorite)
+ post("/favorites/destroy/:id", TwitterAPI.Controller, :unfavorite)
+
+ post("/qvitter/update_avatar", TwitterAPI.Controller, :update_avatar)
+ end
+
+ scope [] do
+ pipe_through(:oauth_follow)
+
+ post("/pleroma/friendships/approve", TwitterAPI.Controller, :approve_friend_request)
+ post("/pleroma/friendships/deny", TwitterAPI.Controller, :deny_friend_request)
+
+ post("/friendships/create", TwitterAPI.Controller, :follow)
+ post("/friendships/destroy", TwitterAPI.Controller, :unfollow)
+
+ post("/blocks/create", TwitterAPI.Controller, :block)
+ post("/blocks/destroy", TwitterAPI.Controller, :unblock)
+ end
end
pipeline :ap_relay do