Commit Graph

16 Commits

Author SHA1 Message Date
evazion
07e23204b6 rubocop: fix various Rubocop warnings. 2021-06-17 04:17:53 -05:00
evazion
0f36bbf8d3 iqdb: update API client to use new version of IQDB.
Replace the old IQDB API client with a new client for the new forked
version of IQDB at https://github.com/danbooru/iqdb.

Changes:

* The /iqdb_queries endpoint now returns `hash` and `signature` fields.
  The `signature` is the full decoded Haar signature, while the `hash`
  is a encoded version of the signature.
* The /iqdb_queries endpoint no longer returns `width` and `height`
  fields in the response (these were always 128x128).
* We no longer need the IQDBs frontend server, now we talk to the IQDB
  instance directly.
* We no longer send add/remove image commands to IQDB through AWS SQS,
  now we send them to IQDB directly. They are sent in a delayed job so
  that if IQDB is down, uploading images is still possible, the add
  image commands will just get queued up.
* Fix a bug where regenerating an image's thumbnails didn't regenerate
  IQDB, because IQDB silently ignored add image commands when the image
  already existed in the database.
2021-06-16 05:36:24 -05:00
evazion
50e799e959 Merge branch 'master' into minor_fix 2021-01-04 01:30:28 -06:00
evazion
dbb66ace90 routes: replace hardcoded routes in models with route helpers.
Add a Routes module that gives models access to route helpers outside of
views, and use it to replace various hardcoded routes.
2020-12-24 00:17:19 -06:00
nonamethanks
7464446f64 Post replacements: fix replacement message
It's incorrect to say that a new image was used, since we also host
videos. See for example https://danbooru.donmai.us/posts/3114352
2020-12-09 10:01:24 +01:00
evazion
b551e3634f Fix misc rubocop warnings. 2020-06-16 21:36:15 -05:00
evazion
b4ce2d83a6 models: remove belongs_to_creator macro.
The belongs_to_creator macro was used to initialize the creator_id field
to the CurrentUser. This made tests complicated because it meant you had
to create and set the current user every time you wanted to create an
object, when lead to the current user being set over and over again. It
also meant you had to constantly be aware of what the CurrentUser was in
many different contexts, which was often confusing. Setting creators
explicitly simplifies everything greatly.
2020-01-21 00:09:38 -06:00
evazion
153a8339ab Inherit errors from StandardError instead of Exception. 2020-01-11 19:07:28 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
evazion
518de2fdec cloudflare: fix purging of cached urls.
* Switch CloudflareService from HttpartyCache to Danbooru::Http.

* Purge cached urls from Cloudflare when a post is replaced and the md5
  doesn't change. This happens when a corrupted image is replaced or
  thumbnails are regenerated. Before we purged urls when a post was
  expunged, which was unneeded because those urls can expire naturally.
  It was also wrong because the subdomains were hardcoded, the urls used
  http:// instead of https://, and we didn't account for tagged urls.
2019-12-15 14:03:15 -06:00
evazion
8408c0bf80 Fix #3815: Adjust notes positions/sizes after post replacement
Bug: Notes weren't rescaled when the 'final_source' field was given
during replacement.

The cause was that the notes were rescaled after the source was saved,
but saving the source clobbered `image_{width,height}_before_last_save`
inside `rescale_notes`.

Regressed in b0c2ddba.
2018-12-16 13:55:35 -06:00
evazion
3414d27c78 post replacements: fix self-replacements; don't swallow upload errors. 2018-09-23 10:51:16 -05:00
Albert Yi
e58172483b update iqdb after post replacements (#3885) 2018-09-11 12:24:15 -07:00
Albert Yi
b0bd20c436 fixes #3855 2018-09-04 11:34:46 -07:00
Albert Yi
762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
Albert Yi
ac28c92fbd refactor upload service 2018-07-06 11:52:43 -07:00