Commit Graph

8080 Commits

Author SHA1 Message Date
evazion
f97c62c71d search: fix search timeout error page not appearing.
Bug: when a search timed out we got the generic failbooru page instead
of the search timeout error page.

Cause: when rendering the <link rel="next"> / <link rel="prev"> tags in
the header, we may need to evaluate the search to determine the next or
previous page, but if the searches times out then this fails, which
caused Rails to throw a ActionView::Template::Error because an exception
was thrown while rendering the template.

Likewise, rendering the attributes for the <body> tag could fail with an
ActionView::Template::Error because the call to `current_item.present?`
forced evaluation of the search.
2020-07-03 13:08:49 -05:00
evazion
efe5111a9e js: bundle jQuery with Webpack.
Include jQuery in our Webpack bundle instead of loading it from CDNJS.
This means we no longer load any Javascript libraries from third party
sites.
2020-06-30 23:41:47 -05:00
evazion
94490eb57f Fix #4492: Switch from qtip2 to tippy.js. 2020-06-30 22:40:40 -05:00
evazion
5f05a41fbc Fix #4468: Tag edit mode on posts view applies taglist to wrong post. 2020-06-30 15:20:59 -05:00
evazion
1a8729e0d9 Fix #4462: "You have already favorited this post" on upload.
Make adding the fav:self metatag ignore all errors, including when the
post was already favorited before editing the post.
2020-06-30 14:29:25 -05:00
evazion
3d90414e06 Merge pull request #4487 from BrokenEagle/fix-invalid-url
Fix invalid artist URLs being allowed
2020-06-29 17:46:13 -05:00
evazion
f5c9a78797 danbooru::http: fix SSLError exceptions not being caught.
Bug: The frontpage failed due to a SSL error. We couldn't fetch the
popular tag list from Reportbooru because Reportbooru's SSL certificate
had expired and HTTP.rb raised an SSLError exception that we didn't
catch.

Fix: Convert the SSLError to a 5xx HTTP error to prevent SSL exceptions
from leaking through HTTP.rb.
2020-06-29 14:49:59 -05:00
evazion
b85b4b190a pagination: remove switch_to_sequential option. 2020-06-28 02:59:32 -05:00
evazion
ad02b26f3d pagination: fix exception on empty pages in seq. pagination.
Fix exception when the page is empty during sequential pagination.
Caused because the paginator can't figure out the next or previous page
when the current page is empty.

* https://danbooru.donmai.us/posts?page=b0
* https://danbooru.donmai.us/posts?page=a10000000
2020-06-28 02:57:48 -05:00
evazion
cc73f2468b disapprovals: don't dmail uploaders about disapprovals.
Remove sending dmail notifications to uploaders when an upload is
disapproved. These messages are usually confusing and frustrating to
uploaders. They don't know who is sending them and they usually feel
insulted when they get negative messages from anonymous users.
2020-06-28 01:51:41 -05:00
evazion
580211ee64 seo: fix canonical tags on post index and show page.
* Fix incorrect canonical tags. Before we were using
  `<meta name="canonical" content="...">`. This is wrong, it should have been
  `<link rel="canonical" href="...">`.

* Add a default canonical tag on all pages. Fixes Google treating the
  same content on different subdomains (safebooru, shima, kagamihara, etc)
  as duplicate content. Also fixes Google sometimes treating similar but
  distinct content on the same domain as duplicate content.
