Merge branch 'fix/no-version-api-pleroma-social' into 'develop'

Fix no version number on api.pleroma.social

See merge request pleroma/pleroma!3310
This commit is contained in:
Haelwenn 2021-02-10 00:52:59 +00:00
commit 2cf753c502
2 changed files with 4 additions and 1 deletions

View file

@ -1,5 +1,7 @@
defmodule Mix.Tasks.Pleroma.OpenapiSpec do defmodule Mix.Tasks.Pleroma.OpenapiSpec do
def run([path]) do def run([path]) do
# Load Pleroma application to get version info
Application.load(:pleroma)
spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!() spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!()
File.write(path, spec) File.write(path, spec)
end end

View file

@ -37,7 +37,8 @@ def spec(opts \\ []) do
Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too! Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too!
""", """,
version: Application.spec(:pleroma, :vsn) |> to_string(), # Strip environment from the version
version: Application.spec(:pleroma, :vsn) |> to_string() |> String.replace(~r/\+.*$/, ""),
extensions: %{ extensions: %{
# Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social # Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social
"x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"} "x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"}