Commit Graph

12107 Commits

Author SHA1 Message Date
0cd58316d9 Add some missing build deps 2022-12-28 04:27:49 +00:00
892a374382 Fix sha256 for matrix 2022-12-28 04:27:37 +00:00
c31e556482 Get bundix working for the most part 2022-12-28 04:14:07 +00:00
096f7b4382 Manually add in gemset configs 2022-12-28 04:13:12 +00:00
78825612b6 Try and fix bundix -m 2022-12-28 00:44:11 +00:00
f808da99ce Try and fix bundix issues 2022-12-28 00:36:24 +00:00
dac49b30c6 Generate gemset.nix with bundix -l 2022-12-21 20:20:52 +00:00
3078359df1 Initial flake.nix 2022-12-21 20:19:57 +00:00
evazion
1c2042285f css: replace more css with tailwind-style classes. 2022-12-11 21:29:19 -06:00
evazion
fc7bc64d4c css: fix empty space in paginator on mobile.
Fix the hidden "..." icon causing a gap between the page number and the right arrow on mobile.
2022-12-11 17:34:18 -06:00
evazion
6f9dbb65e0 icons: reduce size of github logo.
Reduce resolution from 512x512 -> 32x32 and filesize from 45kb -> 2.7kb.
2022-12-11 04:36:26 -06:00
evazion
ea4daec58d posts: fix shift+e keyboard shortcut not working.
Broken in da6a61b4e.
2022-12-11 04:21:27 -06:00
evazion
da6a61b4e7 css: switch to SVG sprites for icons.
Switch to using SVG sprites for icons, instead of using a combination of icon fonts and inline SVG elements.

This means there's a single icons.svg file containing all icons, and icons are referenced like
`<svg><use href="/icons.svg#arrow-alt-up"/></svg>`.

This should make icons more efficient since a) it replaces an 80kb icon font file with a 8kb SVG
file and b) it replaces repeated inline copies of the same icon with references to the sprite sheet.
This most notably affects the upvote and downvote buttons.

This also updates icons from Font Awesome 5 to Font Awesome 6, which fixes a few minor icon
alignment issues in some places.

ref: https://fontawesome.com/docs/web/add-icons/svg-sprites
2022-12-11 02:16:01 -06:00
evazion
20a2652c1e pawoo: fix tests. 2022-12-10 19:12:46 -06:00
evazion
993e4fd62f Fix #5366: Baraag broken.
* Use fixed access tokens instead of fetching an access token with the OAuth flow. This assumes
  access tokens won't expire, which seems to be true for the default app-level access token, unless
  you manually regenerate it. Fixes the OAuth flow not working on Baraag for some reason.

* Eliminate the MastodonApiClient class. Just inline it in the extractor instead.

Downstream users will need to update their configs to set the `pawoo_access_token` and
`baraag_access_token` config options.
2022-12-10 18:27:05 -06:00
evazion
15bdf7d6cf Fix #5370: TypeError updating bans without selecting duration. 2022-12-10 17:12:34 -06:00
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