diff --git a/app/assets/stylesheets/forum_post_votes_controller.scss b/app/assets/stylesheets/forum_post_votes_controller.scss deleted file mode 100644 index 5aac47c6d..000000000 --- a/app/assets/stylesheets/forum_post_votes_controller.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the ForumPostVotesController controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/specific/dropzone.scss b/app/assets/stylesheets/specific/dropzone.scss new file mode 100644 index 000000000..a3c33331e --- /dev/null +++ b/app/assets/stylesheets/specific/dropzone.scss @@ -0,0 +1,41 @@ +#filedropzone { + border: 4px dashed #DDD; + padding: 0; + min-height: 100px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + + .placeholder { + font-style: italic; + color: #333; + height: 100%; + } + + &.error { + border-color: darken(#f2dede, 30%); + background-color: #f2dede; + } + + &.success { + border-color: darken(#dff0d8, 30%); + background-color: #dff0d8; + } +} + +.dz-preview { + margin-bottom: 1em; +} + +.dz-progress { + height: 20px; + width: 300px; + border: 1px solid #CCC; + + .dz-upload { + background-color: #F5F5FF; + display: block; + height: 20px; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/specific/iqdb_queries.scss b/app/assets/stylesheets/specific/iqdb_queries.scss index cab8d0f3b..5386b552d 100644 --- a/app/assets/stylesheets/specific/iqdb_queries.scss +++ b/app/assets/stylesheets/specific/iqdb_queries.scss @@ -9,5 +9,9 @@ div#c-iqdb-queries { margin-top: 10px; } } + + #filedropzone { + margin: 1em 0; + } } } diff --git a/app/assets/stylesheets/specific/uploads.scss b/app/assets/stylesheets/specific/uploads.scss index 1cc7bece5..49b71d0b1 100644 --- a/app/assets/stylesheets/specific/uploads.scss +++ b/app/assets/stylesheets/specific/uploads.scss @@ -34,48 +34,6 @@ div#c-uploads { div.field_with_errors { display: inline; } - - #filedropzone { - border: 4px dashed #DDD; - padding: 0; - min-height: 100px; - display: flex; - align-items: center; - justify-content: center; - border-radius: 4px; - - .placeholder { - font-style: italic; - color: #333; - height: 100%; - } - - &.error { - border-color: darken(#f2dede, 30%); - background-color: #f2dede; - } - - &.success { - border-color: darken(#dff0d8, 30%); - background-color: #dff0d8; - } - } - - .dz-preview { - margin-bottom: 1em; - } - - .dz-progress { - height: 20px; - width: 300px; - border: 1px solid #CCC; - - .dz-upload { - background-color: #F5F5FF; - display: block; - height: 20px; - } - } } div#a-index { diff --git a/app/controllers/iqdb_queries_controller.rb b/app/controllers/iqdb_queries_controller.rb index ee865c974..b18425361 100644 --- a/app/controllers/iqdb_queries_controller.rb +++ b/app/controllers/iqdb_queries_controller.rb @@ -1,29 +1,12 @@ -# todo: move this to iqdbs class IqdbQueriesController < ApplicationController respond_to :html, :json, :xml def show - @results = find_similar - - respond_with(@results) do |fmt| - fmt.html { render :layout => false, :action => "create_by_url" } - fmt.js { render :layout => false, :action => "create_by_post" } + if params[:matches] + @matches = JSON.parse(params[:matches]) + @matches = @matches.map {|x| [Post.find(x[0]), x[1]]} end - end - def check - @results = find_similar - respond_with(@results) - end - - # Support both POST /iqdb_queries and GET /iqdb_queries. - alias_method :create, :show - -protected - def find_similar - return [] if params[:url].blank? && params[:post_id].blank? - - params[:url] = Post.find(params[:post_id]).preview_file_url if params[:post_id].present? - Iqdb::Download.find_similar(params[:url]) + respond_with(@matches) end end diff --git a/app/logical/upload_service.rb b/app/logical/upload_service.rb index 58ace4ff5..7a48e5234 100644 --- a/app/logical/upload_service.rb +++ b/app/logical/upload_service.rb @@ -192,7 +192,7 @@ class UploadService # in case this upload never finishes processing, we need to delete the # distributed files in the future Danbooru.config.other_server_hosts.each do |host| - UploadService::Utils.delay(queue: host, run_at: 10.minutes.from_now).delete_file(upload.md5, upload.file_ext, upload.id) + UploadService::Utils.delay(queue: host, run_at: 30.minutes.from_now).delete_file(upload.md5, upload.file_ext, upload.id) end end diff --git a/app/views/iqdb_queries/check.html.erb b/app/views/iqdb_queries/check.html.erb deleted file mode 100644 index 891fdc4d0..000000000 --- a/app/views/iqdb_queries/check.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -
No matches found
- <% end %> -You can upload a file or paste a URL to perform an image similarity search with every upload on <%= Danbooru.config.app_name %>. Note that this page will redirect you to <%= link_to "IQDBS", Danbooru.config.iqdbs_server %>. You will be redirected back here once the search is executed.
+ + <%= form_tag("#{Danbooru.config.iqdbs_server}/similar", method: :post, class: "simple_form", multipart: true ) do %> + <%= hidden_field_tag "callback", iqdb_queries_url %> + +No matches found
+ <% end %> +