Commit Graph

21 Commits

Author SHA1 Message Date
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
04359d67f4 discord: update /tagme command to use new autotagger service. 2022-06-27 01:40:44 -05:00
evazion
ae9495ec7c discord: allow only rating:g posts in SFW channels. 2022-06-08 17:36:49 -05:00
evazion
81bd86d202 posts: add "general" rating; rename "safe" rating to "sensitive".
* Add "general" rating.
* Rename "safe" rating to "sensitive".
* Change safe mode to include both rating:s and rating:g.
* Treat rating:safe as a synonym for rating:sensitive.
* Link "howto:rate" in the post edit form.
2022-05-22 13:38:45 -05:00
evazion
29e0139583 Fix #5135: /count Discord slash command broken with aliases and shortcuts. 2022-04-20 22:30:23 -05:00
evazion
6edff247f2 search: replace calls to PostQueryBuilder#fast_count with PostQuery#fast_count.
Prepare a few more places for the new tag search parser.
2022-03-30 01:37:11 -05:00
evazion
c4852b3486 rails: fix deprecated #to_s(:format) method.
Fix this deprecation:

    Deprecate passing a format to #to_s in favor of #to_formatted_s in
    Array, Range, Date, DateTime, Time, BigDecimal, Float and, Integer.

https://guides.rubyonrails.org/7_0_release_notes.html#active-support-deprecations
2022-02-01 13:19:50 -06:00
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
e04892fb38 posts: use 180x180 thumbnails in place of 150x150 thumbnails.
For small thumbnails, use 180x180 thumbnails scaled down to 150x150.
This is so we can get rid of 150x150 images and just use 180x180 for
both small and medium size thumbnails.

Also fix RSS feeds, XML sitemaps, and Discord embeds to use 360x360
thumbnails instead of 150x150 thumbnails.
2021-12-13 05:23:38 -06:00
Lily
22430f2ec1 Update post_embed.rb 2021-09-17 18:39:56 -03:00
evazion
5b208ddb78 discord: fix /posts command inside DMs
Fix a bug where the /posts command failed when used in a DM channel,
because we were trying to fetch a `nsfw` key that didn't exist.
2021-06-02 23:32:08 -05:00
evazion
178cf07690 discord: increase timeout of /count command. 2021-03-24 13:29:05 -05:00
evazion
1a7a108d47 discord: add /tagme command. 2021-03-19 04:44:22 -05:00
evazion
cebfe3308e discord: show favcount in post embeds. 2021-03-18 23:00:13 -05:00
evazion
d5903b61c4 discord: add function to register all commands.
* Add a `DiscordSlashCommand.register_slash_commands!` method to register
  all slash commands with the Discord API.
* Allow registering global commands.
* Refactor slash commands to use class attributes for the command
  name, description, and options.
2021-03-18 22:59:43 -05:00
evazion
f75b1ddb4a discord: add /time command. 2021-03-18 22:30:22 -05:00
evazion
28c0a48117 discord: fix tag search commands being limited to 2 tags. 2021-03-14 16:42:07 -05:00
evazion
f219fc09ec discord: add /wiki command. 2021-03-12 22:44:57 -06:00
evazion
698be2d0e4 discord: add /random command. 2021-03-11 21:23:20 -06:00
evazion
2c8c7ff80a discord: add initial slash command integration.
Add initial support for the `/count <tags>` and `/posts <tags>` slash commands.

Slash commands are basically like webhooks; we register a command, and
when anybody types that command in Discord, Discord sends us a HTTP
request that we respond to.

* https://discord.com/developers/docs/interactions/slash-commands
* https://support.discord.com/hc/en-us/articles/1500000368501-Slash-Commands-FAQ
2021-03-11 03:04:10 -06:00