Merge branch 'stable' into develop
This commit is contained in:
commit
89a3ea6d20
4 changed files with 79 additions and 39 deletions
|
|
@ -18,7 +18,7 @@ class NodeInfoPresenter
|
||||||
|
|
||||||
def add_configuration(doc)
|
def add_configuration(doc)
|
||||||
doc.software.version = version
|
doc.software.version = version
|
||||||
doc.services = available_services
|
doc.services.outbound = available_services
|
||||||
doc.open_registrations = open_registrations?
|
doc.open_registrations = open_registrations?
|
||||||
doc.metadata["nodeName"] = name
|
doc.metadata["nodeName"] = name
|
||||||
doc.metadata["xmppChat"] = chat_enabled?
|
doc.metadata["xmppChat"] = chat_enabled?
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,19 @@ module NodeInfo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Services = Struct.new(:inbound, :outbound) do
|
||||||
|
def initialize(inbound=[], outbound=[])
|
||||||
|
super(inbound, outbound)
|
||||||
|
end
|
||||||
|
|
||||||
|
def version_10_hash
|
||||||
|
{
|
||||||
|
"inbound" => inbound,
|
||||||
|
"outbound" => outbound
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Usage = Struct.new(:users, :local_posts, :local_comments) do
|
Usage = Struct.new(:users, :local_posts, :local_comments) do
|
||||||
Users = Struct.new(:total, :active_halfyear, :active_month) do
|
Users = Struct.new(:total, :active_halfyear, :active_month) do
|
||||||
def initialize(total=nil, active_halfyear=nil, active_month=nil)
|
def initialize(total=nil, active_halfyear=nil, active_month=nil)
|
||||||
|
|
@ -68,8 +81,8 @@ module NodeInfo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(version=nil, services=[], open_registrations=nil, metadata={})
|
def initialize(version=nil, open_registrations=nil, metadata={})
|
||||||
super(version, Software.new, Protocols.new, services, open_registrations, Usage.new, metadata)
|
super(version, Software.new, Protocols.new, Services.new, open_registrations, Usage.new, metadata)
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(_options={})
|
def as_json(_options={})
|
||||||
|
|
@ -103,7 +116,7 @@ module NodeInfo
|
||||||
"version" => "1.0",
|
"version" => "1.0",
|
||||||
"software" => software.version_10_hash,
|
"software" => software.version_10_hash,
|
||||||
"protocols" => protocols.version_10_hash,
|
"protocols" => protocols.version_10_hash,
|
||||||
"services" => services.empty? ? nil : services,
|
"services" => services.version_10_hash,
|
||||||
"openRegistrations" => open_registrations,
|
"openRegistrations" => open_registrations,
|
||||||
"usage" => usage.version_10_hash,
|
"usage" => usage.version_10_hash,
|
||||||
"metadata" => metadata
|
"metadata" => metadata
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,10 @@ describe NodeInfoPresenter do
|
||||||
"inbound" => ["diaspora"],
|
"inbound" => ["diaspora"],
|
||||||
"outbound" => ["diaspora"]
|
"outbound" => ["diaspora"]
|
||||||
},
|
},
|
||||||
"services" => ["facebook"],
|
"services" => {
|
||||||
|
"inbound" => [],
|
||||||
|
"outbound" => ["facebook"]
|
||||||
|
},
|
||||||
"openRegistrations" => AppConfig.settings.enable_registrations?,
|
"openRegistrations" => AppConfig.settings.enable_registrations?,
|
||||||
"usage" => {
|
"usage" => {
|
||||||
"users" => {}
|
"users" => {}
|
||||||
|
|
@ -58,7 +61,7 @@ describe NodeInfoPresenter do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "provides services" do
|
it "provides services" do
|
||||||
expect(hash).to include "services" => %w(twitter facebook)
|
expect(hash).to include "services" => include("outbound" => %w(twitter facebook))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -82,7 +85,7 @@ describe NodeInfoPresenter do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "it doesn't list those" do
|
it "it doesn't list those" do
|
||||||
expect(hash).to include "services" => ["twitter"]
|
expect(hash).to include "services" => include("outbound" => ["twitter"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
88
vendor/nodeinfo/schemas/1.0.json
vendored
88
vendor/nodeinfo/schemas/1.0.json
vendored
|
|
@ -8,6 +8,7 @@
|
||||||
"version",
|
"version",
|
||||||
"software",
|
"software",
|
||||||
"protocols",
|
"protocols",
|
||||||
|
"services",
|
||||||
"openRegistrations",
|
"openRegistrations",
|
||||||
"usage",
|
"usage",
|
||||||
"metadata"
|
"metadata"
|
||||||
|
|
@ -92,38 +93,61 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"description": "The third party sites this servers allows to publish messages to.",
|
"description": "The third party sites this server can connect to via their application API.",
|
||||||
"type": "array",
|
"type": "object",
|
||||||
"minItems": 0,
|
"additionalProperties": false,
|
||||||
"items": {
|
"required": [
|
||||||
"enum": [
|
"inbound",
|
||||||
"appnet",
|
"outbound"
|
||||||
"blogger",
|
],
|
||||||
"buddycloud",
|
"properties": {
|
||||||
"diaspora",
|
"inbound": {
|
||||||
"dreamwidth",
|
"description": "The third party sites this server can retrieve messages from for combined display with regular traffic.",
|
||||||
"drupal",
|
"type": "array",
|
||||||
"facebook",
|
"minItems": 0,
|
||||||
"friendica",
|
"items": {
|
||||||
"gnusocial",
|
"enum": [
|
||||||
"google",
|
"appnet",
|
||||||
"insanejournal",
|
"gnusocial",
|
||||||
"libertree",
|
"pumpio"
|
||||||
"linkedin",
|
]
|
||||||
"livejournal",
|
}
|
||||||
"mediagoblin",
|
},
|
||||||
"myspace",
|
"outbound": {
|
||||||
"pinterest",
|
"description": "The third party sites this server can publish messages to on the behalf of a user.",
|
||||||
"posterous",
|
"type": "array",
|
||||||
"pumpio",
|
"minItems": 0,
|
||||||
"redmatrix",
|
"items": {
|
||||||
"smtp",
|
"enum": [
|
||||||
"tent",
|
"appnet",
|
||||||
"tumblr",
|
"blogger",
|
||||||
"twitter",
|
"buddycloud",
|
||||||
"wordpress",
|
"diaspora",
|
||||||
"xmpp"
|
"dreamwidth",
|
||||||
]
|
"drupal",
|
||||||
|
"facebook",
|
||||||
|
"friendica",
|
||||||
|
"gnusocial",
|
||||||
|
"google",
|
||||||
|
"insanejournal",
|
||||||
|
"libertree",
|
||||||
|
"linkedin",
|
||||||
|
"livejournal",
|
||||||
|
"mediagoblin",
|
||||||
|
"myspace",
|
||||||
|
"pinterest",
|
||||||
|
"posterous",
|
||||||
|
"pumpio",
|
||||||
|
"redmatrix",
|
||||||
|
"smtp",
|
||||||
|
"tent",
|
||||||
|
"tumblr",
|
||||||
|
"twitter",
|
||||||
|
"wordpress",
|
||||||
|
"xmpp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"openRegistrations": {
|
"openRegistrations": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue