diaspora_federation 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c09fc18228d8f509ac6ee451d3f86514112cc959
4
- data.tar.gz: 7176641baf249258ad914643fb3d0ed07121e481
3
+ metadata.gz: a6f8165c74d07b264d4640c1c7cb2178683ca2e4
4
+ data.tar.gz: 816f20ba2c9153d90e842eafad3bb142d92e08cd
5
5
  SHA512:
6
- metadata.gz: fb127f2108104ba7a3191af13f2620b8f308df88a67671d488a2f61243c4e04cc11e5f5eb1d31fe5ffda66dee7c35f10d8e6ed5edc995e20b966241f537c1517
7
- data.tar.gz: 0b8222a2035a70e4b92f2d599ef0d5ab34c7a17a3ad7b811f203f86e956f80c849ddab90a555b911d50db095c8346b6ab185f95b492b3ecf7b999d47c4cbd244
6
+ metadata.gz: 00875c9f376ab19ff864b186ef930328616b488979cbbc5347392e0fc6560aba9910353606a91ae17a83daaaa870fd977e0ac4fb087604b90f52801f72e649c4
7
+ data.tar.gz: 244808bf9d7432b323559e65efe2454ff90c31cbb08ea18ad61e63b6908d70e0c59140836f850eb70e8cee2e24586a4c56745f06b47034c2c7281fc72d2868c4
@@ -77,9 +77,11 @@ module DiasporaFederation
77
77
  def validate_config
78
78
  configuration_error "server_uri: Missing or invalid" unless @server_uri.respond_to? :host
79
79
 
80
- configuration_error "certificate_authorities: Not configured" if @certificate_authorities.nil?
81
- unless File.file? @certificate_authorities
82
- configuration_error "certificate_authorities: File not found: #{@certificate_authorities}"
80
+ unless defined?(::Rails) && !::Rails.env.production?
81
+ configuration_error "certificate_authorities: Not configured" if @certificate_authorities.nil?
82
+ unless File.file? @certificate_authorities
83
+ configuration_error "certificate_authorities: File not found: #{@certificate_authorities}"
84
+ end
83
85
  end
84
86
 
85
87
  unless @callbacks.definition_complete?
@@ -18,10 +18,7 @@ module DiasporaFederation
18
18
  def fetch_and_save
19
19
  logger.info "Fetch data for #{diaspora_id}"
20
20
 
21
- unless diaspora_id == clean_diaspora_id(webfinger.acct_uri)
22
- raise DiscoveryError, "Diaspora ID does not match: Wanted #{diaspora_id} but got" \
23
- " #{clean_diaspora_id(webfinger.acct_uri)}"
24
- end
21
+ validate_diaspora_id
25
22
 
26
23
  DiasporaFederation.callbacks.trigger(:save_person_after_webfinger, person)
27
24
  logger.info "successfully webfingered #{diaspora_id}"
@@ -30,6 +27,13 @@ module DiasporaFederation
30
27
 
31
28
  private
32
29
 
30
+ def validate_diaspora_id
31
+ # validates if the diaspora ID matches the diaspora ID in the webfinger response
32
+ return if diaspora_id == clean_diaspora_id(webfinger.acct_uri)
33
+ raise DiscoveryError, "Diaspora ID does not match: Wanted #{diaspora_id} but got" \
34
+ " #{clean_diaspora_id(webfinger.acct_uri)}"
35
+ end
36
+
33
37
  def clean_diaspora_id(diaspora_id)
34
38
  diaspora_id.strip.sub("acct:", "").to_s.downcase
35
39
  end
@@ -1,4 +1,4 @@
1
1
  module DiasporaFederation
2
2
  # the gem version
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diaspora_federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Neff