From 25bdc789215c728e6fac04404adcf1f8e4bcdd78 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Sun, 30 Jul 2023 01:27:51 +0200 Subject: html links for outbox notes --- create.rb | 7 +++++++ helpers.rb | 2 +- server.rb | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/create.rb b/create.rb index d986812..301417f 100644 --- a/create.rb +++ b/create.rb @@ -40,6 +40,9 @@ post '/create' do # TODO } end break + elsif line.match(url_regexp) + # single quotes in html invalidate digest, reason unknown + content << line.gsub(Regexp.last_match(0), "#{Regexp.last_match(0)}") else tags = line.split(/\s+/).grep(hashtag_regexp) tags.each do |name| @@ -49,6 +52,8 @@ post '/create' do # TODO 'href' => tag_url, 'name' => name } + # single quotes in html invalidate digest, reason unknown + line.gsub!(name, "#{name}") end mentions = line.split(/\s+/).grep(mention_regexp) mentions.each do |mention| @@ -58,6 +63,8 @@ post '/create' do # TODO 'href' => actor, 'name' => mention } + # single quotes in html invalidate digest, reason unknown + line.gsub!(mention, "#{mention}") end content << line end diff --git a/helpers.rb b/helpers.rb index 7a56ec1..4940b34 100644 --- a/helpers.rb +++ b/helpers.rb @@ -11,7 +11,7 @@ helpers do activity_rel_path = File.join(activity['type'].downcase, basename) activity_path = File.join(box[:dir], activity_rel_path) if box == OUTBOX - return unless activity['to'].include? 'https://www.w3.org/ns/activitystreams#Public' # save only public messages + # return unless activity['to'].include? 'https://www.w3.org/ns/activitystreams#Public' # save only public messages activity['id'] = File.join(box[:url], activity_rel_path) activity['object']['published'] = date unless activity['object'].is_a? String diff --git a/server.rb b/server.rb index 5dfc53e..fd14356 100644 --- a/server.rb +++ b/server.rb @@ -173,6 +173,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}\"" + # Net::HTTP fails with OpenSSL error curl( "-X POST -H 'Host: #{uri.host}' -H 'Date: #{httpdate}' -H 'Digest: #{digest}' -H 'Signature: #{signed_header}' --data-raw '#{body}'", inbox ) -- cgit v1.2.3