diaspora_federation 0.2.4 → 0.2.5

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
- SHA1:
3
- metadata.gz: af0fdb0f1947dce9a20099a76921b58ad265032c
4
- data.tar.gz: 45a617bd5cf74ccbba10a73372c5b8aad8ec5e55
2
+ SHA256:
3
+ metadata.gz: 35131d74a51b0fc8445843fb59db5f48f964d7462f892d4c1324eaaa34ad927d
4
+ data.tar.gz: dcc6e003cffe457597d42a0659fc85a52355834f966ca05ccef8cafae57a42dd
5
5
  SHA512:
6
- metadata.gz: 044a46b0f3d099863f7d7a6496bcdefa54a63c58689563a4fc74d96d42bcc49cb340089821836342a1c1801c7797ad4b8a926976299235dc5722499e95f92969
7
- data.tar.gz: 392b7a4b746d01ab534a9ea164c956a3b2cbea6817489baf3829d253caae3dee979f260755b9b1a7ebbb546bfb76d4fd62cea80c460fe0be06639e9035ba710f
6
+ metadata.gz: ae87265e272332d979019e06c2bcade0bed570da326213efc5ddc3f7a5c3c4dac573d0bdf7b0836827cd68325ecde557fc959daa55b647e71cc07cc28d48d79b
7
+ data.tar.gz: 56c39d7011b5c8ed4e10270682cf9d7ed57b3765e8dbee6d1fd3d2a55630fe9c804eb1ac47147771ea2ce5730805ba8cdb7408dd950ba60c824e35abbed200d6
@@ -1,3 +1,19 @@
1
+ # 0.2.5
2
+
3
+ ## Features
4
+
5
+ * Add `full_name` to `Profile` entity [#100](https://github.com/diaspora/diaspora_federation/pull/100)
6
+ * Add `Embed` entity [#101](https://github.com/diaspora/diaspora_federation/pull/101)
7
+
8
+ ## Refactor
9
+
10
+ * Include `web+` prefix in `diaspora://` URL parsing [#108](https://github.com/diaspora/diaspora_federation/pull/108)
11
+
12
+ ## Bug fixes
13
+
14
+ * Various bug fixes in the `federation_entities.json` [#102](https://github.com/diaspora/diaspora_federation/pull/102) [#104](https://github.com/diaspora/diaspora_federation/pull/104) [#107](https://github.com/diaspora/diaspora_federation/pull/107)
15
+ * Allow fetching of entities with dot in the GUID [#106](https://github.com/diaspora/diaspora_federation/pull/106)
16
+
1
17
  # 0.2.4
2
18
 
3
19
  ## Features
data/README.md CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  [![Code Climate](https://codeclimate.com/github/diaspora/diaspora_federation/badges/gpa.svg)](https://codeclimate.com/github/diaspora/diaspora_federation)
8
8
  [![Test Coverage](https://codeclimate.com/github/diaspora/diaspora_federation/badges/coverage.svg)](https://codeclimate.com/github/diaspora/diaspora_federation/coverage)
9
- [![Dependency Status](https://gemnasium.com/diaspora/diaspora_federation.svg)](https://gemnasium.com/diaspora/diaspora_federation)
10
9
  [![Inline docs](https://inch-ci.org/github/diaspora/diaspora_federation.svg?branch=master)](https://inch-ci.org/github/diaspora/diaspora_federation)
11
10
  [![Gem Version](https://badge.fury.io/rb/diaspora_federation.svg)](https://badge.fury.io/rb/diaspora_federation)
12
11
 
@@ -38,25 +37,31 @@ Configure the engine in ```config/initializers/diaspora_federation.rb```:
38
37
  ```ruby
39
38
  DiasporaFederation.configure do |config|
40
39
  # the pod url
41
- config.server_uri = AppConfig.pod_uri
40
+ config.server_uri = URI("http://localhost:3000")
41
+
42
+ # ... other settings
42
43
 
43
44
  config.define_callbacks do
44
45
  on :fetch_person_for_webfinger do |diaspora_id|
45
46
  person = Person.find_local_by_diaspora_id(diaspora_id)
46
47
  if person
47
48
  DiasporaFederation::Discovery::WebFinger.new(
48
- # ...
49
+ # ... copy person attributes to WebFinger object
49
50
  )
50
51
  end
51
52
  end
52
53
 
53
54
  on :fetch_person_for_hcard do |guid|
54
- # ...
55
+ # ... fetch hcard information
55
56
  end
57
+
58
+ # ... other callbacks
56
59
  end
57
60
  end
58
61
  ```
59
62
 
63
+ The available config settings can be found [here](https://www.rubydoc.info/gems/diaspora_federation/DiasporaFederation#class_attr_details) and the callbacks are listed [here](https://www.rubydoc.info/gems/diaspora_federation/DiasporaFederation#define_callbacks-class_method) in the gem documentation.
64
+
60
65
  ## Contributing
61
66
 
62
67
  See [our contribution guide](/CONTRIBUTING.md) for more information on how to contribute to the diaspora\* federation library.
@@ -1,4 +1,3 @@
1
-
2
1
  module DiasporaFederation
3
2
  module Discovery
4
3
  # Generates and parses Host Meta documents.
@@ -30,6 +30,7 @@ require "diaspora_federation/entities/poll_answer"
30
30
  require "diaspora_federation/entities/poll"
31
31
  require "diaspora_federation/entities/poll_participation"
32
32
 
33
+ require "diaspora_federation/entities/embed"
33
34
  require "diaspora_federation/entities/location"
34
35
 
35
36
  require "diaspora_federation/entities/event"
@@ -0,0 +1,44 @@
1
+ module DiasporaFederation
2
+ module Entities
3
+ # This entity is used to specify embed information about an URL that should be embedded.
4
+ #
5
+ # @see Validators::EmbedValidator
6
+ class Embed < Entity
7
+ # @!attribute [r] url
8
+ # URL that should be embedded.
9
+ # @return [String] url
10
+ property :url, :string, optional: true
11
+
12
+ # @!attribute [r] title
13
+ # The title of the embedded URL.
14
+ # @return [String] title
15
+ property :title, :string, optional: true
16
+
17
+ # @!attribute [r] description
18
+ # The description of the embedded URL.
19
+ # @return [String] description
20
+ property :description, :string, optional: true
21
+
22
+ # @!attribute [r] image
23
+ # The image of the embedded URL.
24
+ # @return [String] image
25
+ property :image, :string, optional: true
26
+
27
+ # @!attribute [r] nothing
28
+ # True, if nothing should be embedded.
29
+ # @return [String] nothing
30
+ property :nothing, :boolean, optional: true
31
+
32
+ # @return [String] string representation of this object
33
+ def to_s
34
+ "Embed#{":#{url}" if url}"
35
+ end
36
+
37
+ def validate
38
+ super
39
+
40
+ raise ValidationError, "Either 'url' must be set or 'nothing' must be 'true'" unless nothing ^ url
41
+ end
42
+ end
43
+ end
44
+ end
@@ -19,6 +19,10 @@ module DiasporaFederation
19
19
  # @return [Time] edited time
20
20
  property :edited_at, :timestamp, optional: true
21
21
 
22
+ # @!attribute [r] full_name
23
+ # @return [String] display name of the user
24
+ property :full_name, :string, optional: true
25
+
22
26
  # @!attribute [r] first_name
23
27
  # @deprecated We decided to only use one name field, these should be removed
24
28
  # in later iterations (will affect older diaspora* installations).
@@ -36,6 +36,11 @@ module DiasporaFederation
36
36
  # @return [Entities::Event] event
37
37
  entity :event, Entities::Event, optional: true
38
38
 
39
+ # @!attribute [r] embed
40
+ # Optional embed information of an URL that should be embedded in the status message
41
+ # @return [Entities::Embed] embed
42
+ entity :embed, Entities::Embed, optional: true
43
+
39
44
  private
40
45
 
41
46
  def validate
@@ -6,7 +6,7 @@ module DiasporaFederation
6
6
 
7
7
  # Regex to find diaspora:// URLs
8
8
  DIASPORA_URL_REGEX = %r{
9
- diaspora://
9
+ (?:web\+)?diaspora://
10
10
  (#{Validation::Rule::DiasporaId::DIASPORA_ID_REGEX})/
11
11
  (#{Entity::ENTITY_NAME_REGEX})/
12
12
  (#{Validation::Rule::Guid::VALID_CHARS})
@@ -19,7 +19,7 @@ module DiasporaFederation
19
19
  # @param [String] iv AES initialization vector
20
20
  # @return [String] base64 encoded ciphertext
21
21
  # @raise [ArgumentError] if any of the arguments is missing or not the correct type
22
- def self.encrypt(data, key, iv)
22
+ def self.encrypt(data, key, iv) # rubocop:disable Naming/UncommunicativeMethodParamName
23
23
  raise ArgumentError unless data.instance_of?(String) &&
24
24
  key.instance_of?(String) &&
25
25
  iv.instance_of?(String)
@@ -41,7 +41,7 @@ module DiasporaFederation
41
41
  # @param [String] iv AES initialization vector
42
42
  # @return [String] decrypted plain message
43
43
  # @raise [ArgumentError] if any of the arguments is missing or not the correct type
44
- def self.decrypt(ciphertext, key, iv)
44
+ def self.decrypt(ciphertext, key, iv) # rubocop:disable Naming/UncommunicativeMethodParamName
45
45
  raise ArgumentError unless ciphertext.instance_of?(String) &&
46
46
  key.instance_of?(String) &&
47
47
  iv.instance_of?(String)
@@ -46,6 +46,7 @@ require "diaspora_federation/validators/account_migration_validator"
46
46
  require "diaspora_federation/validators/comment_validator"
47
47
  require "diaspora_federation/validators/contact_validator"
48
48
  require "diaspora_federation/validators/conversation_validator"
49
+ require "diaspora_federation/validators/embed_validator"
49
50
  require "diaspora_federation/validators/event_participation_validator"
50
51
  require "diaspora_federation/validators/event_validator"
51
52
  require "diaspora_federation/validators/h_card_validator"
@@ -0,0 +1,13 @@
1
+ module DiasporaFederation
2
+ module Validators
3
+ # This validates a {Entities::Embed}.
4
+ class EmbedValidator < OptionalAwareValidator
5
+ include Validation
6
+
7
+ rule :url, :URI
8
+ rule :title, length: {maximum: 255}
9
+ rule :description, length: {maximum: 65_535}
10
+ rule :image, URI: %i[host path]
11
+ end
12
+ end
13
+ end
@@ -8,6 +8,7 @@ module DiasporaFederation
8
8
 
9
9
  # The name must not contain a semicolon because of mentions.
10
10
  # @{<full_name> ; <diaspora_id>}
11
+ rule :full_name, regular_expression: {regex: /\A[^;]{,70}\z/}
11
12
  rule :first_name, regular_expression: {regex: /\A[^;]{,32}\z/}
12
13
  rule :last_name, regular_expression: {regex: /\A[^;]{,32}\z/}
13
14
 
@@ -1,4 +1,4 @@
1
1
  module DiasporaFederation
2
2
  # the gem version
3
- VERSION = "0.2.4".freeze
3
+ VERSION = "0.2.5".freeze
4
4
  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.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Neff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-18 00:00:00.000000000 Z
11
+ date: 2018-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.9.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.15.0
22
+ version: 0.16.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.9.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 0.15.0
32
+ version: 0.16.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday_middleware
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -126,6 +126,7 @@ files:
126
126
  - lib/diaspora_federation/entities/comment.rb
127
127
  - lib/diaspora_federation/entities/contact.rb
128
128
  - lib/diaspora_federation/entities/conversation.rb
129
+ - lib/diaspora_federation/entities/embed.rb
129
130
  - lib/diaspora_federation/entities/event.rb
130
131
  - lib/diaspora_federation/entities/event_participation.rb
131
132
  - lib/diaspora_federation/entities/like.rb
@@ -182,6 +183,7 @@ files:
182
183
  - lib/diaspora_federation/validators/comment_validator.rb
183
184
  - lib/diaspora_federation/validators/contact_validator.rb
184
185
  - lib/diaspora_federation/validators/conversation_validator.rb
186
+ - lib/diaspora_federation/validators/embed_validator.rb
185
187
  - lib/diaspora_federation/validators/event_participation_validator.rb
186
188
  - lib/diaspora_federation/validators/event_validator.rb
187
189
  - lib/diaspora_federation/validators/h_card_validator.rb
@@ -231,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
233
  version: '0'
232
234
  requirements: []
233
235
  rubyforge_project:
234
- rubygems_version: 2.6.14
236
+ rubygems_version: 2.7.7
235
237
  signing_key:
236
238
  specification_version: 4
237
239
  summary: diaspora* federation library