Commit Graph

2743 Commits

Author SHA1 Message Date
evazion
d01b3c0637 wiki pages: remove /wiki_pages/search page.
This page is unnecessary since you can already search wiki pages from the /wiki_pages listing.
2022-08-24 14:27:47 -05:00
evazion
d9cf7f7443 users: allow anonymous users to use /profile.json.
Allow logged out users to call https://danbooru.donmai.us/profile.json.
This allows getting information on default settings and limits for
anonymous users.

May be a breaking API change if users were using the HTTP response code
from /profile.json to check if they were successfully logged in.
2022-08-24 02:24:05 -05:00
evazion
e3af738371 tests: fix broken tests. 2022-08-24 02:03:37 -05:00
evazion
09dfab1f0d hentai foundry: update url for Hentai Foundry tags.
Change the URL used for Hentai Foundry tags from:

    https://www.hentai-foundry.com/search/index?query=elf&search_in=keywords

to:

    https://www.hentai-foundry.com/pictures/tagged/elf
2022-08-24 00:25:37 -05:00
evazion
2c36e02810 foundation.app: fix scraping of image urls.
Foundation changed their HTML page format and we can no longer scrape
the image URL directly from the page. Instead we have to build it based
on API data.
2022-08-24 00:25:37 -05:00
evazion
c8917684b8 jobs: fix failures in /jobs controller.
Fix errors with searching for and retrying jobs on the /jobs page caused
by the upgrade to GoodJob 3.0.
2022-08-23 18:07:04 -05:00
evazion
228850b749 newgrounds: support parsing video urls.
Fixes URLS like `https://www.newgrounds.com/portal/view/830293` being treated as bad_source.
2022-08-23 13:39:32 -05:00
evazion
67798c9ece Fix #5221: Trying to upload an unsupported url shows ai tags error. 2022-07-01 18:13:36 -05:00
evazion
821b97b4e2 Merge pull request #5201 from nonamethanks/fix-deviantart
Deviantart: fix regression in 3a0a32b98a
2022-06-05 15:56:06 -05:00
evazion
acc4a21687 posts: allow admins to approve the same post twice.
This is so admins can overrule flags and always have the final say in whether a
post is approved, even in the event of coordinated or sockpuppet flagging.

Fixes #4980: Way to mark flags as invalid for admins
2022-06-05 15:51:58 -05:00
evazion
907194fc6f commentaries: move search form to /artist_commentaries page.
* Move the commentary search form to the /artist_commentaries page.
* Add Order field for changing the sort order.
2022-06-05 14:28:44 -05:00
evazion
05df3a194c posts: add more free metatags.
The following metatags no longer count against the tag search limit:

* is
* id
* date
* age
* filesize
* filetype
* parent
* child
* md5
* width
* height
* duration
* mpixels
* ratio
* score
* upvotes
* downvotes
* favcount
* embedded
* tagcount
* pixiv_id
* pixiv

These are mostly metatags that have to do with properties of the post
itself. Other metatags still count because they involve things like
subqueries or joins, or they're more tag-like in function.
2022-06-05 14:28:44 -05:00
nonamethanks
2fd8e9bc14 Deviantart: fix regression in 3a0a32b98a 2022-06-04 20:26:14 +02:00
evazion
cc2285ed6f Merge pull request #5188 from nonamethanks/fix-deviantart
Fix deviantart strategy to get biggest available size
2022-06-01 18:39:43 -05:00
evazion
173e43b192 user upgrades: add upgrade code system.
Add a system for upgrading accounts using upgrade codes. Users purchase
an upgrade code off-site then redeem it on-site to upgrade their account
to Gold. Upgrade codes are randomly pre-generated and are one time use
only. Codes have enough randomness that guessing a code is infeasible.
2022-06-01 18:31:46 -05:00
nonamethanks
3a0a32b98a Fix deviantart strategy to get biggest available size 2022-05-27 17:07:22 +02:00
evazion
81bd86d202 posts: add "general" rating; rename "safe" rating to "sensitive".
* Add "general" rating.
* Rename "safe" rating to "sensitive".
* Change safe mode to include both rating:s and rating:g.
* Treat rating:safe as a synonym for rating:sensitive.
* Link "howto:rate" in the post edit form.
2022-05-22 13:38:45 -05:00
evazion
9867514a78 Fix #5177: ordfav with commentary search raises exception. 2022-05-20 22:59:02 -05:00
evazion
0fe9356bf6 tests: fix broken tests. 2022-05-20 22:51:02 -05:00
evazion
181639368c posts: add is: and has: metatags.
Add the following metatags:

