summaryrefslogtreecommitdiff
path: root/helpers.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-09-24 12:28:40 +0200
committerpdp8 <pdp8@pdp8.info>2023-09-24 12:28:40 +0200
commit6100f9971b74ee4d3449155beb881a69017a296d (patch)
treebd2511b705847add76ea952ab6dd17aa1c0068c6 /helpers.rb
parent4dabdfb47154014f491462b026882102b5e668e3 (diff)
undo reactivated, object names without published date, find_object helper
Diffstat (limited to 'helpers.rb')
-rw-r--r--helpers.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/helpers.rb b/helpers.rb
index 536a7c6..0a7f829 100644
--- a/helpers.rb
+++ b/helpers.rb
@@ -80,7 +80,6 @@ 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
@@ -204,8 +203,14 @@ helpers do
def find_file(id)
Dir[File.join('*', 'object', '*', '*.json')].find do |f|
- # Dir[File.join('*box', '**', '*.json')].find do |f|
JSON.load_file(f)['id'] == id
end
end
+
+ def find_object(id)
+ Dir[File.join('*', '**', '*.json')].each do |file|
+ object = JSON.load_file(file)
+ return [file, object] if object['id'] == id
+ end
+ end
end