Commit Graph

12091 Commits

Author SHA1 Message Date
evazion
f74f1e9f70 artists: add more website icons for artist entries. 2022-12-10 17:02:49 -06:00
evazion
e2786d0292 Fix #5371: More website icons for artist entries. 2022-12-10 16:52:47 -06:00
evazion
d4e97bd536 webpack: fix CSS/JS files being cached forever in Safari.
Fix issue where CSS and Javascript files were permanently cached by Safari in development mode.
Safari seems to cache CSS and JS files forever, no matter what the Cache-Control header says. The
workaround is to use `Vary: *`.
2022-12-10 01:02:02 -06:00
evazion
f0bd57af98 media assets: fix paginator positioning on mobile.
On the media assets show page, fix the styling and positioning of the paginator on mobile.
2022-12-09 22:43:32 -06:00
evazion
16c9e906b2 media assets: scroll to position on zoom.
On the media asset show page, make it so that when you click an image to zoom in, the page scrolls
to the clicked position. For example, if you click on the bottom of an image, scroll down so that
the bottom of the zoomed image is in view.

This makes it easier to view very tall images by letting you click on the part of the image you want
to see.
2022-12-09 18:23:32 -06:00
evazion
aefa7586fd media assets: refactor media asset component. 2022-12-09 15:17:45 -06:00
evazion
f3a1b42d10 gems: revert mail gem to fix startup failure.
mail-2.8.0 has a bug that causes Rails to fail to boot in production. Temporarily revert back to 2.7.1.

See https://www.github.com/mikel/mail/issues/1489
2022-12-08 16:35:54 -06:00
evazion
93cd7197e7 Update Ruby gems and Yarn packages. 2022-12-08 03:12:44 -06:00
evazion
2c33539be7 uploads: allow searching uploads and media assets by metatag.
Allow searching the /uploads and /media_assets pages by the following metatags:

* id:
* md5:
* width:
* height:
* duration:
* mpixels:
* ratio:
* filesize:
* filetype:
* date:
* age:
* status:<processing|active|deleted|expunged|failed> (for /media_assets)
* status:<pending|processing|active|failed> (for /uploads)
* is:<filetype>, is:<status>
* exif:

Examples:

* https://betabooru.donmai.us/media_assets?search[ai_tags_match]=filetype:png
* https://betabooru.donmai.us/uploads?search[ai_tags_match]=filetype:png

Note that in /uploads search, the id:, date:, and age: metatags refer to the upload media asset, not
the upload itself.

Note also that uploads may contain multiple assets, so for example searching uploads by
`filetype:png` will return all uploads containing at least one PNG file, even if they contain other
non-PNG files.
2022-12-07 01:02:19 -06:00
evazion
062a67086e media assets: fix sidebar overflow on Chrome.
Fix bug on the media assets show page where very long EXIF values wouldn't be word-broken, so they
could cause the sidebar to become wider than the screen. This only affected Chrome, not Firefox or
Safari.

Example: https://danbooru.donmai.us/media_assets/7167264
2022-12-06 19:46:41 -06:00
evazion
697691589e uploads: fix stretched images on Safari.
Fix images on the upload page appearing stretched (having the incorrect aspect ratio) when the image
is enlarged on Safari.

The fix is to set `aspect-ratio` and `height: intrinsic` to ensure the image is the right size. I
have no idea how this works or why it's necessary on Safari.

Fixes https://danbooru.donmai.us/forum_posts/227099.
2022-12-06 19:46:31 -06:00
evazion
7efd5d6db3 users: add ability to search for deleted users. 2022-12-05 23:58:31 -06:00
evazion
dddd28a27b users: don't allow Hangul filler characters in names.
Don't allow the following characters in names:

* https://codepoints.net/U+115F (HANGUL CHOSEONG FILLER)
* https://codepoints.net/U+1160 (HANGUL JUNGSEONG FILLER)
* https://codepoints.net/U+3164 (HANGUL FILLER)
* https://codepoints.net/U+FFA0 (HALFWIDTH HANGUL FILLER)

These are space-like characters that were inadvertently allowed because they're not considered
whitespace by Unicode and because they're in the Hangul script (which we otherwise allow).
2022-12-05 23:58:31 -06:00
evazion
d157899226 users: disallow more names ending with file extensions.
Disallow any name that has a suffix registered as a file extension in Rails.
2022-12-05 23:58:24 -06:00
evazion
d9dc84325f Fix #5365: Don't allow whitespace-only text submission.
Fix bug where it was possible to submit blank text in various text fields.

Caused by `String#blank?` not considering certain Unicode characters as blank. `blank?` is defined
as `match?(/\A[[:space:]]*\z/)`, where `[[:space:]]` matches ASCII spaces (space, tab, newline, etc)
and Unicode characters in the Space category ([1]). However, there are other space-like characters
not in the Space category. This includes U+200B (Zero-Width Space), and many more.

