diaspora_federation 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +28 -0
- data/README.md +2 -1
- data/lib/diaspora_federation.rb +14 -14
- data/lib/diaspora_federation/callbacks.rb +4 -4
- data/lib/diaspora_federation/discovery.rb +1 -1
- data/lib/diaspora_federation/discovery/discovery.rb +8 -8
- data/lib/diaspora_federation/discovery/h_card.rb +11 -12
- data/lib/diaspora_federation/discovery/host_meta.rb +2 -2
- data/lib/diaspora_federation/discovery/web_finger.rb +10 -13
- data/lib/diaspora_federation/discovery/xrd_document.rb +1 -1
- data/lib/diaspora_federation/entities.rb +2 -2
- data/lib/diaspora_federation/entities/account_deletion.rb +4 -4
- data/lib/diaspora_federation/entities/comment.rb +3 -3
- data/lib/diaspora_federation/entities/contact.rb +4 -4
- data/lib/diaspora_federation/entities/conversation.rb +13 -13
- data/lib/diaspora_federation/entities/like.rb +5 -5
- data/lib/diaspora_federation/entities/location.rb +1 -1
- data/lib/diaspora_federation/entities/message.rb +5 -5
- data/lib/diaspora_federation/entities/participation.rb +6 -6
- data/lib/diaspora_federation/entities/person.rb +6 -6
- data/lib/diaspora_federation/entities/photo.rb +10 -10
- data/lib/diaspora_federation/entities/poll.rb +3 -3
- data/lib/diaspora_federation/entities/poll_answer.rb +2 -2
- data/lib/diaspora_federation/entities/poll_participation.rb +3 -3
- data/lib/diaspora_federation/entities/post.rb +7 -7
- data/lib/diaspora_federation/entities/profile.rb +6 -6
- data/lib/diaspora_federation/entities/related_entity.rb +4 -4
- data/lib/diaspora_federation/entities/relayable.rb +32 -24
- data/lib/diaspora_federation/entities/relayable_retraction.rb +17 -17
- data/lib/diaspora_federation/entities/request.rb +5 -5
- data/lib/diaspora_federation/entities/reshare.rb +7 -7
- data/lib/diaspora_federation/entities/retraction.rb +6 -6
- data/lib/diaspora_federation/entities/signed_retraction.rb +8 -8
- data/lib/diaspora_federation/entities/status_message.rb +8 -8
- data/lib/diaspora_federation/entity.rb +7 -7
- data/lib/diaspora_federation/federation/fetcher.rb +3 -3
- data/lib/diaspora_federation/federation/receiver.rb +3 -3
- data/lib/diaspora_federation/federation/receiver/abstract_receiver.rb +3 -3
- data/lib/diaspora_federation/federation/receiver/private.rb +1 -1
- data/lib/diaspora_federation/federation/receiver/public.rb +1 -1
- data/lib/diaspora_federation/federation/sender/hydra_wrapper.rb +7 -6
- data/lib/diaspora_federation/http_client.rb +2 -2
- data/lib/diaspora_federation/logging.rb +7 -7
- data/lib/diaspora_federation/properties_dsl.rb +3 -3
- data/lib/diaspora_federation/salmon.rb +1 -1
- data/lib/diaspora_federation/salmon/aes.rb +4 -4
- data/lib/diaspora_federation/salmon/encrypted_slap.rb +9 -9
- data/lib/diaspora_federation/salmon/magic_envelope.rb +16 -16
- data/lib/diaspora_federation/salmon/slap.rb +2 -2
- data/lib/diaspora_federation/validators.rb +1 -1
- data/lib/diaspora_federation/validators/account_deletion_validator.rb +1 -1
- data/lib/diaspora_federation/validators/comment_validator.rb +1 -1
- data/lib/diaspora_federation/validators/contact_validator.rb +1 -1
- data/lib/diaspora_federation/validators/conversation_validator.rb +4 -4
- data/lib/diaspora_federation/validators/h_card_validator.rb +2 -2
- data/lib/diaspora_federation/validators/like_validator.rb +1 -1
- data/lib/diaspora_federation/validators/location_validator.rb +1 -1
- data/lib/diaspora_federation/validators/message_validator.rb +4 -1
- data/lib/diaspora_federation/validators/participation_validator.rb +1 -1
- data/lib/diaspora_federation/validators/person_validator.rb +1 -1
- data/lib/diaspora_federation/validators/photo_validator.rb +3 -1
- data/lib/diaspora_federation/validators/poll_answer_validator.rb +1 -1
- data/lib/diaspora_federation/validators/poll_participation_validator.rb +1 -1
- data/lib/diaspora_federation/validators/poll_validator.rb +1 -1
- data/lib/diaspora_federation/validators/profile_validator.rb +3 -3
- data/lib/diaspora_federation/validators/related_entity_validator.rb +1 -1
- data/lib/diaspora_federation/validators/relayable_retraction_validator.rb +2 -2
- data/lib/diaspora_federation/validators/relayable_validator.rb +2 -2
- data/lib/diaspora_federation/validators/request_validator.rb +2 -2
- data/lib/diaspora_federation/validators/reshare_validator.rb +1 -1
- data/lib/diaspora_federation/validators/retraction_validator.rb +1 -1
- data/lib/diaspora_federation/validators/rules/birthday.rb +2 -2
- data/lib/diaspora_federation/validators/rules/boolean.rb +1 -1
- data/lib/diaspora_federation/validators/rules/diaspora_id.rb +5 -5
- data/lib/diaspora_federation/validators/rules/diaspora_id_count.rb +3 -3
- data/lib/diaspora_federation/validators/rules/guid.rb +4 -4
- data/lib/diaspora_federation/validators/rules/not_nil.rb +1 -1
- data/lib/diaspora_federation/validators/rules/public_key.rb +1 -1
- data/lib/diaspora_federation/validators/rules/tag_count.rb +2 -2
- data/lib/diaspora_federation/validators/signed_retraction_validator.rb +2 -2
- data/lib/diaspora_federation/validators/status_message_validator.rb +3 -1
- data/lib/diaspora_federation/validators/web_finger_validator.rb +3 -3
- data/lib/diaspora_federation/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ba82f5232ef44f9731f00859c5a32fa8163570e
|
4
|
+
data.tar.gz: 01c7f76df999d4a0f476cf7c0ddbbc4f1a86ef0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49abed4f800587ea9f0a671cd1eccc74a3df06b58f9039e61a7540b8e809cf54b4b49f6e8d075e6fe943ffd687d10c2d0e48e250878d080e0c6370ff27979ee6
|
7
|
+
data.tar.gz: 36c5a25c0744fda688707de4d0c469d90989a3fb016e1af39e030efa38dddc3d4b6c9a89be21d52245950f41b59fb030c8c5eeda3a96e8475cdfa6ff3057c2b7
|
data/Changelog.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# 0.1.2
|
2
|
+
|
3
|
+
## Refactor
|
4
|
+
|
5
|
+
* Improve code documentation [#38](https://github.com/diaspora/diaspora_federation/pull/38)
|
6
|
+
* Improve validation [9b32315](https://github.com/diaspora/diaspora_federation/commit/9b3231583d85e6007bf43cedc4480f043c8bde15) [eb8cdef](https://github.com/diaspora/diaspora_federation/commit/eb8cdef604cc8fe71e8455f36a317d80657f1582) [0980294](https://github.com/diaspora/diaspora_federation/commit/0980294a0d259cba1fa2a2a655163b3fa844d239)
|
7
|
+
* Photo: `status_message_guid` is optional [4136fb9](https://github.com/diaspora/diaspora_federation/commit/4136fb973e7ad27158ef605df12727f4e959c3a3)
|
8
|
+
* A GUID is at most 255 chars long [f7d269c](https://github.com/diaspora/diaspora_federation/commit/f7d269cd6a4c1b48a7b34083f5fea04ac0835a48)
|
9
|
+
* hCard: `nickname` is optional [4b94949](https://github.com/diaspora/diaspora_federation/commit/4b949491df3a16b30f6e27113d6fa95c165c1edc)
|
10
|
+
* StatusMessage: Rename `raw_message` to `text` [2aaff56](https://github.com/diaspora/diaspora_federation/commit/2aaff56e147b505626a615d60564fbbf22c2f452) [#29](https://github.com/diaspora/diaspora_federation/issues/29)
|
11
|
+
|
12
|
+
## Bug fixes
|
13
|
+
|
14
|
+
* Do not reuse cURL sockets to avoid issues caused by too many simultaneous connections [#37](https://github.com/diaspora/diaspora_federation/pull/37)
|
15
|
+
* Handle empty xml-elements for nested entities [26b7991](https://github.com/diaspora/diaspora_federation/commit/26b7991defe1d84d10c1186a151676076946b26f)
|
16
|
+
* Gracefully handle missing xml elements of relayables [9097097](https://github.com/diaspora/diaspora_federation/commit/90970973a58cbc3d897d21a43c0a6c93a30605be)
|
17
|
+
|
18
|
+
# 0.1.1
|
19
|
+
|
20
|
+
## Features
|
21
|
+
|
22
|
+
* Fetch root posts for reshares [9b090a3](https://github.com/diaspora/diaspora_federation/commit/9b090a39501705f00403f124e215e78866039f1e)
|
23
|
+
|
24
|
+
# 0.1.0
|
25
|
+
|
26
|
+
## Features
|
27
|
+
|
28
|
+
* Added Salmon support
|
data/README.md
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
[](https://inch-ci.org/github/diaspora/diaspora_federation)
|
11
11
|
[](https://badge.fury.io/rb/diaspora_federation)
|
12
12
|
|
13
|
-
[Documentation](http://www.rubydoc.info/gems/diaspora_federation/) |
|
13
|
+
[Gem Documentation](http://www.rubydoc.info/gems/diaspora_federation/) |
|
14
|
+
[Protocol Documentation](http://diaspora.github.io/diaspora_federation/) |
|
14
15
|
[Bugtracker](https://github.com/diaspora/diaspora_federation/issues)
|
15
16
|
|
16
17
|
This repository contains two gems:
|
data/lib/diaspora_federation.rb
CHANGED
@@ -48,7 +48,7 @@ module DiasporaFederation
|
|
48
48
|
# @return [Callbacks] callbacks
|
49
49
|
attr_reader :callbacks
|
50
50
|
|
51
|
-
#
|
51
|
+
# The pod url
|
52
52
|
#
|
53
53
|
# @overload server_uri
|
54
54
|
# @return [URI] the server uri
|
@@ -80,7 +80,7 @@ module DiasporaFederation
|
|
80
80
|
# @param [Integer] value max number of parallel requests
|
81
81
|
attr_accessor :http_concurrency
|
82
82
|
|
83
|
-
#
|
83
|
+
# Timeout in seconds for http-requests (default: +30+)
|
84
84
|
#
|
85
85
|
# @overload http_timeout
|
86
86
|
# @return [Integer] http timeout in seconds
|
@@ -98,15 +98,15 @@ module DiasporaFederation
|
|
98
98
|
# @param [Boolean] value verbose http output
|
99
99
|
attr_accessor :http_verbose
|
100
100
|
|
101
|
-
#
|
101
|
+
# Max redirects to follow
|
102
102
|
# @return [Integer] max redirects
|
103
103
|
attr_reader :http_redirect_limit
|
104
104
|
|
105
|
-
#
|
105
|
+
# User agent used for http-requests
|
106
106
|
# @return [String] user agent
|
107
107
|
attr_reader :http_user_agent
|
108
108
|
|
109
|
-
#
|
109
|
+
# Configure the federation library
|
110
110
|
#
|
111
111
|
# @example
|
112
112
|
# DiasporaFederation.configure do |config|
|
@@ -120,7 +120,7 @@ module DiasporaFederation
|
|
120
120
|
yield self
|
121
121
|
end
|
122
122
|
|
123
|
-
#
|
123
|
+
# Define the callbacks
|
124
124
|
#
|
125
125
|
# In order to communicate with the application which uses the diaspora_federation gem
|
126
126
|
# callbacks are introduced. The callbacks are used for getting required data from the
|
@@ -130,7 +130,7 @@ module DiasporaFederation
|
|
130
130
|
#
|
131
131
|
# fetch_person_for_webfinger
|
132
132
|
# Fetches person data from the application to form a WebFinger reply
|
133
|
-
# @param [String]
|
133
|
+
# @param [String] diaspora* ID of the person
|
134
134
|
# @return [DiasporaFederation::Discovery::WebFinger] person webfinger data
|
135
135
|
#
|
136
136
|
# fetch_person_for_hcard
|
@@ -144,13 +144,13 @@ module DiasporaFederation
|
|
144
144
|
# @param [DiasporaFederation::Entities::Person] person data
|
145
145
|
#
|
146
146
|
# fetch_private_key
|
147
|
-
# Fetches a private key of a person by her
|
148
|
-
# @param [String]
|
147
|
+
# Fetches a private key of a person by her diaspora* ID from the application
|
148
|
+
# @param [String] diaspora* ID of the person
|
149
149
|
# @return [OpenSSL::PKey::RSA] key
|
150
150
|
#
|
151
151
|
# fetch_public_key
|
152
|
-
# Fetches a public key of a person by her
|
153
|
-
# @param [String]
|
152
|
+
# Fetches a public key of a person by her diaspora* ID from the application
|
153
|
+
# @param [String] diaspora* ID of the person
|
154
154
|
# @return [OpenSSL::PKey::RSA] key
|
155
155
|
#
|
156
156
|
# fetch_related_entity
|
@@ -178,12 +178,12 @@ module DiasporaFederation
|
|
178
178
|
# see {Receiver.receive_private}
|
179
179
|
#
|
180
180
|
# fetch_public_entity
|
181
|
-
#
|
181
|
+
# Fetch a public entity from the database
|
182
182
|
# @param [String] entity_type (Post, StatusMessage, etc)
|
183
183
|
# @param [String] guid the guid of the entity
|
184
184
|
#
|
185
185
|
# fetch_person_url_to
|
186
|
-
#
|
186
|
+
# Fetch the url to path for a person
|
187
187
|
# @param [String] diaspora_id
|
188
188
|
# @param [String] path
|
189
189
|
#
|
@@ -206,7 +206,7 @@ module DiasporaFederation
|
|
206
206
|
@callbacks.instance_eval(&block)
|
207
207
|
end
|
208
208
|
|
209
|
-
#
|
209
|
+
# Validates if the engine is configured correctly
|
210
210
|
#
|
211
211
|
# called from after_initialize
|
212
212
|
# @raise [ConfigurationError] if the configuration is incomplete or invalid
|
@@ -2,7 +2,7 @@ module DiasporaFederation
|
|
2
2
|
# Callbacks are used to communicate with the application. They are called to
|
3
3
|
# fetch data and after data is received.
|
4
4
|
class Callbacks
|
5
|
-
# Initializes a new Callbacks object with the event-keys that need to be defined
|
5
|
+
# Initializes a new Callbacks object with the event-keys that need to be defined
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Callbacks.new %i(
|
@@ -16,7 +16,7 @@ module DiasporaFederation
|
|
16
16
|
@handlers = {}
|
17
17
|
end
|
18
18
|
|
19
|
-
#
|
19
|
+
# Defines a callback
|
20
20
|
#
|
21
21
|
# @example
|
22
22
|
# callbacks.on :some_event do |arg1|
|
@@ -33,7 +33,7 @@ module DiasporaFederation
|
|
33
33
|
@handlers[event] = callback
|
34
34
|
end
|
35
35
|
|
36
|
-
#
|
36
|
+
# Triggers a callback
|
37
37
|
#
|
38
38
|
# @example
|
39
39
|
# callbacks.trigger :some_event, "foo"
|
@@ -47,7 +47,7 @@ module DiasporaFederation
|
|
47
47
|
@handlers[event].call(*args)
|
48
48
|
end
|
49
49
|
|
50
|
-
#
|
50
|
+
# Checks if all callbacks are defined
|
51
51
|
# @return [Boolean]
|
52
52
|
def definition_complete?
|
53
53
|
missing_handlers.empty?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
# This module provides the namespace for the various classes implementing
|
3
3
|
# WebFinger and other protocols used for metadata discovery on remote servers
|
4
|
-
# in the
|
4
|
+
# in the diaspora* network.
|
5
5
|
module Discovery
|
6
6
|
end
|
7
7
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Discovery
|
3
|
-
# This class contains the logic to fetch all data for the given diaspora ID
|
3
|
+
# This class contains the logic to fetch all data for the given diaspora* ID.
|
4
4
|
class Discovery
|
5
5
|
include DiasporaFederation::Logging
|
6
6
|
|
7
|
-
# @return [String] the diaspora ID of the account
|
7
|
+
# @return [String] the diaspora* ID of the account
|
8
8
|
attr_reader :diaspora_id
|
9
9
|
|
10
|
-
#
|
11
|
-
# @param [String] diaspora_id the diaspora
|
10
|
+
# Creates a discovery class for the diaspora* ID
|
11
|
+
# @param [String] diaspora_id the diaspora* ID to discover
|
12
12
|
def initialize(diaspora_id)
|
13
13
|
@diaspora_id = clean_diaspora_id(diaspora_id)
|
14
14
|
end
|
15
15
|
|
16
|
-
#
|
16
|
+
# Fetches all metadata for the account and saves it via callback
|
17
17
|
# @return [Person]
|
18
18
|
def fetch_and_save
|
19
19
|
logger.info "Fetch data for #{diaspora_id}"
|
@@ -28,9 +28,9 @@ module DiasporaFederation
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def validate_diaspora_id
|
31
|
-
#
|
31
|
+
# Validates if the diaspora* ID matches the diaspora* ID in the webfinger response
|
32
32
|
return if diaspora_id == clean_diaspora_id(webfinger.acct_uri)
|
33
|
-
raise DiscoveryError, "
|
33
|
+
raise DiscoveryError, "diaspora* ID does not match: Wanted #{diaspora_id} but got" \
|
34
34
|
" #{clean_diaspora_id(webfinger.acct_uri)}"
|
35
35
|
end
|
36
36
|
|
@@ -59,7 +59,7 @@ module DiasporaFederation
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def legacy_webfinger_url_from_host_meta
|
62
|
-
#
|
62
|
+
# This tries the xrd url with https first, then falls back to http.
|
63
63
|
host_meta = HostMeta.from_xml get(host_meta_url, true)
|
64
64
|
host_meta.webfinger_template_url.gsub("{uri}", "acct:#{diaspora_id}")
|
65
65
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Discovery
|
3
|
-
# This class provides the means of generating
|
3
|
+
# This class provides the means of generating and parsing account data to and
|
4
4
|
# from the hCard format.
|
5
5
|
# hCard is based on +RFC 2426+ (vCard) which got superseded by +RFC 6350+.
|
6
6
|
# There is a draft for a new h-card format specification, that makes use of
|
@@ -46,9 +46,9 @@ module DiasporaFederation
|
|
46
46
|
property :guid
|
47
47
|
|
48
48
|
# @!attribute [r] nickname
|
49
|
-
#
|
49
|
+
# The first part of the diaspora* ID
|
50
50
|
# @return [String] nickname
|
51
|
-
property :nickname
|
51
|
+
property :nickname, default: nil
|
52
52
|
|
53
53
|
# @!attribute [r] full_name
|
54
54
|
# @return [String] display name of the user
|
@@ -56,7 +56,7 @@ module DiasporaFederation
|
|
56
56
|
|
57
57
|
# @!attribute [r] url
|
58
58
|
# @deprecated should be changed to the profile url. The pod url is in
|
59
|
-
# the WebFinger (see {WebFinger#seed_url}, will affect older
|
59
|
+
# the WebFinger (see {WebFinger#seed_url}, will affect older diaspora*
|
60
60
|
# installations).
|
61
61
|
#
|
62
62
|
# @return [String] link to the pod
|
@@ -83,7 +83,7 @@ module DiasporaFederation
|
|
83
83
|
|
84
84
|
# @!attribute [r] first_name
|
85
85
|
# @deprecated We decided to only use one name field, these should be removed
|
86
|
-
# in later iterations (will affect older
|
86
|
+
# in later iterations (will affect older diaspora* installations).
|
87
87
|
#
|
88
88
|
# @see #full_name
|
89
89
|
# @return [String] first name
|
@@ -91,7 +91,7 @@ module DiasporaFederation
|
|
91
91
|
|
92
92
|
# @!attribute [r] last_name
|
93
93
|
# @deprecated We decided to only use one name field, these should be removed
|
94
|
-
# in later iterations (will affect older
|
94
|
+
# in later iterations (will affect older diaspora* installations).
|
95
95
|
#
|
96
96
|
# @see #full_name
|
97
97
|
# @return [String] last name
|
@@ -100,7 +100,7 @@ module DiasporaFederation
|
|
100
100
|
# @!attribute [r] searchable
|
101
101
|
# @deprecated As this is a simple property, consider move to WebFinger instead
|
102
102
|
# of HCard. vCard has no comparable field for this information, but
|
103
|
-
# Webfinger may declare arbitrary properties (will affect older
|
103
|
+
# Webfinger may declare arbitrary properties (will affect older diaspora*
|
104
104
|
# installations).
|
105
105
|
#
|
106
106
|
# flag if a user is searchable by name
|
@@ -152,7 +152,7 @@ module DiasporaFederation
|
|
152
152
|
builder.doc.to_xhtml(indent: 2, indent_text: " ")
|
153
153
|
end
|
154
154
|
|
155
|
-
# Creates a new HCard instance from the given HTML string
|
155
|
+
# Creates a new HCard instance from the given HTML string
|
156
156
|
# @param html_string [String] HTML string
|
157
157
|
# @return [HCard] HCard instance
|
158
158
|
# @raise [InvalidData] if the HTML string is invalid or incomplete
|
@@ -219,7 +219,7 @@ module DiasporaFederation
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
-
# Calls {HCard#add_property} for a simple text property
|
222
|
+
# Calls {HCard#add_property} for a simple text property
|
223
223
|
# @param container [Nokogiri::XML::Element] parent element
|
224
224
|
# @param name [Symbol] property name
|
225
225
|
# @param class_name [String] HTML class name
|
@@ -253,8 +253,7 @@ module DiasporaFederation
|
|
253
253
|
# @param [LibXML::XML::Document] doc HTML document
|
254
254
|
# @return [Boolean] validation result
|
255
255
|
private_class_method def self.html_document_complete?(doc)
|
256
|
-
!(doc.at_css(SELECTORS[:fn]).nil? || doc.at_css(SELECTORS[:
|
257
|
-
doc.at_css(SELECTORS[:photo]).nil?)
|
256
|
+
!(doc.at_css(SELECTORS[:fn]).nil? || doc.at_css(SELECTORS[:photo]).nil?)
|
258
257
|
end
|
259
258
|
|
260
259
|
private_class_method def self.parse_html_and_validate(html_string)
|
@@ -270,7 +269,7 @@ module DiasporaFederation
|
|
270
269
|
end
|
271
270
|
|
272
271
|
private_class_method def self.content_from_doc(doc, content_selector)
|
273
|
-
element_from_doc(doc, content_selector).content
|
272
|
+
element_from_doc(doc, content_selector).try(:content)
|
274
273
|
end
|
275
274
|
|
276
275
|
private_class_method def self.photo_from_doc(doc, photo_selector)
|
@@ -4,7 +4,7 @@ module DiasporaFederation
|
|
4
4
|
# Generates and parses Host Meta documents.
|
5
5
|
#
|
6
6
|
# This is a minimal implementation of the standard, only to the degree of what
|
7
|
-
# is used for the purposes of the
|
7
|
+
# is used for the purposes of the diaspora* protocol. (e.g. WebFinger)
|
8
8
|
#
|
9
9
|
# @example Creating a Host Meta document
|
10
10
|
# doc = HostMeta.from_base_url("https://pod.example.tld/")
|
@@ -19,7 +19,7 @@ module DiasporaFederation
|
|
19
19
|
class HostMeta
|
20
20
|
private_class_method :new
|
21
21
|
|
22
|
-
#
|
22
|
+
# Creates a new host-meta instance
|
23
23
|
# @param [String] webfinger_url the webfinger-url
|
24
24
|
def initialize(webfinger_url)
|
25
25
|
@webfinger_url = webfinger_url
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Discovery
|
3
|
-
# The WebFinger document used for
|
4
|
-
# draft
|
5
|
-
# on {http://code.google.com/p/webfinger/wiki/WebFingerProtocol Google Code}
|
6
|
-
# (from around 2010).
|
3
|
+
# The WebFinger document used for diaspora* user discovery is based on an
|
4
|
+
# {http://tools.ietf.org/html/draft-jones-appsawg-webfinger older draft of the specification}.
|
7
5
|
#
|
8
6
|
# In the meantime an actual RFC draft has been in development, which should
|
9
7
|
# serve as a base for all future changes of this implementation.
|
@@ -30,7 +28,6 @@ module DiasporaFederation
|
|
30
28
|
#
|
31
29
|
# @see http://tools.ietf.org/html/draft-jones-appsawg-webfinger "WebFinger" -
|
32
30
|
# current draft
|
33
|
-
# @see http://code.google.com/p/webfinger/wiki/CommonLinkRelations
|
34
31
|
# @see http://www.iana.org/assignments/link-relations/link-relations.xhtml
|
35
32
|
# official list of IANA link relations
|
36
33
|
class WebFinger < Entity
|
@@ -58,7 +55,7 @@ module DiasporaFederation
|
|
58
55
|
property :profile_url
|
59
56
|
|
60
57
|
# @!attribute [r] atom_url
|
61
|
-
# This atom feed is an Activity Stream of the user's public posts.
|
58
|
+
# This atom feed is an Activity Stream of the user's public posts. diaspora*
|
62
59
|
# pods SHOULD publish an Activity Stream of public posts, but there is
|
63
60
|
# currently no requirement to be able to read Activity Streams.
|
64
61
|
# @see http://activitystrea.ms/ Activity Streams specification
|
@@ -82,7 +79,7 @@ module DiasporaFederation
|
|
82
79
|
# @!attribute [r] guid
|
83
80
|
# @deprecated Either convert these to +Property+ elements or move to the
|
84
81
|
# +hCard+, which actually has fields for an +UID+ defined in the +vCard+
|
85
|
-
# specification (will affect older
|
82
|
+
# specification (will affect older diaspora* installations).
|
86
83
|
#
|
87
84
|
# @see HCard#guid
|
88
85
|
# @see Entities::Person#guid
|
@@ -92,7 +89,7 @@ module DiasporaFederation
|
|
92
89
|
# @!attribute [r] public_key
|
93
90
|
# @deprecated Either convert these to +Property+ elements or move to the
|
94
91
|
# +hCard+, which actually has fields for an +KEY+ defined in the +vCard+
|
95
|
-
# specification (will affect older
|
92
|
+
# specification (will affect older diaspora* installations).
|
96
93
|
#
|
97
94
|
# @see HCard#public_key
|
98
95
|
#
|
@@ -111,7 +108,7 @@ module DiasporaFederation
|
|
111
108
|
|
112
109
|
# @deprecated This should be a +Property+ or moved to the +hCard+, but +Link+
|
113
110
|
# is inappropriate according to the specification (will affect older
|
114
|
-
#
|
111
|
+
# diaspora* installations).
|
115
112
|
# +guid+ link relation
|
116
113
|
REL_GUID = "http://joindiaspora.com/guid".freeze
|
117
114
|
|
@@ -130,11 +127,11 @@ module DiasporaFederation
|
|
130
127
|
|
131
128
|
# @deprecated This should be a +Property+ or moved to the +hcard+, but +Link+
|
132
129
|
# is inappropriate according to the specification (will affect older
|
133
|
-
#
|
130
|
+
# diaspora* installations).
|
134
131
|
# +pubkey+ link relation
|
135
132
|
REL_PUBKEY = "diaspora-public-key".freeze
|
136
133
|
|
137
|
-
#
|
134
|
+
# Creates the XML string from the current WebFinger instance
|
138
135
|
# @return [String] XML string
|
139
136
|
def to_xml
|
140
137
|
doc = XrdDocument.new
|
@@ -146,7 +143,7 @@ module DiasporaFederation
|
|
146
143
|
doc.to_xml
|
147
144
|
end
|
148
145
|
|
149
|
-
#
|
146
|
+
# Creates a WebFinger instance from the given XML string
|
150
147
|
# @param [String] webfinger_xml WebFinger XML string
|
151
148
|
# @return [WebFinger] WebFinger instance
|
152
149
|
# @raise [InvalidData] if the given XML string is invalid or incomplete
|
@@ -229,7 +226,7 @@ module DiasporaFederation
|
|
229
226
|
element ? element[:template] : nil
|
230
227
|
end
|
231
228
|
|
232
|
-
#
|
229
|
+
# This method is used to parse the alias_url from the XML.
|
233
230
|
# * redmatrix has sometimes no alias, return nil
|
234
231
|
# * old pods had quotes around the alias url, this can be removed later
|
235
232
|
# * friendica has two aliases and the first is with "acct:": return only an URL starting with http (or https)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Discovery
|
3
3
|
# This class implements basic handling of XRD documents as far as it is
|
4
|
-
# necessary in the context of the protocols used with
|
4
|
+
# necessary in the context of the protocols used with diaspora* federation.
|
5
5
|
#
|
6
6
|
# @note {http://tools.ietf.org/html/rfc6415 RFC 6415} recommends that servers
|
7
7
|
# should also offer the JRD format in addition to the XRD representation.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
# This namespace contains all the entities used to encapsulate data that is
|
3
|
-
# passed around in the
|
3
|
+
# passed around in the diaspora* network as part of the federation protocol.
|
4
4
|
#
|
5
|
-
# All entities must be defined in this namespace.
|
5
|
+
# All entities must be defined in this namespace. Otherwise the XML
|
6
6
|
# de-serialization will fail.
|
7
7
|
module Entities
|
8
8
|
end
|