* is:parent
* is:child
* is:safe
* is:questionable
* is:explicit
* is:sfw (same as -rating:q,e)
* is:nsfw (same as rating:q,e)
* is:active
* is:deleted
* is:pending
* is:flagged
* is:appealed
* is:banned
* is:modqueue
* is:unmoderated
* is:jpg
* is:png
* is:gif
* is:mp4
* is:webm
* is:swf
* is:zip
* has:parent
* has:children
* has:source
* has:appeals
* has:flags
* has:replacements
* has:comments
* has:commentary
* has:notes
* has:pools

All of these searches were already possible with other metatags, but these might be more convenient.
2022-05-18 13:04:15 -05:00
evazion
141044d352 posts: refactor hardcoded ratings.
Refactor ratings to not be hardcoded in various places. Make it so
all ratings are defined in Post::RATINGS.

Also make it so that you can search multiple ratings at once with `rating:q,e`.
2022-05-18 13:04:15 -05:00
evazion
4b65e96abc upgrades: rename stripe_id to transaction_id
* Rename the stripe_id column to transaction_id.
* Add a new payment_processor column to identity the processor used for
  this transaction (and hence, which backend system the transaction_id is for).
2022-05-15 01:05:24 -05:00
evazion
80f3778616 Merge pull request #5159 from nonamethanks/fix-furaffinity-ascii-urls
Furaffinity: fix uploads for non-ascii image urls
2022-05-09 14:16:32 -05:00
nonamethanks
5b8402751c Furaffinity: fix uploads for non-ascii image urls
Use Addressable::URI, which supports non-ascii urls.
2022-05-09 18:38:38 +02:00
evazion
638c928c8a Add 18 USC 2257 disclaimer.
Add a 2257 disclaimer and link to it in the site footer.
2022-05-09 02:26:19 -05:00
evazion
449fd6c49c upgrades: factor out Stripe integration.
Factor out the Stripe code from the UserUpgrade class. Introduce a new
PaymentTransaction abstract class that represents a payment with some
payment processor, and a PaymentTransaction::Stripe class that
implements transactions with Stripe.

Note that we can't completely eliminate Stripe even though we no longer
accept payments with it because we still need to be able to look up old
payments in Stripe.
2022-05-06 22:52:33 -05:00
evazion
52edf5c3be config: don't hardcode safebooru donmain. 2022-05-05 19:09:04 -05:00
evazion
34038d71ae Fix #5153: Using the child metatag without an id causes unexpected behavior 2022-05-04 23:19:58 -05:00
evazion
2219a64f47 posts: show takedown page for banned artists and posts.
Show a "This page has been removed because of a takedown request" error when
an unauthorized user searches for a banned tag, or tries to view a banned post.
2022-05-03 05:56:14 -05:00
evazion
ac98c142a4 posts: move expunged image to trash folder.
When a post is expunged, move the image to a trash folder so it can be
recovered if needed.
2022-05-03 05:51:09 -05:00
evazion
c07b099bf8 Fix #5152: Nicovideo video urls getting bad_source. 2022-05-03 03:59:15 -05:00
evazion
1a89071f2d posts: fix error on post index page when search count times out in safe mode
Fix a nil deference error on the post index page. This happened when
performing a single tag search in safe mode and calculating the number
of search results timed out.
2022-05-02 22:03:33 -05:00
evazion
17ffe3590a Fix #4982: Add route to remove a post from a favorite group 2022-05-02 15:56:16 -05:00
evazion
d2502a0c40 Fix #4877: Error when tagging favgroup:foo when post is already in favgroup:foo
Bug: If a tag edit failed because it contained a metatag that raised an
exception, then a new post version would be created even though the edit
didn't go through. This could happen if the newpool:, fav:, favgroup:,
disapproved:, status:active, or status:banned metatags failed (for
example, because of a privilege error).

Fix: Silently ignore all errors raised when applying metatags. This way
the edit will always succeed, so erroneous post versions won't be created.
2022-05-02 15:56:16 -05:00
evazion
93352b318e Fix #5146: Adding an existing favorite to favorite groups leads to an error.
Show "Favgroup already contains post XXX" error when trying to add a
post to a favgroup that already contains that post.
2022-05-02 15:56:16 -05:00
evazion
2d9bba4abb 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)
2022-05-01 21:01:36 -05:00
evazion
23b8350320 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.
2022-05-01 21:01:36 -05:00
evazion
d54ad9103b Merge pull request #5147 from nonamethanks/furaffinity-support
Add furaffinity support
2022-05-01 20:16:17 -05:00
evazion
f4ad1b09da Fix #4444: Pool navigation is broken when post appears twice in same pool.
Don't allow the same post to be added to the same pool twice.