It turns out the "Default ignorable code points" [2][3] are what we're after. These are the set of 400
or so formatting and control characters that are invisible when displayed.

Note that there are other control characters that aren't invisible when rendered, instead they're
shown with a placeholder glyph. These include the ASCII C0 and C1 control codes [4], certain Unicode
control characters [5], and unassigned, reserved, and private use codepoints.

There is one outlier: the Braille pattern blank (U+2800) [6]. This character is visually blank, but is
not considered to be a space or an ignorable code point.

[1]: https://codepoints.net/search?gc[]=Z
[2]: https://codepoints.net/search?DI=1
[3]: https://www.unicode.org/review/pr-5.html
[4]: https://codepoints.net/search?gc[]=Cc
[5]: https://codepoints.net/search?gc[]=Cf
[6]: https://codepoints.net/U+2800
[7]: https://en.wikipedia.org/wiki/Whitespace_character
[8]: https://character.construction/blanks
[9]: https://invisible-characters.com
2022-12-05 01:58:34 -06:00
evazion
640a20d81c Fix #5354: Add bookmarklet support for picdig.net. 2022-12-03 02:48:56 -06:00
evazion
ed0716693b users: add ability to undelete accounts.
Add ability to undelete accounts from within the console. Their password is reset, their name is
restored to their last known user name, and a mod action is logged.
2022-12-02 23:24:38 -06:00
evazion
d7d3427488 Fix #5363: Inconsistent order of files from zip uploads.
Upload files in natural order rather than archive order when uploading archive files.

Before files were listed in the same order they appeared in the zip file. This could be in
non-alphabetical order, or even with files from different directories interleaved between each
other. Now files are uploaded in natural order, which is alphabetical order but with numbers sorted
properly, so that `file-9.jpg` appears before `file-10.jpg`.
2022-12-02 18:04:45 -06:00
evazion
c19fc16885 sources: don't escape Unicode characters in tag search URLs.
Fix it so that Unicode characters aren't unnecessarily percent-encoded when generating tag search
URLs. For example, generate URLs like this:

* https://www.pixiv.net/tags/オリジナル/artworks

Not like this:

* https://www.pixiv.net/tags/%E3%82%AA%E3%83%AA%E3%82%B8%E3%83%8A%E3%83%AB/artworks
2022-12-02 16:35:49 -06:00
evazion
9e34f4c3ed pixiv: update tag search URL to https://www.pixiv.net/tags/{name}/artworks. 2022-12-02 15:56:57 -06:00
evazion
2f508f03cf Fix #5362: Suggest ai-generated as a translated tag from pixiv response 2022-12-02 15:42:11 -06:00
evazion
25978ca754 Fix #5317: Don't allow users to flag posts they can't see.
A couple non-obvious consequences:

* Users can't flag non-rating:G posts in safe mode.
* Non-Gold users can flag Gold-only posts if they're the uploader.
2022-12-02 14:44:24 -06:00
evazion
e11cd288b9 Fix #5360: Use OpenGraph's og:image metadata for posts.
* Add og:image:width, og:image:height, and og:image:type tags.
* Use og:video tags for videos.
* Use 720x720 instead of 150x150 preview images for videos.
* Add duration tag to JSON-LD data for videos.
* Add OpenGraph tags to media assets show page.
* Respect Twitter max image size limits.
* Don't include OpenGraph image tags when someone shares a plain https://danbooru.donmai.us link
  with no tag search. This caused random potentially NSFW images to be shown when someone shared a
  https://danbooru.donmai.us link on social media, which could be cached for long periods of time.
2022-12-02 00:59:23 -06:00
evazion
ca0a4af455 jobs: include job duration and queue delay on /jobs page. 2022-11-30 17:56:14 -06:00
evazion
a07e6667b4 jobs: fix backwards job priorities.
Fix bug where jobs had the opposite of the intended priority. Populating saved searches had the
highest priority, while processing uploads had the lowest priority.

