Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pleroma pleroma
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 647
    • Issues 647
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 90
    • Merge requests 90
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PleromaPleroma
  • pleromapleroma
  • Issues
  • #764
Closed
Open
Issue created Mar 27, 2019 by dashie@dashieContributor

Audio object support

I have a software who will federate Audio Objects and I would like Pleroma to support them.

As seen with @lanodan I have made this quick and dirty hack just to validate federation.

Currently pleroma-fe shows only a link to the mp3/url, mastofe shows a link to the activity url, I haven't investigated further.

I will create respective issue for pleroma-fe to add an audio player if wanted.

diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index f733ae7e..d8296f7b 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -432,7 +432,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   # - tags
   # - emoji
   def handle_incoming(%{"type" => "Create", "object" => %{"type" => objtype} = object} = data)
-      when objtype in ["Article", "Note", "Video", "Page"] do
+      when objtype in ["Article", "Note", "Video", "Page", "Audio"] do
     actor = get_actor(data)
 
     data =
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 1ca8338c..8c64832f 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -316,6 +316,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     end
   end
 
+  def render_content(%{"type" => "Audio"} = object) do
+    with name when not is_nil(name) and name != "" <- object["name"] do
+      "<p><a href=\"#{object["id"]}\">#{name}</a></p>#{object["content"]}"
+    else
+      _ -> object["content"] || ""
+    end
+  end
+
   def render_content(%{"type" => object_type} = object)
       when object_type in ["Article", "Page"] do
     with summary when not is_nil(summary) and summary != "" <- object["name"],
diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex
index aa1d41fa..09f35212 100644
--- a/lib/pleroma/web/twitter_api/views/activity_view.ex
+++ b/lib/pleroma/web/twitter_api/views/activity_view.ex
@@ -335,7 +335,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
   end
 
   def render_content(%{"type" => object_type} = object)
-      when object_type in ["Article", "Page", "Video"] do
+      when object_type in ["Article", "Page", "Video", "Audio"] do
     summary = object["name"] || object["summary"]
 
     content =
Assignee
Assign to
Time tracking