forked from AkkomaGang/akkoma
No need to filter out Mix.env() from the API routes.
This commit is contained in:
parent
1552179792
commit
2da71a526f
2 changed files with 2 additions and 7 deletions
|
@ -28,8 +28,6 @@ defmodule Pleroma.Web do
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
alias Pleroma.Web.Plugs.PlugHelper
|
alias Pleroma.Web.Plugs.PlugHelper
|
||||||
|
|
||||||
@mix_env Mix.env()
|
|
||||||
|
|
||||||
def controller do
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Controller, namespace: Pleroma.Web
|
use Phoenix.Controller, namespace: Pleroma.Web
|
||||||
|
@ -238,11 +236,7 @@ def base_url do
|
||||||
|
|
||||||
def get_api_routes do
|
def get_api_routes do
|
||||||
Pleroma.Web.Router.__routes__()
|
Pleroma.Web.Router.__routes__()
|
||||||
|> Enum.reject(fn
|
|> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end)
|
||||||
r ->
|
|
||||||
r.plug == Pleroma.Web.Fallback.RedirectController or
|
|
||||||
String.starts_with?(r.path, "/#{@mix_env}")
|
|
||||||
end)
|
|
||||||
|> Enum.map(fn r ->
|
|> Enum.map(fn r ->
|
||||||
r.path
|
r.path
|
||||||
|> String.split("/", trim: true)
|
|> String.split("/", trim: true)
|
||||||
|
|
|
@ -96,6 +96,7 @@ test "api routes are detected correctly" do
|
||||||
"auth",
|
"auth",
|
||||||
"embed",
|
"embed",
|
||||||
"proxy",
|
"proxy",
|
||||||
|
"test",
|
||||||
"user_exists",
|
"user_exists",
|
||||||
"check_password"
|
"check_password"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue