Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85650311
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/web/metadata/instance.ex b/lib/pleroma/web/metadata/instance.ex
index 78e166b74..5b75c3cbd 100644
--- a/lib/pleroma/web/metadata/instance.ex
+++ b/lib/pleroma/web/metadata/instance.ex
@@ -1,75 +1,73 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.Instance do
alias Pleroma.Web.Metadata.Providers.Provider
alias Pleroma.Web.MastodonAPI.InstanceView
alias Pleroma.Web.Nodeinfo.Nodeinfo
@behaviour Provider
@impl Provider
def build_tags(_params) do
[]
|> build_info_tag()
|> build_panel_tag()
|> build_nodeinfo_tag()
end
+ def build_info_tag(acc \\ []) do
+ "show.json"
+ |> InstanceView.render(%{})
+ |> Jason.encode!()
+ |> check_for_empty()
+ |> case do
+ "" ->
+ acc
+
+ safe_data ->
+ [make_tag("instance:info", safe_data) | acc]
+ end
+ end
+
def build_panel_tag(acc \\ []) do
- instance_path =
- Path.join(:code.priv_dir(:pleroma), "static/instance/panel.html")
- |> IO.inspect()
+ instance_path = Path.join(:code.priv_dir(:pleroma), "static/instance/panel.html")
if File.exists?(instance_path) do
instance_path
|> File.read!()
|> case do
"" ->
acc
safe_data ->
[make_tag("instance:panel", safe_data) | acc]
end
else
acc
end
end
- def build_info_tag(acc \\ []) do
- "show.json"
- |> InstanceView.render(%{})
- |> Jason.encode!()
- |> check_for_empty()
- |> case do
- "" ->
- acc
-
- safe_data ->
- [make_tag("instance:info", safe_data) | acc]
- end
- end
-
def build_nodeinfo_tag(acc \\ []) do
case Nodeinfo.get_nodeinfo("2.0") do
{:error, _} ->
acc
nodeinfo_data ->
[make_tag("instance:nodeinfo", Jason.encode!(nodeinfo_data)) | acc]
end
end
defp check_for_empty(data) do
if data != "" and data != "\u200B" do
data
else
""
end
end
defp make_tag(key, data) do
{:meta, [property: key, content: data], []}
end
end
diff --git a/lib/pleroma/web/metadata/user.ex b/lib/pleroma/web/metadata/user.ex
index 1c1398f33..0bfc405dc 100644
--- a/lib/pleroma/web/metadata/user.ex
+++ b/lib/pleroma/web/metadata/user.ex
@@ -1,64 +1,60 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.User do
alias Pleroma.User
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.Metadata.Providers.Provider
@behaviour Provider
@impl Provider
def build_tags(params) do
- IO.inspect(params, label: "the build tag _params")
-
[]
|> build_accounts_tag(params)
|> build_relationships_tag(params)
end
def build_accounts_tag(acc \\ [], %{user: user}) do
- IO.inspect(user.id, label: "the user id")
-
"show.json"
|> AccountView.render(%{user: user, for: user})
|> Jason.encode!()
|> check_for_empty()
|> case do
"" ->
acc
safe_data ->
[make_tag("user:account", safe_data) | acc]
end
end
def build_relationships_tag(acc \\ [], %{user: %{id: user_id} = user}) do
targets = User.get_all_by_ids(List.wrap(user_id))
"relationships.json"
|> AccountView.render(%{user: user, targets: targets})
|> Jason.encode!()
|> check_for_empty()
|> case do
"" ->
acc
safe_data ->
[make_tag("user:relationships", safe_data) | acc]
end
end
defp check_for_empty(data) do
if data != "" and data != "\u200B" do
data
else
""
end
end
defp make_tag(key, data) do
{:meta, [property: key, content: data], []}
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Aug 30, 12:11 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1737633
Default Alt Text
(3 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment