]> cat aescling's git repositories - mastodon.git/blob - app/serializers/nodeinfo/serializer.rb
1a7d7a911397a09af6de4c65b2b4522835acd92f
[mastodon.git] / app / serializers / nodeinfo / serializer.rb
1 # frozen_string_literal: true
2
3 class NodeInfo::Serializer < ActiveModel::Serializer
4 include RoutingHelper
5
6 attributes :version, :software, :protocols, :usage
7
8 def version
9 '2.0'
10 end
11
12 def software
13 { name: 'mastodon', version: Mastodon::Version.to_s }
14 end
15
16 def services
17 { outbound: [], inbound: [] }
18 end
19
20 def protocols
21 %w(activitypub)
22 end
23
24 def usage
25 {
26 users: {
27 total: instance_presenter.user_count,
28 active_month: instance_presenter.active_user_count(4),
29 active_halfyear: instance_presenter.active_user_count(24),
30 },
31
32 local_posts: instance_presenter.status_count,
33 }
34 end
35
36 private
37
38 def instance_presenter
39 @instance_presenter ||= InstancePresenter.new
40 end
41 end
This page took 0.093927 seconds and 4 git commands to generate.