diaspora_federation 0.0.4 → 0.0.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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6f8165c74d07b264d4640c1c7cb2178683ca2e4
|
4
|
+
data.tar.gz: 816f20ba2c9153d90e842eafad3bb142d92e08cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00875c9f376ab19ff864b186ef930328616b488979cbbc5347392e0fc6560aba9910353606a91ae17a83daaaa870fd977e0ac4fb087604b90f52801f72e649c4
|
7
|
+
data.tar.gz: 244808bf9d7432b323559e65efe2454ff90c31cbb08ea18ad61e63b6908d70e0c59140836f850eb70e8cee2e24586a4c56745f06b47034c2c7281fc72d2868c4
|
data/lib/diaspora_federation.rb
CHANGED
@@ -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
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
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
|