Commit Graph

12056 Commits

Author SHA1 Message Date
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
evazion
c8e3f957da tests: fix broken tests. 2022-11-22 22:10:52 -06:00
evazion
b234727832 tags: ensure aliased tag categories stay in sync.
* When a tag's category is changed, also change the category of any aliases pointing to it. For
  example, if "ff7" is aliased to "final_fantasy_vii", and "final_fantasy_vii" is changed to a
  copyright tag, then change the empty "ff7" tag to be a copyright tag too.

* Don't allow changing the category of an aliased tag. For example, if "ff7" is aliased to
  "final_fantasy_vii", then don't allow changing the "ff7" tag to be a non-copyright tag.

This ensures that the categories of aliased tags stay in sync with that of their parent tags. This
way aliased tags are colored correctly in wikis and other places.
2022-11-22 22:00:23 -06:00
evazion
1a9718250f replacements: strip spaces from replacement URL.
Fix a handful of replacements having a replacement URL with a space in front or at the end.
This caused problems when searching by replacement URL.
2022-11-21 17:47:56 -06:00
evazion
2d2b465ef8 media assets: don't redistribute original file when regenerating thumbnails.
When regenerating thumbnails for a media asset, don't redistribute the original file. This is
unnecessary and also slow if it's a large file on remote storage.
2022-11-21 15:46:17 -06:00
evazion
2d83500885 sources: fix dummy names being suggested as other names.
Fix placeholder names like weibo_1234, bilibili_1234, nijie1234, and nicoseiga1234 being suggested
as Other Names when creating new artist entries. These are meant to be placeholders for the tag
name, not used as other names.
2022-11-21 14:55:10 -06:00
evazion
5559219f0a ui: hide DText "Formatting help" link in dialog boxes.
Hide the "Formatting help" link for single-line DText fields in dialog boxes, such as after the
"Reason" field in the flag, appeal, and report dialog boxes.
2022-11-21 14:23:49 -06:00
evazion
bc5ca71bdf search: fix post count caching for the date: metatag.
The `date:` metatag depends on the current user's time zone, so the post count for `date:` searches
needs to be cached separately for different users, otherwise it could lead to incorrect page counts
if two users with different time zones search for the same `date:` metatag at the same time.
2022-11-21 00:16:36 -06:00
evazion
ba1cf14c7e uploads: mark uploads as failed if they're stuck processing for more than 4 hours. 2022-11-20 23:41:07 -06:00
evazion
570d6a9d01 storage manager: close file after copying it. 2022-11-20 23:13:57 -06:00
evazion
ee3a7159ea cloudflare: mark cloudflare API calls as external. 2022-11-20 22:40:20 -06:00
evazion
f9b8e83bb0 emails: fix deliverability check when MX lookup returns nonexistent domain.
Fix the email deliverability check to return undeliverable when the MX lookup returns a domain or IP
address that is invalid or that refuses connections. For example, `yeah.com` returns the invalid IP
address 0.0.0.0 for its MX record.
2022-11-20 22:39:12 -06:00
evazion
80faee67db forum: fix mod action when forum post is deleted.
Fix forum posts logging an "updated forum #1234" mod action instead of a "deleted forum #1234" mod
action when a forum post was deleted.
2022-11-20 22:24:55 -06:00
evazion
1e478ab1b5 favgroups: add stricter favgroup naming rules.
Don't allow favgroup names that:

* Start or end with underscores.
* Contain multiple underscores in a row.
* Contain asterisks or non-printable characters.
* Consist of only underscores.
* Consist of only digits (conflicts with `favgroup:1234` syntax).

Add a fix script that fixes favgroups that violate these rules and notifies the user.
2022-11-20 22:09:57 -06:00
evazion
4fd028a5ce artists: fix ban/unban actions.
Fix the ban! and unban! methods to:

* Lock the artist while it is being banned or unbanned.
* Perform the edits as a mass update, so that the posts are updated in parallel.
* Edit the artist as the banner rather than as the current user.
* Soft delete the banned_artist implication when an artist is unbanned instead of hard deleting it.
* Ignore the banned_artist implication if it's deleted.
2022-11-20 19:25:20 -06:00
evazion
01c6d11253 bans: validate ban duration is standard length. 2022-11-20 17:10:20 -06:00
evazion
001ce99dd3 feedbacks: don't send redundant dmails when user is banned or loses approver status.
When a user is banned, send them a "You have been banned" dmail instead of a "Your user record has
been updated" dmail.

