mirror of
https://github.com/mastodon/mastodon.git
synced 2026-07-28 17:27:26 -05: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
|