2020-06-27 19:54:11 -05:00
evazion
c739e2b226 seo: allow crawling /posts up to page 50. 2020-06-27 18:10:14 -05:00
evazion
e2ec015603 seo: index frontpage, images, and legacy redirects. 2020-06-27 18:09:02 -05:00
evazion
63ca421f3e comments: fix exception in /comments/new page.
Fix regression from 804a2ef9a.
2020-06-27 13:05:36 -05:00
evazion
da40a1cb73 Fix #4463: Missing link to recent changes in pools' topbar. 2020-06-27 02:18:33 -05:00
evazion
24e299cf93 api: add /explore/posts/searches.json, /explore/posts/missed_searches.json. 2020-06-27 02:09:51 -05:00
evazion
dd857c6695 popular searches: fix blank search counts on /explore/posts/searches. 2020-06-27 02:09:09 -05:00
evazion
ff096b8adc Fix #4508: Specific tag not showing a wiki.
Fix the wiki excerpt not appearing when searching for a tag that doesn't
exist in the tag list. This could happen if someone created a wiki for a
tag that has never been used on a post.
2020-06-27 02:01:34 -05:00
evazion
f06e322dc0 Fix #4507: Clicking "View wiki" on Artists with no wiki redirects to the posts page. 2020-06-27 01:20:05 -05:00
evazion
3a6e4732bf Fix #4511: Remove delete/undelete controls from the artist index.
* Only show the delete artist button on the artist edit page.
* Only show the delete pool button on the pool edit page.
* Only show the delete wiki button on the wiki edit page.
2020-06-27 00:45:29 -05:00
evazion
f7f72e29b5 Fix #4458: Duplicate HTML IDs on post show page. 2020-06-26 14:59:30 -05:00
evazion
804a2ef9a5 Fix #4535: Comment edit forms contain duplicate IDs.
Prefix comment form IDs with `post_<id>_comment_<id>` to ensure
uniqueness.
2020-06-26 14:57:19 -05:00
evazion
883856d4af simple form: refactor DText form fields to use SimpleForm.
* Refactors DText form fields to use a custom SimpleForm input instead
  of manually generated html. This fixes it so that DText fields use the
  same markup as normal SimpleForm fields, which lets us apply browser
  maxlength validations to DText input fields.

* Fixes autocomplete for @-mentions only working in comments and forum posts.
  Now @-mention autocomplete works in all DText fields, including dmails.
  Known bug: it applies in artist commentary fields when it shouldn't.
2020-06-25 16:28:09 -05:00
evazion
44f826d8fa nicoseiga: optimize image_url method.
The image_url method makes a request to `https://seiga.nicovideo.jp/images/source/:image_id`
to see where this URL redirects to. Before we did a GET request, which caused it to download
the full image. This could fail with a timeout error if the download took too long. We also
cached the request, which caused the full image to be cached, even though we only need the
headers. Change it to a HEAD request so we don't have to download the entire image just to
check the URL.
2020-06-24 22:54:04 -05:00
evazion
5af50b7fcd danbooru::http: factor out Cloudflare Polish bypassing.
* Factor out the Cloudflare Polish bypass code to a standalone feature.

* Add `http_downloader` method to the base source strategy. This is a
  HTTP client that should be used for downloading images or making
  requests to images. This client ensures that referrer spoofing and
  Cloudflare bypassing are performed.

This fixes a bug with the upload page reporting the polished filesize
instead of the original filesize when uploading ArtStation images.
2020-06-24 22:54:04 -05:00
evazion
d3bb5c67ee danbooru::http: factor out referrer spoofing.
Factor out referrer spoofing so that it can be used outside of downloading
files. We also need to spoof the referrer when determining the remote
filesize of images on the uploads page.
2020-06-24 21:46:59 -05:00
evazion
f84ceb3938 image proxy: raise image download timeout.
Possible fix for large Pixiv previews on the upload page sometimes
returning HTTP 500 errors.
2020-06-24 19:31:47 -05:00
evazion
4074cc99f9 uploads: fix incorrect remote sizes on pixiv uploads.
Bug: the uploads page showed a remote size of 146 bytes for Pixiv uploads.

Cause: we didn't spoof the Referer header when making the HEAD request
for the image, causing Pixiv to return a 403 error.

Also fix the case where the Content-Length header is absent.
2020-06-24 03:02:45 -05:00
evazion
8eac82a971 pixiv: fix regression with new user profile urls.
* Update tests to use new Pixiv profile urls.
* Fix issue with artist finder not working when given direct image or
  html page urls.