When a user loses approver status due to inactivity, don't seen them a "Your user record has been
updated" dmail for the "Lost approver privileges" neutral feedback they receive.
2022-11-20 17:10:20 -06:00
evazion
bbe32f5e5d feedbacks: update messaging about negative feedbacks.
Update wording about negative feedbacks on the new feedback page, and on the Dmail you receive when
you receive a negative feedback.
2022-11-20 17:10:20 -06:00
evazion
cc13c5cd57 feedbacks: fix mod action when feedback is deleted.
Fix feedbacks logging an "updated user feedback" mod action instead of a "deleted user feedback"
mod action when a feedback was deleted.
2022-11-20 15:29:46 -06:00
evazion
d99da72744 4chan: fix commentary linebreaks. 2022-11-20 14:34:25 -06:00
evazion
d63d0b1adc uploads: add archives filetypes to file upload component. 2022-11-20 14:30:02 -06:00
evazion
468754702e docker: upgrade openresty and exiftool versions. 2022-11-19 21:34:38 -06:00
evazion
f8d2758f8b uploads: fix sources for 4chan uploads.
Fix a bug where, if you were uploading an entire 4chan thread, then the source of each post would
get set to the 4chan thread, rather than to the individual 4chan post.
2022-11-18 21:27:10 -06:00
evazion
902cd0bbdf sources: add 4chan.org upload support.
Add upload support for 4chan.org. You can upload either individual posts or entire threads at a time.
2022-11-18 01:23:15 -06:00
evazion
94824fb171 bilibili: fix API calls returning HTTP 412.
Fix API calls returning HTTP 412 (Precondition Failed) errors. It seems we need to spoof the Referer as
`https://bilibili.com` for API calls to succeed.
2022-11-16 22:26:01 -06:00
evazion
96e1b6a512 Fix #5063: Support downloading ArtStation video clips. 2022-11-16 22:26:01 -06:00
evazion
869fddbb1a tests: fix broken tests. 2022-11-16 22:26:01 -06:00
evazion
a747911df8 foundation: fix foundation.app/@name/~/$id type URLs.
Fix URLs like this not working:

    https://foundation.app/@mochiiimo/~/97376

The correct URL is now:

    https://foundation.app/@mochiiimo/foundation/97376
2022-11-16 22:26:01 -06:00
evazion
491cce2f8c Update Ruby gems and Yarn packages. 2022-11-16 22:26:01 -06:00
evazion
6798e2ccf5 Merge pull request #5348 from nottalulah/patch-2
fix category text formatting in CategorizedTagList template
2022-11-16 17:21:16 -06:00
evazion
2deae38a4e uploads: allow uploading .zip, .rar., and .7z files from disk.
Allow uploading .zip, .rar, and .7z files from disk. The archive will be extracted and the images
inside will be uploaded.

This only works for archive files uploaded from disk, not from a source URL.

Post source URLs will look something like this: "file://foo.zip/1.jpg", "file://foo.zip/2.jpg", etc.
Sometimes artists uses Shift JIS or other encodings instead of UTF-8 for filenames. In these cases
we just assume the filename is UTF-8 and replace invalid characters with '?', so filenames might be
wrong in some cases.

There are various protections to prevent uploading malicious archive files:

* Archives with more than 100 files aren't allowed.
* Archives that decompress to more than 100MB aren't allowed.
* Archives with filenames containing '..' components aren't allowed (e.g. '../../../../../etc/passwd').
* Archives with filenames containing absolute paths aren't allowed (e.g. '/etc/passwd').
* Archives containing symlinks aren't allowed (e.g. 'foo -> /etc/passwd').
* Archive types other than .zip, .rar, and .7z aren't allowed (e.g. .tar.gz, .cpio).
* File permissions, owners, and other metadata are ignored.

Partial fix for #5340: Add support for extracting archive attachments from certain sources
2022-11-16 16:47:37 -06:00
evazion
d791924aad posts: fix /posts/random?tags=... redirect.
Fix /posts/random?tags=touhou to redirect to /posts/1234?q=touhou instead of /posts/1234?tags=touhou.

Fixes the search bar on random posts not containing the current search.
2022-11-15 19:38:43 -06:00
evazion
bc169fc98c posts: fix exception in random:1 filetype:png. 2022-11-15 19:33:25 -06:00
evazion
e935f01358 uploads: fix temp files not being cleaned up quickly enough.
Fix temp files generated during the upload process not being cleaned up quickly enough. This included
downloaded files, generated preview images, and Ugoira video conversions.

Before we relied on `Tempfile` cleaning up files automatically. But this only happened when the
Tempfile object was garbage collected, which could take a long time. In the meantime we could have
hundreds of megabytes of temp files hanging around.

The fix is to explicitly close temp files when we're done with them. But the standard `Tempfile`
class doesn't immediately delete the file when it's closed. So we also have to introduce a
Danbooru::Tempfile wrapper that deletes the tempfile as soon as it's closed.
2022-11-15 18:50:50 -06:00
evazion
21a779455f discord: fix /tagme command to work with html page URLs. 2022-11-15 15:22:56 -06:00
evazion
aa21f002be tests: fix cleanup of upload temp files.
Fix upload temp files sometimes not being cleaned up when tests exit.
2022-11-15 15:16:50 -06:00