Add outbox
This commit is contained in:
parent
b582c93bb1
commit
f05741edb5
4 changed files with 36 additions and 0 deletions
18
lib/nulla_web/controllers/outbox_controller.ex
Normal file
18
lib/nulla_web/controllers/outbox_controller.ex
Normal file
|
@ -0,0 +1,18 @@
|
|||
defmodule NullaWeb.OutboxController do
|
||||
use NullaWeb, :controller
|
||||
alias Nulla.ActivityPub
|
||||
alias Nulla.Models.User
|
||||
alias Nulla.Models.Note
|
||||
alias Nulla.Models.InstanceSettings
|
||||
|
||||
def show(conn, %{"username" => username}) do
|
||||
instance_settings = InstanceSettings.get_instance_settings!()
|
||||
domain = instance_settings.domain
|
||||
user = User.get_user_by_username!(username)
|
||||
total = Note.get_total_notes_count(user.id)
|
||||
|
||||
conn
|
||||
|> put_resp_content_type("application/activity+json")
|
||||
|> send_resp(200, Jason.encode!(ActivityPub.outbox(domain, username, total)))
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue