posts: automatically add the bad_link and bad_source tags.
Automatically add the bad_link tag when the source is an image url from a known site, but it can't be converted to a page url (for example, a Twitter or Tumblr direct image link). Automatically add the bad_source tag when the source is from a known site, but it's not an image or page url (for example, a Twitter or Pixiv profile url)
This commit is contained in:
@@ -9,6 +9,14 @@
|
||||
# To add a new site, create a subclass of Source::URL and implement `#match?` to define
|
||||
# which URLs belong to the site, and `#parse` to parse and extract information from the URL.
|
||||
#
|
||||
# The following methods should be implemented by subclasses:
|
||||
#
|
||||
# * match?
|
||||
# * parse
|
||||
# * image_url?
|
||||
# * page_url
|
||||
# * profile_url
|
||||
#
|
||||
# Source::URL is a subclass of Danbooru::URL, so it inherits some common utility methods
|
||||
# from there.
|
||||
#
|
||||
@@ -87,6 +95,13 @@ module Source
|
||||
self.class.name.demodulize.titleize
|
||||
end
|
||||
|
||||
# True if the URL is from a recognized site. False if the URL is from an unrecognized site.
|
||||
#
|
||||
# @return [Boolean]
|
||||
def recognized?
|
||||
true # overridden in Source::URL::Null to return false for unknown sites
|
||||
end
|
||||
|
||||
# True if the URL is a direct image URL.
|
||||
#
|
||||
# Examples:
|
||||
|
||||
Reference in New Issue
Block a user