mirror of
https://github.com/mastodon/mastodon.git
synced 2025-10-05 16:42:47 +00:00
22 lines
452 B
Ruby
22 lines
452 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::Parser::PreviewCardParser
|
|
include JsonLdHelper
|
|
|
|
def initialize(json)
|
|
@json = json
|
|
end
|
|
|
|
# @param [PreviewCard] previous_record
|
|
def significantly_changes?(previous_record)
|
|
url != previous_record.url
|
|
end
|
|
|
|
def url
|
|
url = Addressable::URI.parse(@json['href'])&.normalize&.to_s
|
|
url unless unsupported_uri_scheme?(url)
|
|
rescue Addressable::URI::InvalidURIError
|
|
nil
|
|
end
|
|
end
|