Merge pull request 'RFC: handling of third-party frontends in default available FE list' (#945) from Oneric/akkoma:third-party-frontends into develop
All checks were successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/publish/4 Pipeline was successful
ci/woodpecker/push/publish/1 Pipeline was successful
ci/woodpecker/push/publish/2 Pipeline was successful

Reviewed-on: #945
This commit is contained in:
Oneric 2025-11-27 21:32:02 +00:00
commit 70877306af
7 changed files with 65 additions and 2 deletions

View file

@ -781,7 +781,9 @@ config :pleroma, :frontends,
available: %{
"pleroma-fe" => %{
"name" => "pleroma-fe",
"git" => "https://akkoma.dev/AkkomaGang/pleroma-fe",
"blind_trust" => true,
"git" => "https://akkoma.dev/AkkomaGang/akkoma-fe",
"bugtracker" => "https://akkoma.dev/AkkomaGang/akkoma-fe/issues",
"build_url" =>
"https://akkoma-updates.s3-website.fr-par.scw.cloud/frontend/${ref}/akkoma-fe.zip",
"ref" => "stable",
@ -790,7 +792,9 @@ config :pleroma, :frontends,
# Mastodon-Fe cannot be set as a primary - this is only here so we can update this seperately
"mastodon-fe" => %{
"name" => "mastodon-fe",
"blind_trust" => true,
"git" => "https://akkoma.dev/AkkomaGang/masto-fe",
"bugtracker" => "https://akkoma.dev/AkkomaGang/masto-fe/issues",
"build_url" =>
"https://akkoma-updates.s3-website.fr-par.scw.cloud/frontend/${ref}/masto-fe.zip",
"build_dir" => "distribution",
@ -798,7 +802,9 @@ config :pleroma, :frontends,
},
"fedibird-fe" => %{
"name" => "fedibird-fe",
"blind_trust" => true,
"git" => "https://akkoma.dev/AkkomaGang/fedibird-fe",
"bugtracker" => "https://akkoma.dev/AkkomaGang/fedibird-fe/issues",
"build_url" =>
"https://akkoma-updates.s3-website.fr-par.scw.cloud/frontend/${ref}/fedibird-fe.zip",
"build_dir" => "distribution",
@ -806,7 +812,9 @@ config :pleroma, :frontends,
},
"admin-fe" => %{
"name" => "admin-fe",
"blind_trust" => true,
"git" => "https://akkoma.dev/AkkomaGang/admin-fe",
"bugtracker" => "https://akkoma.dev/AkkomaGang/admin-fe/issues",
"build_url" =>
"https://akkoma-updates.s3-website.fr-par.scw.cloud/frontend/${ref}/admin-fe.zip",
"ref" => "stable"
@ -814,10 +822,23 @@ config :pleroma, :frontends,
# For developers - enables a swagger frontend to view the openapi spec
"swagger-ui" => %{
"name" => "swagger-ui",
"blind_trust" => true,
"git" => "https://github.com/swagger-api/swagger-ui",
# API spec definitions are part of the backend (and the swagger-ui build outdated)
"bugtracker" => "https://akkoma.dev/AkkomaGang/akkoma/issues",
"build_url" => "https://akkoma-updates.s3-website.fr-par.scw.cloud/frontend/swagger-ui.zip",
"build_dir" => "dist",
"ref" => "stable"
},
# Third-party frontends
"pleroma-fe-vanilla" => %{
"name" => "pleroma-fe-vanilla",
"git" => "https://git.pleroma.social/pleroma/pleroma-fe/",
"build_url" =>
"https://git.pleroma.social/pleroma/pleroma-fe/-/jobs/artifacts/${ref}/download?job=build",
"ref" => "develop",
"build_dir" => "dist",
"bugtracker" => "https://git.pleroma.social/pleroma/pleroma-fe/-/issues"
}
}

View file

@ -61,6 +61,18 @@ frontend_options = [
type: :string,
description: "The directory inside the zip file "
},
%{
key: "blind_trust",
label: "Blindly trust frontend devs?",
type: :boolean,
description: "Do NOT change this unless youre really sure"
},
%{
key: "bugtracker",
label: "Bug tracker",
type: :string,
description: "Where to report bugs (for third-party FEs)"
},
%{
key: "custom-http-headers",
label: "Custom HTTP headers",

View file

@ -14,6 +14,8 @@ defmodule Pleroma.Frontend do
"build_dir" => opts[:build_dir]
}
explicit_source = !!(opts[:file] || opts[:build_dir] || opts[:build_url])
frontend_info =
[:frontends, :available, name]
|> Config.get(%{})
@ -28,6 +30,25 @@ defmodule Pleroma.Frontend do
raise "No ref given or configured"
end
if Map.get(frontend_info, "blind_trust", false) !== true do
bugtracker = frontend_info["bugtracker"]
unless bugtracker || explicit_source do
raise "Configured third-party frontend without a bugtracker; refusing install."
end
bugtracker = bugtracker || "the external frontend developers"
Logger.warning("""
!!!!!!!!
You are installing a third-party frontend not vetted by the Akkoma team.
THERE ARE NO GUARANTTES ABOUT SAFETY AND FUNCTIONALITY!
Do NOT report problems to Akkoma, instead
all bugs must be reported to #{bugtracker}
!!!!!!!!
""")
end
dest = Path.join([dir(), name, ref])
label = "#{name} (#{ref})"
@ -69,7 +90,7 @@ defmodule Pleroma.Frontend do
end
end
def unzip(zip, dest) do
defp unzip(zip, dest) do
File.rm_rf!(dest)
File.mkdir_p!(dest)

View file

@ -12,7 +12,9 @@ defmodule Pleroma.Web.AdminAPI.FrontendView do
def render("show.json", %{frontend: frontend}) do
%{
name: frontend["name"],
blind_trust: frontend["blind_trust"],
git: frontend["git"],
bugtracker: frontend["bugtracker"],
build_url: frontend["build_url"],
ref: frontend["ref"],
installed: frontend["installed"]

View file

@ -24,6 +24,7 @@ defmodule Mix.Tasks.Pleroma.FrontendTest do
"pleroma" => %{
"ref" => "fantasy",
"name" => "pleroma",
"blind_trust" => true,
"build_url" => "http://gensokyo.2hu/builds/${ref}"
}
})

View file

@ -22,6 +22,7 @@ defmodule Pleroma.FrontendTest do
"pleroma" => %{
"ref" => "fantasy",
"name" => "pleroma",
"blind_trust" => true,
"build_url" => "http://gensokyo.2hu/builds/${ref}"
}
})
@ -40,6 +41,7 @@ defmodule Pleroma.FrontendTest do
"pleroma" => %{
"ref" => "fantasy",
"name" => "pleroma",
"blind_trust" => true,
"build_dir" => ""
}
})

View file

@ -64,6 +64,7 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
"pleroma" => %{
"ref" => "fantasy",
"name" => "pleroma",
"blind_trust" => true,
"build_url" => "http://gensokyo.2hu/builds/${ref}"
}
})
@ -86,7 +87,9 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
assert response == [
%{
"blind_trust" => true,
"build_url" => "http://gensokyo.2hu/builds/${ref}",
"bugtracker" => nil,
"git" => nil,
"installed" => true,
"name" => "pleroma",
@ -100,6 +103,7 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
"pleroma" => %{
"ref" => "fantasy",
"name" => "pleroma",
"blind_trust" => true,
"build_dir" => ""
}
})