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-02-12 10:04:01 -08:00
|
|
|
],
|
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,
|
2023-02-12 10:04:01 -08:00
|
|
|
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,
|
2023-02-12 10:04:01 -08:00
|
|
|
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: {
|
2023-02-12 10:04:01 -08:00
|
|
|
total: User.count,
|
|
|
|
},
|
2023-01-04 08:08:05 -08:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def inbound_services = []
|
|
|
|
|
2023-02-12 10:04:01 -08:00
|
|
|
def outbound_services = []
|
2023-01-04 08:08:05 -08:00
|
|
|
end
|