Improve Friendica support (but still not there yet)

This commit is contained in:
Eugen Rochko 2016-10-12 21:07:00 +02:00
parent 160b5148ec
commit 64302b3c99
2 changed files with 4 additions and 13 deletions

View file

@ -107,7 +107,7 @@ GEM
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
globalid (0.3.7) globalid (0.3.7)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
goldfinger (1.0.5) goldfinger (1.1.0)
addressable (~> 2.4) addressable (~> 2.4)
http (~> 2.0) http (~> 2.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
@ -172,7 +172,7 @@ GEM
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
oj (2.17.3) oj (2.17.3)
orm_adapter (0.5.0) orm_adapter (0.5.0)
ostatus2 (0.3.2) ostatus2 (1.0.1)
addressable (~> 2.4) addressable (~> 2.4)
http (~> 2.0) http (~> 2.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)

View file

@ -1,4 +1,6 @@
class FollowRemoteAccountService < BaseService class FollowRemoteAccountService < BaseService
include OStatus2::MagicKey
# Find or create a local account for a remote user. # Find or create a local account for a remote user.
# When creating, look up the user's webfinger and fetch all # When creating, look up the user's webfinger and fetch all
# important information from their feed # important information from their feed
@ -57,17 +59,6 @@ class FollowRemoteAccountService < BaseService
update_remote_profile_service.call(author, account) update_remote_profile_service.call(author, account)
end end
def magic_key_to_pem(magic_key)
_, modulus, exponent = magic_key.split('.')
modulus, exponent = [modulus, exponent].map { |n| Base64.urlsafe_decode64(n).bytes.inject(0) { |a, e| (a << 8) | e } }
key = OpenSSL::PKey::RSA.new
key.n = modulus
key.e = exponent
key.to_pem
end
def update_remote_profile_service def update_remote_profile_service
@update_remote_profile_service ||= UpdateRemoteProfileService.new @update_remote_profile_service ||= UpdateRemoteProfileService.new
end end