This was only legitimately needed in a handful of cases. It was much
more common for posts to be mistakenly added to the same pool twice.
2022-05-01 01:57:54 -05:00
evazion
f117049750 users: remove 'hide deleted posts' account setting.
This setting automatically added the `-status:deleted` metatag to all searches. This meant deleted
posts were filtered out at the database level, rather than at the html level. This way searches
wouldn't have less-than-full pages.

The cost was that searches were slower, mainly because post counts weren't cached. Normally when you
search for a tag, we can get the post count from the tags table. If the search is actually like
`touhou -status:deleted`, then we don't know the count and we have to calculate it on demand.

This option is being removed because it did the opposite of what people thought it did. People
thought it made deleted posts visible, when actually it made them more hidden.
2022-05-01 00:47:46 -05:00
evazion
fdc1130aea Fix #5150: rating: metatag doesn't work on betabooru upload page. 2022-04-30 20:22:26 -05:00
evazion
ccd0dde081 Fix #5013: BUR model doesn't validate tags.
Don't allow users to request aliases, implications, or renames for invalid tag names.

As a side effect, it's no longer possible to request shortcut aliases like
`/hr -> hakurei_reimu` (slash abbreviations still exist, but they can't
be overridden with aliases). Tests involving these types of aliases are
removed.
2022-04-30 20:03:04 -05:00
evazion
0920d2ca24 tags: don't allow aliases inside *_(cosplay) tags.
Don't treat *_(cosplay) tags as being invisibly aliased when a character tag is aliased. For example,
if toosaka_rin is aliased to tohsaka_rin, and toosaka_rin_(cosplay) is later added to a post, don't
magically translate the tag to tohsaka_rin_(cosplay). Instead, treat it as an error to create a
*_(cosplay) tag for an aliased character tag.

This removes some of the complexity and magic behavior surrounding *_(cosplay) tags.
2022-04-30 18:12:35 -05:00
evazion
f8aa985a16 Fix #4908: Prevent artist entries from being made on disambiguation tags.
Don't allow artist entries to be created for deprecated tags.
2022-04-30 15:21:10 -05:00
evazion
918f32c554 Fix #4461: Improve posts/index page titles. 2022-04-30 01:52:33 -05:00
evazion
906ac25221 autocomplete: fix metatags not completing until a character is typed.
Fix metatags not showing autocomplete results until after the first
letter was typed. For example, typing `filetype:` didn't show any
completions until another letter was typed. Now typing `filetype:` shows
all available file types.

This was because `filetype:` by itself wasn't recognized as a valid
search before, since metatags always required a value. Now it is a valid
search, so it's technically possible to search for `filetype:` by
itself. In this case the metatag value will be the empty string, which
will return no results because there are no posts where the filetype is
the empty string.

This sounds nonsensical, but it's potentially useful for metatags like
the `source:` metatag, where searching for posts with an empty source
does make sense. It was also technically possible before by searching
for `source:""`, so making the value optional doesn't change anything.
2022-04-29 22:22:11 -05:00
evazion
bbe748bd2b posts: factor out post edit logic.
Factor out most of the tag edit logic from the Post class to a new
PostEdit class. The PostEdit class contains the logic for parsing tags
and metatags from the tag edit string, and for determining which tags
were added or removed by the edit.

Fixes various bugs caused by not calculating the set of added or removed
tags correctly, for example when tag category prefixes were used (e.g.
`copy:touhou`) or when the same tag was added and removed in the same
edit (e.g. `touhou -touhou`).

Fixes #5123: Tag categorization prefixes bypass deprecation check
Fixes #5126: Negating a deprecated tag will still cause the warning to show
Fixes #3477: Remove tag validator triggering on tag category changes
Fixes #4848: newpool: metatag doesn't parse correctly
2022-04-29 17:13:33 -05:00
nonamethanks
8edd5dd810 Add furaffinity support 2022-04-27 03:47:59 +02:00
evazion
76d9e86724 Fix #5140: Unexpected error: PublicSuffix::DomainInvalid for searching some newgrounds urls in /artists
When the artist name couldn't found for a Newgrounds URL, for example
for `https://www.newgrounds.com/dump/item`, then the `profile_url`
method erroneously returned `https://.newgrounds.com`. This led to an
error later on when the artist finder tried to parse the invalid URL.

Also fix `strategy_should_work` to test that the profile URL is a valid
URL, and not to try to download the file when image_urls is empty.
2022-04-22 23:16:41 -05:00
evazion
db6bb2ccac Fix #5136: Regular tags are now case-sensitive.
* Fix `AST.tag` to downcase the tag name.
* Change PostQuery::Parser to use build nodes using `AST.tag`,
  `AST.metatag`, `AST.wildcard`, etc methods instead of building nodes
  directly. This way all the normalization happens in the node
  constructor methods instead of in the parser.
2022-04-22 02:14:07 -05:00