diff options
-rw-r--r-- | create.rb | 7 | ||||
-rw-r--r-- | helpers.rb | 2 | ||||
-rw-r--r-- | server.rb | 1 |
3 files changed, 9 insertions, 1 deletions
@@ -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 @@ -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 @@ -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 ) |