diaspora_federation 0.0.12 → 0.0.13
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/lib/diaspora_federation.rb +103 -18
- data/lib/diaspora_federation/discovery/discovery.rb +1 -1
- data/lib/diaspora_federation/discovery/h_card.rb +4 -5
- data/lib/diaspora_federation/discovery/host_meta.rb +1 -1
- data/lib/diaspora_federation/discovery/web_finger.rb +8 -8
- data/lib/diaspora_federation/discovery/xrd_document.rb +6 -7
- data/lib/diaspora_federation/entities.rb +21 -10
- data/lib/diaspora_federation/entities/account_deletion.rb +7 -3
- data/lib/diaspora_federation/entities/comment.rb +13 -10
- data/lib/diaspora_federation/entities/contact.rb +29 -0
- data/lib/diaspora_federation/entities/conversation.rb +5 -6
- data/lib/diaspora_federation/entities/like.rb +10 -18
- data/lib/diaspora_federation/entities/message.rb +6 -12
- data/lib/diaspora_federation/entities/participation.rb +8 -16
- data/lib/diaspora_federation/entities/person.rb +6 -2
- data/lib/diaspora_federation/entities/photo.rb +3 -3
- data/lib/diaspora_federation/entities/poll_participation.rb +6 -12
- data/lib/diaspora_federation/entities/post.rb +37 -0
- data/lib/diaspora_federation/entities/profile.rb +7 -3
- data/lib/diaspora_federation/entities/relayable.rb +169 -65
- data/lib/diaspora_federation/entities/relayable_retraction.rb +33 -32
- data/lib/diaspora_federation/entities/request.rb +20 -6
- data/lib/diaspora_federation/entities/reshare.rb +5 -27
- data/lib/diaspora_federation/entities/retraction.rb +6 -6
- data/lib/diaspora_federation/entities/signed_retraction.rb +32 -26
- data/lib/diaspora_federation/entities/status_message.rb +2 -22
- data/lib/diaspora_federation/entity.rb +137 -38
- data/lib/diaspora_federation/federation.rb +9 -0
- data/lib/diaspora_federation/federation/fetcher.rb +26 -0
- data/lib/diaspora_federation/federation/receiver.rb +41 -0
- data/lib/diaspora_federation/federation/receiver/abstract_receiver.rb +35 -0
- data/lib/diaspora_federation/federation/receiver/exceptions.rb +13 -0
- data/lib/diaspora_federation/federation/receiver/private.rb +15 -0
- data/lib/diaspora_federation/federation/receiver/public.rb +9 -0
- data/lib/diaspora_federation/federation/sender.rb +33 -0
- data/lib/diaspora_federation/federation/sender/hydra_wrapper.rb +92 -0
- data/lib/diaspora_federation/{fetcher.rb → http_client.rb} +6 -6
- data/lib/diaspora_federation/properties_dsl.rb +51 -14
- data/lib/diaspora_federation/salmon.rb +2 -1
- data/lib/diaspora_federation/salmon/aes.rb +1 -1
- data/lib/diaspora_federation/salmon/encrypted_magic_envelope.rb +61 -0
- data/lib/diaspora_federation/salmon/encrypted_slap.rb +69 -50
- data/lib/diaspora_federation/salmon/exceptions.rb +8 -14
- data/lib/diaspora_federation/salmon/magic_envelope.rb +80 -39
- data/lib/diaspora_federation/salmon/slap.rb +20 -51
- data/lib/diaspora_federation/salmon/xml_payload.rb +5 -104
- data/lib/diaspora_federation/validators.rb +22 -16
- data/lib/diaspora_federation/validators/account_deletion_validator.rb +1 -1
- data/lib/diaspora_federation/validators/comment_validator.rb +0 -4
- data/lib/diaspora_federation/validators/contact_validator.rb +13 -0
- data/lib/diaspora_federation/validators/conversation_validator.rb +2 -2
- data/lib/diaspora_federation/validators/like_validator.rb +1 -3
- data/lib/diaspora_federation/validators/message_validator.rb +0 -4
- data/lib/diaspora_federation/validators/participation_validator.rb +1 -5
- data/lib/diaspora_federation/validators/person_validator.rb +1 -1
- data/lib/diaspora_federation/validators/photo_validator.rb +2 -2
- data/lib/diaspora_federation/validators/poll_participation_validator.rb +0 -4
- data/lib/diaspora_federation/validators/profile_validator.rb +1 -1
- data/lib/diaspora_federation/validators/relayable_retraction_validator.rb +1 -1
- data/lib/diaspora_federation/validators/relayable_validator.rb +2 -0
- data/lib/diaspora_federation/validators/request_validator.rb +3 -2
- data/lib/diaspora_federation/validators/reshare_validator.rb +3 -3
- data/lib/diaspora_federation/validators/retraction_validator.rb +2 -2
- data/lib/diaspora_federation/validators/rules/guid.rb +16 -7
- data/lib/diaspora_federation/validators/signed_retraction_validator.rb +1 -1
- data/lib/diaspora_federation/validators/status_message_validator.rb +2 -2
- data/lib/diaspora_federation/version.rb +1 -1
- metadata +20 -11
- data/lib/diaspora_federation/receiver.rb +0 -28
- data/lib/diaspora_federation/receiver/private.rb +0 -19
- data/lib/diaspora_federation/receiver/public.rb +0 -13
- data/lib/diaspora_federation/signing.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eab26d24aadd05dde520265d1fc2cae76cb71bb
|
4
|
+
data.tar.gz: 0454bedd0f5cef501c7a99d04a1e67db3f13db9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed6351f1780275bfa7856e288ca6f23b202e8b34f54dae9d109ced23b8bb6c4815dfb1df171a29b0974737551b04694ff05750138ac5cbfe9a2866733da8d0c
|
7
|
+
data.tar.gz: 9fa0cb00be0cce4ee0c5aa1ffca7e33decb7e3f9afd9fc2019e898432f6dc57adf30ee5ab600256145756dc2395738eb607fc54970cd8728c5ad03a941af3ff0
|
data/lib/diaspora_federation.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "diaspora_federation/version"
|
2
|
+
|
1
3
|
require "diaspora_federation/logging"
|
2
4
|
|
3
5
|
require "diaspora_federation/callbacks"
|
@@ -5,14 +7,13 @@ require "diaspora_federation/properties_dsl"
|
|
5
7
|
require "diaspora_federation/entity"
|
6
8
|
require "diaspora_federation/validators"
|
7
9
|
|
8
|
-
require "diaspora_federation/
|
10
|
+
require "diaspora_federation/http_client"
|
9
11
|
|
10
|
-
require "diaspora_federation/signing"
|
11
12
|
require "diaspora_federation/entities"
|
12
13
|
|
13
14
|
require "diaspora_federation/discovery"
|
14
15
|
require "diaspora_federation/salmon"
|
15
|
-
require "diaspora_federation/
|
16
|
+
require "diaspora_federation/federation"
|
16
17
|
|
17
18
|
# diaspora* federation library
|
18
19
|
module DiasporaFederation
|
@@ -30,29 +31,84 @@ module DiasporaFederation
|
|
30
31
|
fetch_entity_author_id_by_guid
|
31
32
|
queue_public_receive
|
32
33
|
queue_private_receive
|
33
|
-
|
34
|
+
receive_entity
|
35
|
+
fetch_public_entity
|
36
|
+
fetch_person_url_to
|
37
|
+
update_pod
|
34
38
|
)
|
35
39
|
|
40
|
+
# defaults
|
41
|
+
@http_concurrency = 20
|
42
|
+
@http_timeout = 30
|
43
|
+
@http_verbose = false
|
44
|
+
@http_redirect_limit = 4
|
45
|
+
@http_user_agent = "DiasporaFederation/#{DiasporaFederation::VERSION}"
|
46
|
+
|
36
47
|
class << self
|
37
48
|
# {Callbacks} instance with defined callbacks
|
38
49
|
# @see Callbacks#on
|
39
50
|
# @see Callbacks#trigger
|
51
|
+
# @return [Callbacks] callbacks
|
40
52
|
attr_reader :callbacks
|
41
53
|
|
42
54
|
# the pod url
|
43
55
|
#
|
44
|
-
# @
|
45
|
-
#
|
46
|
-
# @
|
47
|
-
#
|
56
|
+
# @overload server_uri
|
57
|
+
# @return [URI] the server uri
|
58
|
+
# @overload server_uri=
|
59
|
+
# @example with uri
|
60
|
+
# config.server_uri = URI("http://localhost:3000/")
|
61
|
+
# @example with configured pod_uri
|
62
|
+
# config.server_uri = AppConfig.pod_uri
|
63
|
+
# @param [URI] value the server uri
|
48
64
|
attr_accessor :server_uri
|
49
65
|
|
50
66
|
# Set the bundle of certificate authorities (CA) certificates
|
51
67
|
#
|
52
|
-
# @
|
53
|
-
#
|
68
|
+
# @overload certificate_authorities
|
69
|
+
# @return [String] path to certificate authorities
|
70
|
+
# @overload certificate_authorities=
|
71
|
+
# @example
|
72
|
+
# config.certificate_authorities = AppConfig.environment.certificate_authorities.get
|
73
|
+
# @param [String] value path to certificate authorities
|
54
74
|
attr_accessor :certificate_authorities
|
55
75
|
|
76
|
+
# Maximum number of parallel HTTP requests made to other pods (default: +20+)
|
77
|
+
#
|
78
|
+
# @overload http_concurrency
|
79
|
+
# @return [Integer] max number of parallel requests
|
80
|
+
# @overload http_concurrency=
|
81
|
+
# @example
|
82
|
+
# config.http_concurrency = AppConfig.settings.typhoeus_concurrency.to_i
|
83
|
+
# @param [Integer] value max number of parallel requests
|
84
|
+
attr_accessor :http_concurrency
|
85
|
+
|
86
|
+
# timeout in seconds for http-requests (default: +30+)
|
87
|
+
#
|
88
|
+
# @overload http_timeout
|
89
|
+
# @return [Integer] http timeout in seconds
|
90
|
+
# @overload http_timeout=
|
91
|
+
# @param [Integer] value http timeout in seconds
|
92
|
+
attr_accessor :http_timeout
|
93
|
+
|
94
|
+
# Turn on extra verbose output when sending stuff. (default: +false+)
|
95
|
+
#
|
96
|
+
# @overload http_verbose
|
97
|
+
# @return [Boolean] verbose http output
|
98
|
+
# @overload http_verbose=
|
99
|
+
# @example
|
100
|
+
# config.http_verbose = AppConfig.settings.typhoeus_verbose?
|
101
|
+
# @param [Boolean] value verbose http output
|
102
|
+
attr_accessor :http_verbose
|
103
|
+
|
104
|
+
# max redirects to follow
|
105
|
+
# @return [Integer] max redirects
|
106
|
+
attr_reader :http_redirect_limit
|
107
|
+
|
108
|
+
# user agent used for http-requests
|
109
|
+
# @return [String] user agent
|
110
|
+
attr_reader :http_user_agent
|
111
|
+
|
56
112
|
# configure the federation library
|
57
113
|
#
|
58
114
|
# @example
|
@@ -97,7 +153,7 @@ module DiasporaFederation
|
|
97
153
|
#
|
98
154
|
# fetch_author_private_key_by_entity_guid
|
99
155
|
# Fetches a private key of the person who authored an entity identified by a given guid
|
100
|
-
# @param [String]
|
156
|
+
# @param [String] entity_type (Post, Comment, Like, etc)
|
101
157
|
# @param [String] guid of the entity
|
102
158
|
# @return [OpenSSL::PKey::RSA] key
|
103
159
|
#
|
@@ -108,36 +164,55 @@ module DiasporaFederation
|
|
108
164
|
#
|
109
165
|
# fetch_author_public_key_by_entity_guid
|
110
166
|
# Fetches a public key of the person who authored an entity identified by a given guid
|
111
|
-
# @param [String]
|
167
|
+
# @param [String] entity_type (Post, Comment, Like, etc)
|
112
168
|
# @param [String] guid of the entity
|
113
169
|
# @return [OpenSSL::PKey::RSA] key
|
114
170
|
#
|
115
171
|
# entity_author_is_local?
|
116
172
|
# Reports if the author of the entity identified by a given guid is local on the pod
|
117
173
|
# where we operate.
|
118
|
-
# @param [String]
|
174
|
+
# @param [String] entity_type (Post, Comment, Like, etc)
|
119
175
|
# @param [String] guid of the entity
|
120
176
|
# @return [Boolean]
|
121
177
|
#
|
122
178
|
# fetch_entity_author_id_by_guid
|
123
179
|
# Fetches Diaspora ID of the person who authored the entity identified by a given guid
|
124
|
-
# @param [String]
|
180
|
+
# @param [String] entity_type (Post, Comment, Like, etc)
|
125
181
|
# @param [String] guid of the entity
|
126
182
|
# @return [String] Diaspora ID of the person
|
127
183
|
#
|
128
184
|
# queue_public_receive
|
129
185
|
# Queue a public salmon xml to process in background
|
130
|
-
# @param [String]
|
186
|
+
# @param [String] data salmon slap xml or magic envelope xml
|
187
|
+
# @param [Boolean] legacy true if it is a legacy salmon slap, false if it is a magic envelope xml
|
131
188
|
#
|
132
189
|
# queue_private_receive
|
133
190
|
# Queue a private salmon xml to process in background
|
134
191
|
# @param [String] guid guid of the receiver person
|
135
|
-
# @param [String]
|
192
|
+
# @param [String] data salmon slap xml or encrypted magic envelope json
|
193
|
+
# @param [Boolean] legacy true if it is a legacy salmon slap, false if it is a encrypted magic envelope json
|
136
194
|
# @return [Boolean] true if successful, false if the user was not found
|
137
195
|
#
|
138
|
-
#
|
196
|
+
# receive_entity
|
139
197
|
# After the xml was parsed and processed the gem calls this callback to persist the entity
|
140
198
|
# @param [DiasporaFederation::Entity] entity the received entity after processing
|
199
|
+
# @param [Object] recipient_id identifier for the recipient of private messages or nil for public,
|
200
|
+
# see {Receiver.receive_private}
|
201
|
+
#
|
202
|
+
# fetch_public_entity
|
203
|
+
# fetch a public entity from the database
|
204
|
+
# @param [String] entity_type (Post, StatusMessage, etc)
|
205
|
+
# @param [String] guid the guid of the entity
|
206
|
+
#
|
207
|
+
# fetch_person_url_to
|
208
|
+
# fetch the url to path for a person
|
209
|
+
# @param [String] diaspora_id
|
210
|
+
# @param [String] path
|
211
|
+
#
|
212
|
+
# update_pod
|
213
|
+
# Update the pod status
|
214
|
+
# @param [String] url the pod url
|
215
|
+
# @param [Symbol, Integer] status the error as {Symbol} or the http-status as {Integer} if it was :ok
|
141
216
|
#
|
142
217
|
# @see Callbacks#on
|
143
218
|
#
|
@@ -167,6 +242,8 @@ module DiasporaFederation
|
|
167
242
|
end
|
168
243
|
end
|
169
244
|
|
245
|
+
validate_http_config
|
246
|
+
|
170
247
|
unless @callbacks.definition_complete?
|
171
248
|
configuration_error "Missing handlers for #{@callbacks.missing_handlers.join(', ')}"
|
172
249
|
end
|
@@ -176,8 +253,16 @@ module DiasporaFederation
|
|
176
253
|
|
177
254
|
private
|
178
255
|
|
256
|
+
def validate_http_config
|
257
|
+
configuration_error "http_concurrency: please configure a number" unless @http_concurrency.is_a?(Fixnum)
|
258
|
+
configuration_error "http_timeout: please configure a number" unless @http_timeout.is_a?(Fixnum)
|
259
|
+
|
260
|
+
return unless !@http_verbose.is_a?(TrueClass) && !@http_verbose.is_a?(FalseClass)
|
261
|
+
configuration_error "http_verbose: please configure a boolean"
|
262
|
+
end
|
263
|
+
|
179
264
|
def configuration_error(message)
|
180
|
-
logger.fatal
|
265
|
+
logger.fatal "diaspora federation configuration error: #{message}"
|
181
266
|
raise ConfigurationError, message
|
182
267
|
end
|
183
268
|
end
|
@@ -40,7 +40,7 @@ module DiasporaFederation
|
|
40
40
|
|
41
41
|
def get(url, http_fallback=false)
|
42
42
|
logger.info "Fetching #{url} for #{diaspora_id}"
|
43
|
-
response =
|
43
|
+
response = HttpClient.get(url)
|
44
44
|
raise "Failed to fetch #{url}: #{response.status}" unless response.success?
|
45
45
|
response.body
|
46
46
|
rescue => e
|
@@ -47,7 +47,6 @@ module DiasporaFederation
|
|
47
47
|
|
48
48
|
# @!attribute [r] nickname
|
49
49
|
# the first part of the diaspora ID
|
50
|
-
# @see Entities::Person#diaspora_id
|
51
50
|
# @return [String] nickname
|
52
51
|
property :nickname
|
53
52
|
|
@@ -121,7 +120,7 @@ module DiasporaFederation
|
|
121
120
|
photo_small: ".entity_photo_small .photo[src]",
|
122
121
|
key: ".key",
|
123
122
|
searchable: ".searchable"
|
124
|
-
}
|
123
|
+
}.freeze
|
125
124
|
|
126
125
|
# Create the HTML string from the current HCard instance
|
127
126
|
# @return [String] HTML string
|
@@ -209,13 +208,13 @@ module DiasporaFederation
|
|
209
208
|
#
|
210
209
|
# @param container [Nokogiri::XML::Element] parent element for added property HTML
|
211
210
|
# @param name [Symbol] property name
|
212
|
-
# @
|
213
|
-
def add_property(container, name
|
211
|
+
# @yield [Nokogiri::HTML::Builder] html builder
|
212
|
+
def add_property(container, name)
|
214
213
|
Nokogiri::HTML::Builder.with(container) do |html|
|
215
214
|
html.dl(class: "entity_#{name}") {
|
216
215
|
html.dt(name.to_s.capitalize)
|
217
216
|
html.dd {
|
218
|
-
|
217
|
+
yield html
|
219
218
|
}
|
220
219
|
}
|
221
220
|
end
|
@@ -26,7 +26,7 @@ module DiasporaFederation
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# URL fragment to append to the base URL
|
29
|
-
WEBFINGER_SUFFIX = "/webfinger?q={uri}"
|
29
|
+
WEBFINGER_SUFFIX = "/webfinger?q={uri}".freeze
|
30
30
|
|
31
31
|
# Returns the WebFinger URL that was used to build this instance (either from
|
32
32
|
# xml or by giving a base URL).
|
@@ -104,35 +104,35 @@ module DiasporaFederation
|
|
104
104
|
property :public_key
|
105
105
|
|
106
106
|
# +hcard_url+ link relation
|
107
|
-
REL_HCARD = "http://microformats.org/profile/hcard"
|
107
|
+
REL_HCARD = "http://microformats.org/profile/hcard".freeze
|
108
108
|
|
109
109
|
# +seed_url+ link relation
|
110
|
-
REL_SEED = "http://joindiaspora.com/seed_location"
|
110
|
+
REL_SEED = "http://joindiaspora.com/seed_location".freeze
|
111
111
|
|
112
112
|
# @deprecated This should be a +Property+ or moved to the +hCard+, but +Link+
|
113
113
|
# is inappropriate according to the specification (will affect older
|
114
114
|
# Diaspora* installations).
|
115
115
|
# +guid+ link relation
|
116
|
-
REL_GUID = "http://joindiaspora.com/guid"
|
116
|
+
REL_GUID = "http://joindiaspora.com/guid".freeze
|
117
117
|
|
118
118
|
# +profile_url+ link relation.
|
119
119
|
# @note This might just as well be an +Alias+ instead of a +Link+.
|
120
|
-
REL_PROFILE = "http://webfinger.net/rel/profile-page"
|
120
|
+
REL_PROFILE = "http://webfinger.net/rel/profile-page".freeze
|
121
121
|
|
122
122
|
# +atom_url+ link relation
|
123
|
-
REL_ATOM = "http://schemas.google.com/g/2010#updates-from"
|
123
|
+
REL_ATOM = "http://schemas.google.com/g/2010#updates-from".freeze
|
124
124
|
|
125
125
|
# +salmon_url+ link relation
|
126
|
-
REL_SALMON = "salmon"
|
126
|
+
REL_SALMON = "salmon".freeze
|
127
127
|
|
128
128
|
# +subscribe_url+ link relation
|
129
|
-
REL_SUBSCRIBE = "http://ostatus.org/schema/1.0/subscribe"
|
129
|
+
REL_SUBSCRIBE = "http://ostatus.org/schema/1.0/subscribe".freeze
|
130
130
|
|
131
131
|
# @deprecated This should be a +Property+ or moved to the +hcard+, but +Link+
|
132
132
|
# is inappropriate according to the specification (will affect older
|
133
133
|
# Diaspora* installations).
|
134
134
|
# +pubkey+ link relation
|
135
|
-
REL_PUBKEY = "diaspora-public-key"
|
135
|
+
REL_PUBKEY = "diaspora-public-key".freeze
|
136
136
|
|
137
137
|
# Create the XML string from the current WebFinger instance
|
138
138
|
# @return [String] XML string
|
@@ -29,13 +29,13 @@ module DiasporaFederation
|
|
29
29
|
# @see http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html Extensible Resource Descriptor (XRD) Version 1.0
|
30
30
|
class XrdDocument
|
31
31
|
# xml namespace url
|
32
|
-
XMLNS = "http://docs.oasis-open.org/ns/xri/xrd-1.0"
|
32
|
+
XMLNS = "http://docs.oasis-open.org/ns/xri/xrd-1.0".freeze
|
33
33
|
|
34
34
|
# +Link+ element attributes
|
35
|
-
LINK_ATTRS = %i(rel type href template)
|
35
|
+
LINK_ATTRS = %i(rel type href template).freeze
|
36
36
|
|
37
37
|
# format string for datetime (+Expires+ element)
|
38
|
-
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
|
38
|
+
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ".freeze
|
39
39
|
|
40
40
|
# The <Expires> element contains a time value which specifies the instant at
|
41
41
|
# and after which the document has expired and SHOULD NOT be used.
|
@@ -67,7 +67,7 @@ module DiasporaFederation
|
|
67
67
|
# Generates an XML document from the current instance and returns it as string
|
68
68
|
# @return [String] XML document
|
69
69
|
def to_xml
|
70
|
-
|
70
|
+
Nokogiri::XML::Builder.new(encoding: "UTF-8") {|xml|
|
71
71
|
xml.XRD("xmlns" => XMLNS) {
|
72
72
|
xml.Expires(@expires.strftime(DATETIME_FORMAT)) if @expires.instance_of?(DateTime)
|
73
73
|
|
@@ -77,8 +77,7 @@ module DiasporaFederation
|
|
77
77
|
add_properties_to(xml)
|
78
78
|
add_links_to(xml)
|
79
79
|
}
|
80
|
-
|
81
|
-
builder.to_xml
|
80
|
+
}.to_xml
|
82
81
|
end
|
83
82
|
|
84
83
|
# Parse the XRD document from the given string and create a hash containing
|
@@ -108,7 +107,7 @@ module DiasporaFederation
|
|
108
107
|
|
109
108
|
private
|
110
109
|
|
111
|
-
NS = {xrd: XMLNS}
|
110
|
+
NS = {xrd: XMLNS}.freeze
|
112
111
|
|
113
112
|
def add_aliases_to(xml)
|
114
113
|
@aliases.each do |a|
|
@@ -8,23 +8,34 @@ module DiasporaFederation
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
# abstract types
|
12
|
+
require "diaspora_federation/entities/post"
|
11
13
|
require "diaspora_federation/entities/relayable"
|
14
|
+
|
15
|
+
# types
|
12
16
|
require "diaspora_federation/entities/profile"
|
13
17
|
require "diaspora_federation/entities/person"
|
14
|
-
require "diaspora_federation/entities/
|
15
|
-
require "diaspora_federation/entities/
|
16
|
-
|
17
|
-
require "diaspora_federation/entities/poll"
|
18
|
-
require "diaspora_federation/entities/status_message"
|
19
|
-
require "diaspora_federation/entities/request"
|
18
|
+
require "diaspora_federation/entities/contact"
|
19
|
+
require "diaspora_federation/entities/account_deletion"
|
20
|
+
|
20
21
|
require "diaspora_federation/entities/participation"
|
21
22
|
require "diaspora_federation/entities/like"
|
22
23
|
require "diaspora_federation/entities/comment"
|
23
|
-
require "diaspora_federation/entities/
|
24
|
+
require "diaspora_federation/entities/poll_answer"
|
25
|
+
require "diaspora_federation/entities/poll"
|
26
|
+
require "diaspora_federation/entities/poll_participation"
|
27
|
+
|
28
|
+
require "diaspora_federation/entities/location"
|
29
|
+
require "diaspora_federation/entities/photo"
|
30
|
+
require "diaspora_federation/entities/status_message"
|
31
|
+
require "diaspora_federation/entities/reshare"
|
32
|
+
|
24
33
|
require "diaspora_federation/entities/message"
|
25
34
|
require "diaspora_federation/entities/conversation"
|
26
|
-
|
27
|
-
require "diaspora_federation/entities/reshare"
|
35
|
+
|
28
36
|
require "diaspora_federation/entities/retraction"
|
37
|
+
|
38
|
+
# deprecated
|
39
|
+
require "diaspora_federation/entities/request"
|
29
40
|
require "diaspora_federation/entities/signed_retraction"
|
30
|
-
require "diaspora_federation/entities/
|
41
|
+
require "diaspora_federation/entities/relayable_retraction"
|
@@ -4,11 +4,15 @@ module DiasporaFederation
|
|
4
4
|
#
|
5
5
|
# @see Validators::AccountDeletionValidator
|
6
6
|
class AccountDeletion < Entity
|
7
|
-
# @!attribute [r]
|
7
|
+
# @!attribute [r] author
|
8
8
|
# The diaspora ID of the deleted account
|
9
|
-
# @see Person#
|
9
|
+
# @see Person#author
|
10
|
+
# @return [String] diaspora ID
|
11
|
+
# @!attribute [r] diaspora_id
|
12
|
+
# Alias for author
|
13
|
+
# @see AccountDeletion#author
|
10
14
|
# @return [String] diaspora ID
|
11
|
-
property :diaspora_id, xml_name: :diaspora_handle
|
15
|
+
property :author, alias: :diaspora_id, xml_name: :diaspora_handle
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
@@ -4,11 +4,9 @@ module DiasporaFederation
|
|
4
4
|
#
|
5
5
|
# @see Validators::CommentValidator
|
6
6
|
class Comment < Entity
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
# @return [String] comment guid
|
11
|
-
property :guid
|
7
|
+
# old signature order
|
8
|
+
# @deprecated
|
9
|
+
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid text author).freeze
|
12
10
|
|
13
11
|
include Relayable
|
14
12
|
|
@@ -16,11 +14,16 @@ module DiasporaFederation
|
|
16
14
|
# @return [String] the comment text
|
17
15
|
property :text
|
18
16
|
|
19
|
-
# @!attribute [r]
|
20
|
-
#
|
21
|
-
# @
|
22
|
-
|
23
|
-
|
17
|
+
# @!attribute [r] created_at
|
18
|
+
# comment entity creation time
|
19
|
+
# @return [Time] creation time
|
20
|
+
property :created_at, default: -> { Time.now.utc }
|
21
|
+
|
22
|
+
# The {Comment} parent is a Post
|
23
|
+
# @return [String] parent type
|
24
|
+
def parent_type
|
25
|
+
"Post"
|
26
|
+
end
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|