Merge branch 'activity-pub-metadata' into 'develop'
Add metadata provider for ActivityPub alternate links See merge request pleroma/pleroma!4286
This commit is contained in:
commit
4626a9280a
4 changed files with 64 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ defmodule Pleroma.Web.Metadata do
|
|||
|
||||
def build_tags(params) do
|
||||
providers = [
|
||||
Pleroma.Web.Metadata.Providers.ActivityPub,
|
||||
Pleroma.Web.Metadata.Providers.RelMe,
|
||||
Pleroma.Web.Metadata.Providers.RestrictIndexing
|
||||
| activated_providers()
|
||||
|
|
|
|||
22
lib/pleroma/web/metadata/providers/activity_pub.ex
Normal file
22
lib/pleroma/web/metadata/providers/activity_pub.ex
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.Metadata.Providers.ActivityPub do
|
||||
alias Pleroma.Web.Metadata.Providers.Provider
|
||||
|
||||
@behaviour Provider
|
||||
|
||||
@impl Provider
|
||||
def build_tags(%{object: %{data: %{"id" => object_id}}}) do
|
||||
[{:link, [rel: "alternate", type: "application/activity+json", href: object_id], []}]
|
||||
end
|
||||
|
||||
@impl Provider
|
||||
def build_tags(%{user: user}) do
|
||||
[{:link, [rel: "alternate", type: "application/activity+json", href: user.ap_id], []}]
|
||||
end
|
||||
|
||||
@impl Provider
|
||||
def build_tags(_), do: []
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue