Add basic config endpoint.
[akkoma] / lib / pleroma / upload.ex
index 43ebe98e3d709288b572ead2b035c404fa262ff4..d22421d37049d8d4892037b83c89b90718a995a5 100644 (file)
@@ -8,7 +8,11 @@ defmodule Pleroma.Upload do
 
     %{
       "type" => "Image",
-      "href" => url_for(Path.join(uuid, file.filename)),
+      "url" => [%{
+        "type" => "Link",
+        "mediaType" => file.content_type,
+        "href" => url_for(Path.join(uuid, file.filename))
+      }],
       "name" => file.filename,
       "uuid" => uuid
     }
@@ -20,11 +24,6 @@ defmodule Pleroma.Upload do
   end
 
   defp url_for(file) do
-    host =
-      Application.get_env(:pleroma, Pleroma.Web.Endpoint)
-      |> Keyword.fetch!(:url)
-      |> Keyword.fetch!(:host)
-
-    "https://#{host}/media/#{file}"
+    "#{Pleroma.Web.base_url()}/media/#{file}"
   end
 end