Retrospring/app/controllers/well_known/node_info_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.1 KiB
Ruby
Raw Normal View History

2023-01-04 08:08:05 -08:00
# frozen_string_literal: true
class WellKnown::NodeInfoController < ApplicationController
def discovery
expires_in 3.days, public: true
render json: {
links: [
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
href: node_info_url
],
2023-01-04 08:08:05 -08:00
}
end
def nodeinfo
expires_in 30.minutes, public: true
render json: {
version: "2.1",
software: software_info,
protocols: %i[],
services: {
inbound: inbound_services,
outbound: outbound_services,
2023-01-04 08:08:05 -08:00
},
usage: usage_stats,
# We don't implement this so we can always return true for now
openRegistrations: true,
metadata: {},
2023-01-04 08:08:05 -08:00
}
end
private
def software_info
{
name: "Retrospring",
version: Retrospring::Version.to_s,
2023-02-03 02:47:00 -08:00
repository: "https://lab.freak.university/FreakU/retrospring"
2023-01-04 08:08:05 -08:00
}
end
def usage_stats
{
users: {
total: User.count,
},
2023-01-04 08:08:05 -08:00
}
end
def inbound_services = []
def outbound_services = []
2023-01-04 08:08:05 -08:00
end