Commit Graph

34 Commits

Author SHA1 Message Date
evazion
21dcf53dcb uploads: show similar images for disk uploads.
Fix the upload page so that it shows similar images (IQDB matches) for
files uploaded from your computer. Before this only worked for files
uploaded from a source.
2022-01-28 21:07:06 -06:00
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
1bb383703d iqdb: allow searching images by iqdb hash.
Example:

    https://danbooru.donmai.us/iqdb_queries?search[hash]=iqdb_3fe4c0bd5a88fab53fbe5104efdc43ba3fa094416e6e039cf880f9f1fafafafffc80fd7bfd7dfd80fe72fe79fe80fefafefdfeffff75ff79ff7aff7dfff1fffb000100020003000400080082008a00940184018802000287028c028f030004000600078308001080ef80f800f8fdf900fafdfc00fc7dfcfafe00fe72fefdff7effdffff0fff8fffcfffd0007000f001f003e0080008f0106018d02800282038003810403040806800683070b078007870d800d830f801f00f800f96cfa76fb00fb7efbf4fc00fcfdfd00fd74fdfbfe78fe7efef5fef9fefbfefeff6cff76ff7efffcfffe00070080008300860087008b01030106018002820283028503800402040a0502058b0d80

The hash may be obtained from a regular IQDB search, or by calculating
it yourself (an exercise for the reader).
2021-09-02 03:37:36 -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
cd501fe27b iqdb: switch to Danbooru::Http. 2020-06-14 01:06:51 -05:00
BrokenEagle
b9b1177832 Adds suport for using the image_url parameter with IQDB
This was only halfways supported, as the download module does not
have an image_url function. So for this, it just uses the url function,
which is just the original URL passed into the download function.

Additionally, it adds support to grab the largest available image,
which it does by using the file_url function of the downloads module.

- Fixes image_url parameter
- Adds file_url parameter
2020-05-24 00:58:46 +00:00
evazion
8fbf989e8e /iqdb_queries: support bare image_url param. 2019-10-23 10:46:36 -05:00
evazion
d2c6d6d17b iqdb: hide low similarity results behind "show" link. 2019-10-16 23:53:09 -05:00
evazion
ae521e600e iqdb: proxy iqdb searches through danbooru.
Previously the search form on the /iqdb_queries page submitted directly
to the iqdb service (karasuma.donmai.us), which redirected back to
Danbooru with the search results.

This was different than API requests, which submitted to
/iqdb_queries.json which proxied the call to iqdb through Danbooru.
Because of this, searches on the /iqdb_queries page had different
behavior than API requests. Things like filesize limits and referrer
spoofing were handled differently.

Now searches on the /iqdb_queries page submit directly to Danbooru. This
is simpler and it means that API requests and HTML requests have the
same behavior.
2019-10-14 21:16:04 -05:00
evazion
fa37b1edcd iqdb: lower similarity cutoff, return more results (fix #4190).
* Change cutoffs on upload page to max 5 results, min. 20% similarity.
* Change cutoffs on standalone /iqdb_queries page to max 20 results, min. 0% similarity.
* /iqdb_queries.json: add `limit` and `similarity` params to change default cutoffs.
2019-10-14 21:16:04 -05:00
evazion
ca54e2d67b iqdb: simplify ajax call.
Also add support for .xml responses to /iqdb_queries.
2019-10-14 21:16:04 -05:00
r888888888
7f85dd27f9 use image url for iqdb proxy 2018-08-29 20:56:24 -07:00
r888888888
5aae4b649f add xhr variant detection 2018-06-23 12:09:01 -07:00
r888888888
3ba5c6fb51 refactor iqdb endpoints 2018-06-23 10:59:04 -07:00
Albert Yi
56b40a0255 add iqdb preview 2018-06-22 16:41:13 -07:00
Albert Yi
e262295cf1 support json for iqdb query actions 2018-06-20 11:53:44 -07:00
Albert Yi
56ee44dc00 fixes to iqdb queries 2018-06-20 10:00:05 -07:00
Albert Yi
ed46e575c0 support url/post_id params on iqdb queries endpoint 2018-06-19 17:06:17 -07:00
Albert Yi
9510dead9f refactor iqdb query support 2018-06-19 14:16:12 -07:00
evazion
d8142a6c21 iqdb_queries_controller.rb: simplify show / check actions.
* Combine create_by_post + create_by_url. Rename to find_similar.
* Move iqdb enabled check to find_similar.
2018-04-07 18:03:01 -05:00
evazion
41a4ff15cd posts: remove unused file path / url methods.
* Remove file_path_for, cropped_file_url (dead code)
* Remove complete_preview_file_url (preview_file_url now returns absolute links)
* Remove `file_name` (only used for Download link in sidebar)
2018-03-20 19:49:55 -05:00
BrokenEagle
36ef8b4db3 Initial add of IQDB standalone page 2017-12-30 00:11:08 -08:00
evazion
0ed2dafdce /iqdb_queries: make available to anonymous users. 2017-07-06 19:18:45 -05:00
evazion
e15f955677 /iqdb_queries: support json/xml api responses. 2017-04-05 18:01:16 -05:00
evazion
c402e15cca /iqdb_queries: support both GET and POST; add GET /posts/1/similar. 2017-04-05 18:01:16 -05:00
evazion
0974ef8bd4 iqdbs: raise exception if not configured. 2017-04-05 01:17:04 -05:00
Albert Yi
7aab50f726 remove old iqdb code 2016-12-02 13:21:56 -08:00
Albert Yi
8e5331d234 fix for iqdb queries 2016-12-02 13:11:10 -08:00
Albert Yi
73ff94e920 integrate iqdbs 2016-11-30 16:38:00 -08:00
Toks
99fb4e60ab Fix iqdb
file was getting deleted before it got used
2014-11-07 02:39:15 -05:00
r888888888
7b1419c67e fix iqdb query path error 2014-06-02 13:46:33 -07:00
r888888888
bfd1924481 fixes #2155 2014-05-15 22:14:08 -07:00
r888888888
6de67da280 * Refactor iqdb response collection 2014-05-08 16:42:16 -07:00
r888888888
9e2c664a41 fixes #2130 2014-05-05 17:59:54 -07:00