defmodule Pleroma.Web.Router do
use Pleroma.Web, :router
- alias Pleroma.{Repo, User, Web.Router}
-
pipeline :api do
plug(:accepts, ["json"])
plug(:fetch_session)
plug(:accepts, ["html", "json"])
end
+ pipeline :mailbox_preview do
+ plug(:accepts, ["html"])
+
+ plug(:put_secure_browser_headers, %{
+ "content-security-policy" =>
+ "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'"
+ })
+ end
+
scope "/api/pleroma", Pleroma.Web.TwitterAPI do
pipe_through(:pleroma_api)
get("/password_reset/:token", UtilController, :show_password_reset)
put("/filters/:id", MastodonAPIController, :update_filter)
delete("/filters/:id", MastodonAPIController, :delete_filter)
+ 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)
+
get("/suggestions", MastodonAPIController, :suggestions)
get("/endorsements", MastodonAPIController, :empty_array)
get("/statusnet/conversation/:id", TwitterAPI.Controller, :fetch_conversation)
post("/account/register", TwitterAPI.Controller, :register)
+ post("/account/password_reset", TwitterAPI.Controller, :password_reset)
get("/search", TwitterAPI.Controller, :search)
get("/statusnet/tags/timeline/:tag", TwitterAPI.Controller, :public_and_external_timeline)
get("/:sig/:url/:filename", MediaProxyController, :remote)
end
+ if Mix.env() == :dev do
+ scope "/dev" do
+ pipe_through([:mailbox_preview])
+
+ forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
+ end
+ end
+
scope "/", Fallback do
get("/registration/:token", RedirectController, :registration_page)
get("/*path", RedirectController, :redirector)