From 5fe421046e18411418a38233e308a4e63b5be6e1 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Tue, 12 Jul 2022 23:00:08 -0500 Subject: Specify payload file using CLI arg for deliver.rb --- comment | 13 +++++++++++++ deliver.rb | 4 +++- message | 13 ------------- 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 comment mode change 100644 => 100755 deliver.rb delete mode 100644 message diff --git a/comment b/comment new file mode 100644 index 0000000..9742796 --- /dev/null +++ b/comment @@ -0,0 +1,13 @@ +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Note", + "attributedTo": "https://test.exozy.me/api/v1/activitypub/user/test", + "context": "https://git.exozy.me/Ta180m/Hello-world/issues/2", + "inReplyTo": "https://git.exozy.me/Ta180m/Hello-world/issues/2", + "mediaType": "text/html", + "content": "

Hello from test.exozy.me!

", + "source": { + "mediaType": "text/markdown; variant=Commonmark", + "content": "Hello from test.exozy.me!" + } +} diff --git a/deliver.rb b/deliver.rb old mode 100644 new mode 100755 index b54de2d..c3f04ce --- a/deliver.rb +++ b/deliver.rb @@ -1,9 +1,11 @@ +#!/usr/bin/ruby + # https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/ require 'http' require 'openssl' -document = File.read('message') +document = File.read(ARGV[0]) date = Time.now.utc.httpdate keypair = OpenSSL::PKey::RSA.new(File.read('private.pem')) signed_string = "(request-target): post /inbox\nhost: git.exozy.me\ndate: #{date}" diff --git a/message b/message deleted file mode 100644 index 9742796..0000000 --- a/message +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@context": "https://www.w3.org/ns/activitystreams", - "type": "Note", - "attributedTo": "https://test.exozy.me/api/v1/activitypub/user/test", - "context": "https://git.exozy.me/Ta180m/Hello-world/issues/2", - "inReplyTo": "https://git.exozy.me/Ta180m/Hello-world/issues/2", - "mediaType": "text/html", - "content": "

Hello from test.exozy.me!

", - "source": { - "mediaType": "text/markdown; variant=Commonmark", - "content": "Hello from test.exozy.me!" - } -} -- cgit v1.2.3-70-g09d2