Commit Graph

9418 Commits

Author SHA1 Message Date
evazion
fb19bf06ce Merge pull request #4490 from BrokenEagle/fix-embedded-notes
Fix embedded notes not being re-editable after note creation
2020-05-29 11:29:12 -05:00
evazion
7a819b0060 artists: hide banned artist pages from anonymous users.
Hide banned artist pages from anonymous (logged out) users. Partial
revert of 6b066f2ca. Artists sometimes ask us to remove all their
information from the site, including their artist profile. It's easier
to hide their profile than to explain to Japanese artists that a) we're
under no obligation to remove their profile and b) we need to keep it to
maintain the ban on their content that they asked for.
2020-05-29 11:27:59 -05:00
BrokenEagle
a6c64bb69a Fix embedded notes not being re-editable after note creation
The issue is that the body of the embedded notes were being set to
the value which tells the script not to read the original body after
saving a note. This was a poor system prone to issues, so instead a
DOM class is now explicitly added to the notes on note creation and
cleared whenever a note gets saved.

Additionally, the embedded note bodies were standardized to use the
same initial value as non-embedded notes as well.
2020-05-27 23:59:19 +00:00
evazion
feeea6602c Merge pull request #4488 from nonamethanks/add_weibo_support
Add Weibo support
2020-05-27 16:53:14 -05:00
evazion
2c60a51f64 Merge pull request #4475 from nonamethanks/refactor_source_normalizing
Refactor source normalization
2020-05-27 16:52:17 -05:00
evazion
71f4e5b82a artstation: add tests for #4480. 2020-05-27 15:49:04 -05:00
evazion
241894428a Merge pull request #4480 from BrokenEagle/fix-artstation
Fixes issues with Artstation source strategy
2020-05-27 15:37:23 -05:00
evazion
7c5510a650 media_file/flash: add license information (#4484). 2020-05-27 15:11:46 -05:00
evazion
f94c52478c media file: memoize expensive methods in subclasses. 2020-05-27 14:31:39 -05:00
evazion
84cd8540ab tests: add tests for uploading flash files (#4484). 2020-05-27 14:26:52 -05:00
evazion
16ed1db3b1 Merge pull request #4484 from lllusion3469/fix-flash-dimensions
Fix flash dimensions
2020-05-27 14:10:51 -05:00
nonamethanks
5c7307a1c9 Add Weibo support 2020-05-27 11:30:05 +02:00
evazion
8f10fb99f4 Merge pull request #4482 from BrokenEagle/add-monospace-font
Add monospace font
2020-05-25 19:34:55 -05:00
BrokenEagle
8cab65367c Added mono font 2020-05-25 19:15:35 +00:00
lllusion3469
5c2ecee60f uploads: memoize dimensions of flash files
flash files can be quite big (the biggest on danbooru.donmai.us being
68.6MB atm). Reading it and applying complex transformations twice seems
unnecessary.
2020-05-25 18:58:48 +02:00
lllusion3469
b2814c1125 uploads: fix getting dimensions of flash files
MediaFile#dimensions is called twice - in #width and in #height but
it only works on the first call because the file is read to the end and
consumed the first time so when #read is called the second time it only
returns the empty string
2020-05-25 18:51:36 +02:00
evazion
c300b344de Merge pull request #4481 from BrokenEagle/fix-iqdb-image-url
Adds suport for using the image_url parameter with IQDB
2020-05-25 02:20:55 -05:00
evazion
e22e403bac Merge pull request #4478 from nonamethanks/fix_nijie_truncated_commentary
Nijie: fetch full commentary rather than truncated preview
2020-05-25 02:13:24 -05:00
evazion
20f8a26709 tests: fix rails 2.7 keyword parameter deprecation warnings. 2020-05-25 01:48:46 -05:00
evazion
66a66cc952 Update ruby gems and yarn packages. 2020-05-25 01:10:49 -05:00
evazion
3e2949d157 uploads: fix exception when uploading gifs.
Older versions of libvips don't support get("n-pages"). This is known to
fail in libvips-8.4 and known to work in libvips-8.8.
2020-05-24 12:07:17 -05:00
evazion
cf88411dce uploads: fix /uploads listing search not working.
Upload#search was declared as an instance method instead of a class
method.
2020-05-24 00:29:19 -05:00
evazion
5fc98eb35f rake: add image preview/sample regeneration script. 2020-05-23 23:51:23 -05:00
evazion
dc4a3bcf38 uploads: fix incorrect sample image sizing.
ref: https://danbooru.donmai.us/forum_topics/16935.

Bug: sample images were being generated to be at most 850px width *and*
850px tall. They're supposed to be at most 850px wide with unlimited height.
2020-05-23 23:29:59 -05:00
evazion
af50e10c3a search: temporarily raise tag limit to 12 for Danbirthday celebration. 2020-05-23 22:09:38 -05:00
evazion
5da04db9cd api: rename error url param to cause_error.
Rename the `error` url param to `cause_error`. Using this param causes
Danbooru to return an error response for testing purposes. Calling this
param `error` caused problems when OAuth2 authorization failed and the
user was redirected back to Danbooru with the `error` param set.
2020-05-23 22:01:29 -05:00
BrokenEagle
b9b1177832 Adds suport for using the image_url parameter with IQDB
This was only halfways supported, as the download module does not
have an image_url function. So for this, it just uses the url function,
which is just the original URL passed into the download function.

Additionally, it adds support to grab the largest available image,
which it does by using the file_url function of the downloads module.

- Fixes image_url parameter
- Adds file_url parameter
2020-05-24 00:58:46 +00:00
BrokenEagle
2d88569fac Fixes issues with Artstation source strategy
The reason that the download was failing was not because the 4k size
didn't exist, but because the Artstation had no way to handle image
cover URLs. This caused it to pass nil to the download function.

Additionally, there was no way to get the preview URL size, i.e. the
smallest available image for an Arstation image URL.

- Adds support for cover URLs
- Adds support for preview URL size
2020-05-24 00:38:54 +00:00
nonamethanks
116f3a67ef Nijie: fetch full commentary rather than truncated preview 2020-05-22 02:47:19 +02:00
nonamethanks
307df3b3e4 Refactor source normalization
* Move the source normalization logic out of the post model
  and into individual sources' strategies.
* Rewrite normalization tests to be handled into each source's test,
  and expand them significantly. Previously we were only testing
  a very small subset of domains and variants.
* Fix up normalization for several sites.
* Normalize fav.me urls into normal deviantart urls.
2020-05-21 22:46:51 +02:00
evazion
364343453c uploads: factor out remaining image methods to MediaFile. 2020-05-19 02:42:19 -05:00
evazion
45064853de uploads: move thumbnail generation code to MediaFile.
* Move image thumbnail generation code to MediaFile::Image.
* Move video thumbnail generation code to MediaFile::Video.
* Move ugoira->webm conversion code to MediaFile::Ugoira.

This separates thumbnail generation from the upload process so that it's
possible to generate thumbnails outside of uploads.
2020-05-18 04:19:04 -05:00
evazion
24c53172db config: remove enable_image_cropping option.
There's no need to disable this option. Supporting it adds complexity
and disabling it is untested.
2020-05-17 15:01:59 -05:00
evazion
0a12f35c47 posts/index: fix cropped thumbnails not being shown.
`show_cropped: true` wasn't being passed down to PostPresenter.preview.
2020-05-13 07:12:11 -05:00
evazion
1e2748595c tests: fix various broken tests. 2020-05-13 00:15:04 -05:00
evazion
ad02e0f62c posts/index: fix rating:s being included in page title in safe mode.
Fixes bug described in d3e4ac7c17 (commitcomment-39049351)

When dealing with searches, there are several variables we have to keep
in mind:

* Whether tag aliases should be applied.
* Whether search terms should be sorted.
* Whether the rating:s and -status:deleted metatags should be added by
  safe mode and the hide deleted posts setting.

Which of these things we need to do depends on the context:

* We want to apply aliases when actually doing the search, calculating
  the count, looking up the wiki excerpt, recording missed/popular
  searches in Reportbooru, and calculating related tags for the sidebar,
  but not when displaying the raw search as typed by the user (for
  example, in the page title or in the tag search box).
* We want to sort the search when calculating cache keys for fast_count
  or related tags, and when recording missed/popular searches, but not
  in the page title or when displaying the raw search.
* We want to add rating:s and -status:deleted when performing the
  search, calculating the count, or recording missed/popular searches,
  but not when calculating related tags for the sidebar, or when
  displaying the page title or raw search.

Here we introduce normalized_query and try to use it in contexts where
query normalization is necessary. When to use the normalized query
versus the raw unnormalized query is still subtle and prone to error.
2020-05-12 21:47:00 -05:00
evazion
ea400296d4 Fix #4455: Two tag search gives option to create wiki page when one is a metatag. 2020-05-12 17:52:41 -05:00
evazion
ca00563a4d Fix #4303: Unable to rename artist entries with wiki pages
Remove the ability to edit an artist's wiki page directly from the
artist edit page. Instead the artist edit page has a link to open the
wiki edit page if you need to edit the wiki too.

Fixes an error being thrown when renaming an artist with a wiki page.
The problem is that changing the artist's name breaks the artist's
association with the old wiki page. Rails really wants nested
associations to be based on immutable IDs, not on mutable names, so
dealing with this correctly is difficult.

We don't really want to encourage people to create wiki pages for
artists to begin with, since they're usually just used to duplicate
the artist urls. Making it less convenient to edit artist wiki pages is
an intentional change to discourage creating unnecessary artist wikis.

Finally, this fixes an exploit where it was possible to edit locked wiki
pages through the artist edit page.
2020-05-12 16:57:05 -05:00
evazion
31c7abd2e9 footer: fix social icon links.
Image links were broken on pages like /artists/new because the links
were relative to the current page url, not to the root url.
2020-05-12 16:13:55 -05:00
evazion
cb49489f1e tests: remove SKIP_CLOUDFLARE_CHECK env variable.
This was a hack to deal with the Cloudflare check sometimes being slow
or timing out during tests. The call to https://api.cloudflare.com/client/v4/ips
could hang if there were IPv6 connectivity problems. If this happens, make
sure that IPv6 is configured properly and that `curl -v --http1.1 -6 https://api.cloudflare.com/client/v4/ips`
works.
2020-05-12 15:50:42 -05:00
evazion
bf08898837 Danbooru::Http: add default connection timeout.
* Add a three second connection timeout to all http requests. By default
  http.rb doesn't have any timeouts, so it can hang forever trying to
  connect if there are any network issues.

* Return a fake 522 error in the event of a timeout so that callers
  don't have to deal with TimeoutError exceptions, instead they can treat
  timeouts as normal 5xx errors (which most callers already handle).
2020-05-12 15:46:59 -05:00
evazion
deeb465b72 Merge pull request #4457 from lllusion3469/fix_da
Fix Deviantart
2020-05-11 16:22:48 -05:00
evazion
1578841a8a Merge pull request #4445 from nonamethanks/hentai_foundry_support
Add hentai-foundry support
2020-05-11 14:01:07 -05:00
lllusion3469
45ae8bfb6f deviantart: support non-downloadable videos 2020-05-11 19:51:04 +02:00
lllusion3469
40fa985e26 deviantart: use #at_css instead of #search
only one result needed, query is css
2020-05-11 19:51:04 +02:00
lllusion3469
9dccee1d5e stash: fix tests
checking image_urls isn't necessary as it's [image_url] per definition
2020-05-11 19:51:04 +02:00
lllusion3469
0c180b521c deviantart: avoid download api call if not downloadable
because it's included in api_response which is part of /source.json
2020-05-11 19:51:04 +02:00
lllusion3469
70beb7288d rubocop: fix various issues 2020-05-11 19:51:04 +02:00
lllusion3469
0d5e31868f deviantart: fix non-downloadable flash files 2020-05-11 19:51:04 +02:00
lllusion3469
46e9f2dede deviantart: switch to Danbooru::Http
httprb doesn't seem to support a base_uri parameter so use URI.join with
a relative path instead
2020-05-11 16:11:15 +02:00