sources: add image_url?, page_url?, and profile_url? methods.
Add methods to Source::URL for determining whether a URL is an image URL, a page URL, or a profile URL. Also add more source URL tests and fix various URL parsing bugs.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
# * https://foundation.app/collection/kgfgen
|
||||
|
||||
class Source::URL::Foundation < Source::URL
|
||||
attr_reader :username, :token_id, :work_id, :hash
|
||||
attr_reader :username, :user_id, :token_id, :work_id, :hash
|
||||
|
||||
IMAGE_HOSTS = %w[assets.foundation.app f8n-ipfs-production.imgix.net f8n-production-collection-assets.imgix.net d2ybmb80bbm9ts.cloudfront.net]
|
||||
|
||||
@@ -69,6 +69,10 @@ class Source::URL::Foundation < Source::URL
|
||||
end
|
||||
end
|
||||
|
||||
def image_url?
|
||||
host.in?(IMAGE_HOSTS)
|
||||
end
|
||||
|
||||
def profile_url
|
||||
if username.present?
|
||||
"https://foundation.app/@#{username}"
|
||||
|
||||
Reference in New Issue
Block a user