diaspora_federation 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2605f2fbbad193258093de0d499941cbc231c853
|
4
|
+
data.tar.gz: 507864a736becfae27431510fc757905ac7cb0a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be545dfa7000d5b11bef50fba8cbb7dcd43be46d4a470fda1935aae1bf122e36c4e79b4706b7deda83eb8692f6a861a156a2e9960a7f7bef628460a513c61ed7
|
7
|
+
data.tar.gz: 0ef3cb5ea273720b9258f0851051745e385367907f8733019de8b413a29a0b0f6a65968e234bb716119c9776536d04281be19062a081447b7a7f68737cbc5287
|
@@ -84,7 +84,7 @@ module DiasporaFederation
|
|
84
84
|
# @param [Hash] data extracted data
|
85
85
|
# @return [String] webfinger url
|
86
86
|
def self.webfinger_url_from_xrd(data)
|
87
|
-
link = data[:links].find {|l|
|
87
|
+
link = data[:links].find {|l| l[:rel] == "lrdd" }
|
88
88
|
return link[:template] unless link.nil?
|
89
89
|
end
|
90
90
|
private_class_method :webfinger_url_from_xrd
|
@@ -41,6 +41,7 @@ module DiasporaFederation
|
|
41
41
|
property :acct_uri
|
42
42
|
|
43
43
|
# @!attribute [r] alias_url
|
44
|
+
# @note could be nil
|
44
45
|
# @return [String] link to the users profile
|
45
46
|
property :alias_url
|
46
47
|
|
@@ -68,6 +69,7 @@ module DiasporaFederation
|
|
68
69
|
property :atom_url
|
69
70
|
|
70
71
|
# @!attribute [r] salmon_url
|
72
|
+
# @note could be nil
|
71
73
|
# @return [String] salmon endpoint url
|
72
74
|
# @see http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html#SMLR
|
73
75
|
# Panzer draft for Salmon, paragraph 3.3
|
@@ -154,7 +156,7 @@ module DiasporaFederation
|
|
154
156
|
|
155
157
|
new(
|
156
158
|
acct_uri: data[:subject],
|
157
|
-
alias_url:
|
159
|
+
alias_url: parse_alias(data[:aliases]),
|
158
160
|
hcard_url: parse_link(links, REL_HCARD),
|
159
161
|
seed_url: parse_link(links, REL_SEED),
|
160
162
|
profile_url: parse_link(links, REL_PROFILE),
|
@@ -176,7 +178,7 @@ module DiasporaFederation
|
|
176
178
|
# @raise [InvalidData] if the given XML string is invalid or incomplete
|
177
179
|
def self.parse_xml_and_validate(webfinger_xml)
|
178
180
|
XrdDocument.xml_data(webfinger_xml).tap do |data|
|
179
|
-
valid = data.key?(:subject) && data.key?(:
|
181
|
+
valid = data.key?(:subject) && data.key?(:links)
|
180
182
|
raise InvalidData, "webfinger xml is incomplete" unless valid
|
181
183
|
end
|
182
184
|
end
|
@@ -218,11 +220,16 @@ module DiasporaFederation
|
|
218
220
|
end
|
219
221
|
private_class_method :parse_link
|
220
222
|
|
221
|
-
#
|
222
|
-
|
223
|
-
|
223
|
+
# this method is used to parse the alias_url from the XML.
|
224
|
+
# * redmatrix has sometimes no alias, return nil
|
225
|
+
# * old pods had quotes around the alias url, this can be removed later
|
226
|
+
# * friendica has two aliases and the first is with "acct:": return only an URL starting with http (or https)
|
227
|
+
def self.parse_alias(aliases)
|
228
|
+
return nil unless aliases
|
229
|
+
# TODO: Old pods had quotes around alias. Remove the +map+ in next line, when all pods use this gem
|
230
|
+
aliases.map {|a| a.gsub(/\A"|"\Z/, "") }.find {|a| a.start_with?("http") }
|
224
231
|
end
|
225
|
-
private_class_method :
|
232
|
+
private_class_method :parse_alias
|
226
233
|
end
|
227
234
|
end
|
228
235
|
end
|
@@ -9,12 +9,12 @@ module DiasporaFederation
|
|
9
9
|
|
10
10
|
rule :acct_uri, :not_empty
|
11
11
|
|
12
|
-
rule :alias_url,
|
12
|
+
rule :alias_url, URI: %i(host path)
|
13
13
|
rule :hcard_url, [:not_nil, URI: %i(host path)]
|
14
14
|
rule :seed_url, %i(not_nil URI)
|
15
15
|
rule :profile_url, [:not_nil, URI: %i(host path)]
|
16
16
|
rule :atom_url, [:not_nil, URI: %i(host path)]
|
17
|
-
rule :salmon_url,
|
17
|
+
rule :salmon_url, URI: %i(host path)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diaspora_federation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Neff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 1.0
|
81
|
+
version: '1.0'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.0
|
88
|
+
version: '1.0'
|
89
89
|
description: This gem provides the functionality for de-/serialization and de-/encryption
|
90
90
|
of Entities in the protocols used for communication among the various installations
|
91
91
|
of Diaspora*
|