From 44967ae9f605ca37b6d88e4e8b11a9cf1fdc2b57 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Thu, 14 Sep 2023 20:20:26 +0200 Subject: note objects fixed, verify reactivated --- helpers.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'helpers.rb') diff --git a/helpers.rb b/helpers.rb index 89ce7d4..536a7c6 100644 --- a/helpers.rb +++ b/helpers.rb @@ -17,8 +17,6 @@ helpers do 'to' => to, 'object' => object } - activity_path = File.join(OUTBOX[:dir], rel_path) - save_item activity, activity_path unless activity['object'].is_a? String object_rel_path = File.join('object', object['type'].downcase, "#{date}.json") @@ -51,6 +49,8 @@ helpers do end end end + activity_path = File.join(OUTBOX[:dir], rel_path) + save_item activity, activity_path send_activity activity, activity_path end @@ -80,6 +80,7 @@ helpers do signature = Base64.strict_encode64(keypair.sign(OpenSSL::Digest.new('SHA256'), string)) signed_header = "keyId=\"#{ACTOR}#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"#{signature}\"" + p inbox # Net::HTTP fails with OpenSSL error curl( "-X POST -H 'Host: #{uri.host}' -H 'Date: #{httpdate}' -H 'Digest: #{digest}' -H 'Signature: #{signed_header}' --data-binary '@#{activity_path}'", inbox @@ -207,13 +208,4 @@ helpers do JSON.load_file(f)['id'] == id end end - - # def find_id(id, return_filename = true) - # Dir[File.join('**', '*.json')].find do |f| - # content = JSON.load_file(f) - # if content['id'] == id - # return_filename ? f : content - # end - # end - # end end -- cgit v1.2.3