summaryrefslogtreecommitdiff
path: root/post.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-04-23 19:26:00 +0200
committerpdp8 <pdp8@pdp8.info>2023-04-23 19:26:00 +0200
commit79e3bf726b7166c5ec641ea02b75f82a74f31698 (patch)
tree2e68564452dc206e5845758bc8e352d7a1e31f3c /post.rb
parentb2b88253f5cc4221b01ed860b02ae156941e03ce (diff)
inbox/outbox GET
Diffstat (limited to 'post.rb')
-rwxr-xr-xpost.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/post.rb b/post.rb
index ed7a964..c5e7cd7 100755
--- a/post.rb
+++ b/post.rb
@@ -6,7 +6,21 @@ require 'base64'
require 'net/http'
require 'uri'
-document = { "a" => 2 } # .to_json
+# document = { "a" => 2 } # .to_json
+document = {
+ "@context": "https://www.w3.org/ns/activitystreams",
+ "type": "Like",
+ "actor": "https://example.net/~mallory",
+ "to": ["https://hatchat.example/sarah/",
+ "https://example.com/peeps/john/"],
+ "object": {
+ "@context": { "@language": "en" },
+ "id": "https://example.org/~alice/note/23",
+ "type": "Note",
+ "attributedTo": "https://example.org/~alice",
+ "content": "I'm a goat"
+ }
+}
date = Time.now.utc.httpdate
keypair = OpenSSL::PKey::RSA.new(File.read('private.pem'))
signed_string = "(request-target): post /inbox\nhost: social.pdp8.info\ndate: #{date}"
@@ -19,6 +33,7 @@ http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
header = {
+ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'Host' => 'social.pdp8.info',
'Date' => date,
'Signature' => signed_header,