Add webfinger and basic feed support.
[akkoma] / lib / pleroma / web / ostatus / feed_representer.ex
1 defmodule Pleroma.Web.OStatus.FeedRepresenter do
2 alias Pleroma.Web.OStatus
3 alias Pleroma.Web.OStatus.UserRepresenter
4
5 def to_simple_form(user, activities, users) do
6 most_recent_update = List.first(activities).updated_at
7 |> NaiveDateTime.to_iso8601
8
9 h = fn(str) -> [to_charlist(str)] end
10
11 entries = []
12 [{
13 :feed, [
14 xmlns: 'http://www.w3.org/2005/Atom',
15 "xmlns:activity": 'http://activitystrea.ms/spec/1.0/'
16 ], [
17 {:id, h.(OStatus.feed_path(user))},
18 {:title, ['#{user.nickname}\'s timeline']},
19 {:updated, h.(most_recent_update)},
20 {:entries, []},
21 {:link, [rel: 'hub', href: h.(OStatus.pubsub_path)], []},
22 {:author, UserRepresenter.to_simple_form(user)}
23 ]
24 }]
25 end
26 end