summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--create.rb7
-rw-r--r--helpers.rb2
-rw-r--r--server.rb1
3 files changed, 9 insertions, 1 deletions
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), "<a href=\"#{Regexp.last_match(0)}\">#{Regexp.last_match(0)}</a>")
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, "<a href=\"#{tag_url}\">#{name}</a>")
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, "<a href=\"#{actor}\">#{mention}</a>")
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
)