Add conversation-based forwarding for limited visibility statuses through bearcaps

This commit is contained in:
Eugen Rochko 2020-08-26 03:16:47 +02:00
parent 52157fdcba
commit 7cd4ed7d42
26 changed files with 430 additions and 78 deletions

View file

@ -49,13 +49,12 @@ module JsonLdHelper
!uri.start_with?('http://', 'https://')
end
def same_origin?(url_a, url_b)
Addressable::URI.parse(url_a).host.casecmp(Addressable::URI.parse(url_b).host).zero?
end
def invalid_origin?(url)
return true if unsupported_uri_scheme?(url)
needle = Addressable::URI.parse(url).host
haystack = Addressable::URI.parse(@account.uri).host
!haystack.casecmp(needle).zero?
unsupported_uri_scheme?(url) || !same_origin?(url, @account.uri)
end
def canonicalize(json)