summaryrefslogtreecommitdiff
path: root/activitypub.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-06-04 09:56:44 +0200
committerpdp8 <pdp8@pdp8.info>2023-06-04 09:56:44 +0200
commit74378829ebe3da4d339bdff37a00675bfc12118f (patch)
tree2182bff3475d7065f565954442b41ce6924ce642 /activitypub.rb
parentc727922afd124ae59e05b2da56634a271863f8af (diff)
css, wait updates
Diffstat (limited to 'activitypub.rb')
-rw-r--r--activitypub.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/activitypub.rb b/activitypub.rb
index 05ed6e0..ab42c4f 100644
--- a/activitypub.rb
+++ b/activitypub.rb
@@ -20,6 +20,10 @@ ACCOUNT = "#{USER}@#{SOCIAL_DOMAIN}"
SOCIAL_URL = "https://#{SOCIAL_DOMAIN}"
ACTOR = File.join(SOCIAL_URL, USER)
+#OpenSSL::SSL::SSLContext::DEFAULT_PARAMS = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.merge(
+ #options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] + OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF
+#).freeze
+
enable :sessions
set :session_secret, File.read(".secret").chomp
set :default_content_type, 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
@@ -34,7 +38,7 @@ end
post "/inbox" do # server-server
request.body.rewind # in case someone already read it
body = request.body.read
- p body
+ #p body
action = JSON.parse body
case action["type"]
@@ -55,7 +59,7 @@ post "/inbox" do # server-server
"id" => File.join(SOCIAL_URL + "#accepts", SecureRandom.uuid),
"type" => "Accept",
"actor" => ACTOR,
- "object" => action["object"] }
+ "object" => action }
send_signed accept, action["actor"]
when "Undo"
@@ -67,8 +71,8 @@ post "/inbox" do # server-server
end
end
- else
- p body
+ #else
+ #p body
end
end
@@ -77,7 +81,7 @@ post "/outbox" do # client-server
request.body.rewind # in case someone already read it
body = request.body.read
date = Time.now.strftime("%Y-%m-%dT%H:%M:%S")
- # TODO media attachments, hashtags
+ # TODO hashtags, replys
outbox_path = File.join("public/outbox", date + ".json")
object_path = File.join("public/objects", date + ".json")
create = {
@@ -126,7 +130,6 @@ post "/follow/*" do
protected!
mention = params['splat'][0]
actor = actor(mention)
- p actor
following_path = File.join("public", "following", mention + ".json")
follow = { "@context" => "https://www.w3.org/ns/activitystreams",
"id" => File.join(SOCIAL_URL, following_path),
@@ -171,7 +174,6 @@ end
get "/inbox", :provides => 'html' do
protected!
@inbox = Dir['./inbox/*'].sort
- p @inbox
erb :inbox
end
@@ -250,13 +252,11 @@ def send_signed object, url
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = body
+ p uri, body
http.request(request)
end
def inbox uri
- p "INBOX"
- p uri
- p get(uri)
URI(get(uri)["inbox"]).request_uri
end