2020-06-24 02:41:11 -05:00
evazion
85f58bf2f6 newgrounds: fix style nitpicks. 2020-06-24 00:25:45 -05:00
evazion
42c06b0f1e Merge pull request #4516 from nonamethanks/add_newgrounds_support
Add NewGrounds support
2020-06-24 00:20:16 -05:00
evazion
185693b99b Merge branch 'master' into fix-pixiv-profile-url 2020-06-24 00:06:55 -05:00
evazion
8ef2b7772d Merge pull request #4530 from BrokenEagle/parent-child-status-search
Add ability to search on status of parent/child
2020-06-23 23:53:57 -05:00
evazion
bb765f55d5 Eliminate misc dead code. 2020-06-23 23:37:56 -05:00
evazion
d71f3cbac1 Merge pull request #4531 from BrokenEagle/wiki-linked-to
Add option to search for wikis that don't link to a specific wiki
2020-06-23 23:21:16 -05:00
evazion
be4bdfc136 artists: add test for hiding deleted wikis on artist pages (#4526). 2020-06-23 03:01:32 -05:00
evazion
d1e0542eb5 Merge pull request #4534 from BrokenEagle/fix-4533
Fix the tag matches option
2020-06-23 03:00:32 -05:00
evazion
05fbbc69e6 Merge pull request #4529 from BrokenEagle/deleted-artist-wiki
Don't display artist wiki when it is deleted
2020-06-23 02:51:53 -05:00
evazion
da9c145c64 Merge pull request #4527 from BrokenEagle/forum-post-voting
Prevent creators from voting on their own BURs
2020-06-23 02:42:46 -05:00
evazion
8a21c9a8db Merge pull request #4523 from nonamethanks/revert_pixiv_tools
Revert "Pixiv: don't blacklist digital tools"
2020-06-23 02:39:18 -05:00
evazion
617211f405 Merge pull request #4521 from nonamethanks/zerochan_png
Zerochan: Normalize png links
2020-06-23 02:38:39 -05:00
evazion
f2ae9eeae0 Merge pull request #4528 from nonamethanks/fix_4520
Twitter: don't get api without a status id
2020-06-23 02:36:32 -05:00
BrokenEagle
1a87935764 Fix the tag matches option
The split function was mistakenly used instead of the match function.
2020-06-23 06:58:03 +00:00
evazion
5dbe08372b nicoseiga: remove accept_fetish_warning.
This should have been a cookie, but it doesn't matter because the
strategy still works without it.
2020-06-23 00:49:38 -05:00
BrokenEagle
50740e302f Add option to search for wikis that don't link to a specific wiki
Also add inputs on the search page for both the linked_to and the
not_linked_to search parameters. Additionally, normalize the title
first since autocomplete adds trailing spaces. The search query was
also simplified a bit by taking advantage of Rails associations.
2020-06-23 05:31:43 +00:00
evazion
7f5e87568a danbooru::http: raise exception on failed downloads.
Restore behavior from a6994cd4d, it breaks tests when they try to the
response body from a fake 599 response.
2020-06-22 22:51:36 -05:00
evazion
31802fb666 nijie: fix parallel test failures.
Nijie tests fail often under parallel testing. This is because every
test needs to login to Nijie first, but Nijie rate-limits the login
endpoint, so eventually we hit the limit and tests start failing.

This is made worse by a thundering herd problem. Eight test processes
try to login to Nijie at the same time, but only one succeeds, so the
rest sleep and try again, but they all wakeup and try again at the same
time, hitting the rate limits again.

The workaround is to set the retry limit ridiculously high, higher than
we would ideally like in production. Another workaround would be to
serialize the Nijie tests in the test suite. This can be done with
lockfiles and flock(2). This helps, but we can still hit the rate limit
even under serialized execution.
2020-06-22 22:21:17 -05:00
evazion
a6994cd4d7 media file: fix exception on empty files.
This may happen if a user uploads from a source that returns an error
HTTP response with no data.
2020-06-22 18:49:36 -05:00
evazion
8c6759bbd7 nicoseiga: fix login endpoint.
* Update the login endpoint. The old endpoint returns 404 now.

  POST https://account.nicovideo.jp/api/v1/login ->
  POST https://account.nicovideo.jp/login/redirector?site=seiga

* Let Danbooru::Http cache the login request instead of caching it manually.

* Let Danbooru::Http automatically follow redirects instead of dealing
  with the Location header manually.
2020-06-22 18:46:47 -05:00
evazion
95fee75d9a nicoseiga: fix uploads not working for certain direct image urls.
Fix Nicoseiga strategy to work with certain direct image urls that we
can't otherwise extract any information from.

Examples:

* https://dic.nicovideo.jp/oekaki/52833.png
2020-06-22 16:53:50 -05:00