Caused by Delayed::Job and GoodJob having opposite interpretations of job priorities. In
Delayed::Job, lower numbers had higher priority, while in GoodJob, higher numbers have higher
priority. This was missed when migrating from Delayed::Job to GoodJob.
2022-11-30 17:56:10 -06:00
evazion
7d0d74a0f0 jobs: sort job classes by name in search form. 2022-11-30 14:43:04 -06:00
evazion
dd99e4bf6f media assets: add ability to search by duration. 2022-11-30 14:05:03 -06:00
evazion
6b109af7bb uploads: fixup bugs in 65a17979c and 05143dc9f.
* Fix exception in 65a17979c due to reference to `@media_asset` instead of `media_asset.
* Fix 05143dc9f not removing links to deleted images on the upload page.
2022-11-29 22:48:50 -06:00
evazion
65a17979c6 media assets: add Ascii2D reverse search link. 2022-11-29 22:20:43 -06:00
evazion
05143dc9fa media assets: remove image links for deleted images.
Don't show dead direct image links, reverse search links, or source links for deleted media assets.
2022-11-29 22:18:21 -06:00
evazion
a2d9154125 media assets: purge Cloudflare cache after deleting image files. 2022-11-29 21:23:40 -06:00
evazion
a048a704cb uploads: add reverse image search links to upload page.
On the upload page, change the file size info beneath the image to be formatted the same way as on
the media assets page, and to include a menu with links to offsite reverse image search tools.
2022-11-29 21:01:38 -06:00
evazion
756362f89e Fix #4990: Allow admins to delete uploads.
Allow admins to delete media asset files.

This only deletes the image file itself, not the upload or media asset record. The upload will still
be in the user's upload list, but the image will be gone. The media asset page will still exist, but
it will only show the file's metadata, not the image itself. We don't delete the metadata so we have
a record of what the file's MD5 was and who uploaded it, to prevent the file from being uploaded
again and to take action against the user if necessary.
2022-11-29 19:10:08 -06:00
evazion
695568e08b media assets: add options to download or reverse search the image. 2022-11-29 19:10:08 -06:00
evazion
ba8ff9e0a0 media assets: add link to Danbooru post beneath image.
On the show page, add a icon beneath the image linking to the Danbooru post if the asset has been posted.

FIXME: Downstream boorus should change the icon to something else.
2022-11-29 19:10:08 -06:00
evazion
0d651f24e6 Merge pull request #5359 from eltociear/patch-3
Fix typo in tag_mover.rb
2022-11-29 18:08:59 -06:00
Ikko Ashimine
b6f813067c Fix typo in tag_mover.rb
Initalize -> Initialize
2022-11-30 03:06:02 +09:00
evazion
580cc3bc9a Fix #5311: Unexpected error: Module::DelegationError on failed media assets. 2022-11-29 01:42:44 -06:00
evazion
2836b4b929 sources: fix 4chan URL parsing.
Add support for is2.4chan.org image URLs and various old URL formats.
2022-11-28 21:23:55 -06:00
evazion
068d435f56 controllers: fix index redirect param to not redirect to .html extension.
Fix searches like this:

* https://danbooru.donmai.u/wiki_pages?search[title]=touhou&redirect=true

To redirect to this:

* https://danbooru.donmai.u/wiki_pages/touhou

Instead of this:

* https://danbooru.donmai.u/wiki_pages/touhou.html

This also fixes redirects when searching for users on profile pages, and during pagination on media
asset show pages.
2022-11-28 17:09:36 -06:00
evazion
096efdee7b sources: add rule34.xxx, safebooru.org, and tbib.org site icons.
Fixes these sources incorrectly using the Gelbooru site icon.
2022-11-28 15:56:54 -06:00
evazion
937e6df7f7 media assets: show sources on show page.
Show sources on the media asset show page. An asset can have more than one source if the same
file is uploaded from multiple sites.

Only sources from known sites are shown. Sources from unknown sites aren't shown because they
could potentially contain private information or identify the uploader in some way.

Known issue: Twitter posts often show two sources, the direct image URL and the page URL. This is
because someone uploaded the direct image URL first, and we're not able to tell that the image URL
and the page URL are for the same tweet.
2022-11-28 00:17:16 -06:00
evazion
3a42866a20 media assets: fix show page to play Flash files. 2022-11-27 22:03:07 -06:00
evazion
b6acc81a17 media assets: fix show page to fit videos to screen height. 2022-11-27 22:01:34 -06:00
evazion
a5d4af332d media assets: redesign show page.
Redesign the media assets show page to:

* Include sidebar with AI tags and image metadata.
* Include next and previous image buttons.
* Make the image use 100% of the available screen space and to scroll with the window.
2022-11-27 21:32:45 -06:00
evazion
8a2f59172b Fix #5353: Username capitalization is wrong in reports. 2022-11-24 14:28:18 -06:00
evazion
c60577593f Fix #5356: settings: Extra space after 'Change email' link 2022-11-24 13:15:17 -06:00
evazion
81e8ac1fa8 notes: fix text boxes not being 100% width.
Fixup for 5559219f0.
2022-11-24 03:05:05 -06:00
evazion
5665346942 jobs: fix certain jobs not appearing in /jobs category dropdown. 2022-11-22 23:26:01 -06:00
evazion
5102e9d4e3 Fix #5261: empty wiki pages no longer show tag options. 2022-11-22 22:28:24 -06:00