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.
This commit is contained in:
evazion
2021-06-16 05:14:15 -05:00
parent 5b208ddb78
commit 0f36bbf8d3
22 changed files with 136 additions and 164 deletions

View File

@@ -481,11 +481,12 @@ module Danbooru
def reportbooru_key
end
# The URL for the IQDBs server (https://github.com/evazion/iqdbs).
# Optional. Used for dupe detection and reverse image searches.
# Set to http://localhost/mock/iqdbs to enable a fake iqdb server for
# The URL for the IQDB server (https://github.com/danbooru/iqdb). Optional.
# Used for dupe detection and reverse image searches. Set this to
# http://localhost:3000/mock/iqdb to enable a fake iqdb server for
# development purposes.
def iqdbs_server
def iqdb_url
# "http://localhost:3000/mock/iqdb"
end
def aws_credentials
@@ -501,9 +502,6 @@ module Danbooru
def aws_sqs_region
end
def aws_sqs_iqdb_url
end
def aws_sqs_archives_url
end

View File

@@ -329,8 +329,8 @@ Rails.application.routes.draw do
get "/mock/reportbooru/missed_searches" => "mock_services#reportbooru_missed_searches", as: "mock_reportbooru_missed_searches"
get "/mock/reportbooru/post_searches/rank" => "mock_services#reportbooru_post_searches", as: "mock_reportbooru_post_searches"
get "/mock/reportbooru/post_views/rank" => "mock_services#reportbooru_post_views", as: "mock_reportbooru_post_views"
get "/mock/iqdbs/similar" => "mock_services#iqdbs_similar", as: "mock_iqdbs_similar"
post "/mock/iqdbs/similar" => "mock_services#iqdbs_similar"
get "/mock/iqdb/query" => "mock_services#iqdb_query", as: "mock_iqdb_query"
post "/mock/iqdb/query" => "mock_services#iqdb_query"
match "*other", to: "static#not_found", via: :all
end