frenzy/lib/frenzy_web/router.ex

123 lines
3.9 KiB
Elixir

defmodule FrenzyWeb.Router do
use FrenzyWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :put_root_layout, {FrenzyWeb.LayoutView, :root}
end
pipeline :browser_authenticate do
plug FrenzyWeb.Plug.Authenticate
end
pipeline :api do
plug :accepts, ["json"]
end
pipeline :fervor_authenticate do
plug FrenzyWeb.Plug.FervorAuthenticate
end
scope "/", FrenzyWeb do
pipe_through :browser
get "/login", LoginController, :login
post "/login", LoginController, :login_post
get "/logout", LoginController, :logout
get "/oauth/authorize", Fervor.OauthController, :authorize_get
post "/oauth/authorize", Fervor.OauthController, :authorize_post
end
scope "/auth", FrenzyWeb do
pipe_through :browser
if Frenzy.oidc_enabled?() do
get "/:unused", LoginController, :ueberauth_request
get "/:unused/callback", LoginController, :ueberauth_callback
end
end
scope "/", FrenzyWeb do
pipe_through :browser
pipe_through :browser_authenticate
get "/account", AccountController, :show
get "/account/change_password", AccountController, :change_password
post "/account/change_password", AccountController, :do_change_password
get "/account/change_fever_password", AccountController, :change_fever_password
post "/account/change_fever_password", AccountController, :do_change_fever_password
post "/account/remove_client", AccountController, :remove_client
post "/account/import", AccountController, :import
post "/account/export", AccountController, :export
if Frenzy.oidc_enabled?() do
get "/account/link_oidc", AccountController, :link_oidc
end
get "/", GroupController, :index
resources "/groups", GroupController
get "/groups/:id/read", GroupController, :read
resources "/feeds", FeedController, except: [:index, :new]
post "/feeds/:id/refresh", FeedController, :refresh
resources "/pipelines", PipelineController
resources "/items", ItemController, only: [:show]
post "/items/:id/read", ItemController, :read
post "/items/:id/unread", ItemController, :unread
end
scope "/", FrenzyWeb do
pipe_through :api
post "/", FeverController, :post
get "/fever", FeverController, :get
get "/api/fever.php", FeverController, :get
post "/fever", FeverController, :post
post "/api/fever.php", FeverController, :post
end
scope "/", FrenzyWeb.Fervor do
pipe_through :api
post "/api/v1/register", MiscController, :register
post "/oauth/token", OauthController, :token
get "/api/v1/instance", MiscController, :instance
end
scope "/", FrenzyWeb.Fervor do
pipe_through :api
pipe_through :fervor_authenticate
get "/api/v1/groups", GroupsController, :groups_list
get "/api/v1/groups/:id", GroupsController, :specific_group
get "/api/v1/groups/:id/feeds", GroupsController, :specific_group_feeds
get "/api/v1/groups/:id/items", GroupsController, :specific_group_items
post "/api/v1/groups/create", GroupsController, :create
post "/api/v1/groups/:id/delete", GroupsController, :delete
get "/api/v1/feeds", FeedsController, :feeds_list
get "/api/v1/feeds/:id", FeedsController, :specific_feed
get "/api/v1/feeds/:id/items", FeedsController, :specific_feed_items
post "/api/v1/feeds/create", FeedsController, :create
post "/api/v1/feeds/:id/delete", FeedsController, :delete
get "/api/v1/items", ItemsController, :items_list
get "/api/v1/items/sync", ItemsController, :sync
get "/api/v1/items/:id", ItemsController, :specific_item
post "/api/v1/items/:id/read", ItemsController, :read_specific_item
post "/api/v1/items/:id/unread", ItemsController, :unread_specific_item
post "/api/v1/items/read", ItemsController, :read_multiple
post "/api/v1/items/unread", ItemsController, :unread_multiple
end
end