forked from e621ng/e621ng
Update gems
And remove code that uses session.id
This commit is contained in:
parent
002c0cc4c4
commit
803e38f5cb
154
Gemfile.lock
154
Gemfile.lock
@ -15,60 +15,60 @@ GIT
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
actioncable (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
activejob (= 6.0.1)
|
||||
activerecord (= 6.0.1)
|
||||
activestorage (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
actionmailbox (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
activejob (= 6.0.1)
|
||||
actionmailer (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
rack (~> 2.0)
|
||||
actionpack (6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
activerecord (= 6.0.1)
|
||||
activestorage (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
actiontext (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
actionview (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
activejob (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
activemodel (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activemodel-serializers-xml (1.0.2)
|
||||
activemodel (> 5.x)
|
||||
activesupport (> 5.x)
|
||||
builder (~> 3.1)
|
||||
activerecord (6.0.1)
|
||||
activemodel (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
activestorage (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
activejob (= 6.0.1)
|
||||
activerecord (= 6.0.1)
|
||||
activerecord (6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activestorage (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.1)
|
||||
activesupport (6.0.2.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
@ -83,7 +83,7 @@ GEM
|
||||
bootsnap (1.4.5)
|
||||
msgpack (~> 1.0)
|
||||
buftok (0.2.0)
|
||||
builder (3.2.3)
|
||||
builder (3.2.4)
|
||||
byebug (11.0.1)
|
||||
capistrano (3.11.2)
|
||||
airbrussh (>= 1.0.0)
|
||||
@ -143,11 +143,11 @@ GEM
|
||||
erubi (1.9.0)
|
||||
factory_bot (5.1.1)
|
||||
activesupport (>= 4.2.0)
|
||||
faraday (0.17.0)
|
||||
faraday (0.17.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffaker (2.13.0)
|
||||
ffi (1.11.2)
|
||||
ffi (1.11.2-x64-mingw32)
|
||||
ffi (1.11.3)
|
||||
ffi (1.11.3-x64-mingw32)
|
||||
ffi-win32-extensions (1.0.3)
|
||||
ffi
|
||||
get_process_mem (0.2.5)
|
||||
@ -165,7 +165,7 @@ GEM
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (2.1.1)
|
||||
http_parser.rb (0.6.0)
|
||||
httparty (0.17.1)
|
||||
httparty (0.17.3)
|
||||
mime-types (~> 3.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.7.0)
|
||||
@ -174,13 +174,13 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.2.0)
|
||||
json (2.3.0)
|
||||
jwt (2.2.1)
|
||||
kgio (2.11.2)
|
||||
listen (3.2.0)
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
loofah (2.3.1)
|
||||
loofah (2.4.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
@ -198,12 +198,11 @@ GEM
|
||||
nokogiri (~> 1.6)
|
||||
ntlm-http (~> 0.1, >= 0.1.1)
|
||||
webrobots (>= 0.0.9, < 0.2)
|
||||
memoist (0.16.1)
|
||||
memoist (0.16.2)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
metaclass (0.0.4)
|
||||
method_source (0.9.2)
|
||||
mime-types (3.3)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.1009)
|
||||
mimemagic (0.3.3)
|
||||
@ -212,8 +211,7 @@ GEM
|
||||
minitest (5.13.0)
|
||||
minitest-ci (3.4.0)
|
||||
minitest (>= 5.0.6)
|
||||
mocha (1.9.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mocha (1.11.1)
|
||||
mock_redis (0.22.0)
|
||||
msgpack (1.3.1)
|
||||
msgpack (1.3.1-x64-mingw32)
|
||||
@ -233,9 +231,9 @@ GEM
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (6.7.0.359)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.5)
|
||||
nokogiri (1.10.7)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nokogiri (1.10.5-x64-mingw32)
|
||||
nokogiri (1.10.7-x64-mingw32)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nokogumbo (2.0.2)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
@ -246,8 +244,8 @@ GEM
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
pg (1.1.4)
|
||||
pg (1.1.4-x64-mingw32)
|
||||
pg (1.2.0)
|
||||
pg (1.2.0-x64-mingw32)
|
||||
pry (0.12.2)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
@ -257,8 +255,8 @@ GEM
|
||||
ptools (1.3.5)
|
||||
ptools (1.3.5-universal-mingw32)
|
||||
win32-file (>= 0.7.0)
|
||||
public_suffix (4.0.1)
|
||||
rack (2.0.7)
|
||||
public_suffix (4.0.2)
|
||||
rack (2.0.8)
|
||||
rack-protection (2.0.7)
|
||||
rack
|
||||
rack-proxy (0.6.5)
|
||||
@ -266,29 +264,29 @@ GEM
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
radix62 (1.0.1)
|
||||
rails (6.0.1)
|
||||
actioncable (= 6.0.1)
|
||||
actionmailbox (= 6.0.1)
|
||||
actionmailer (= 6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
actiontext (= 6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
activejob (= 6.0.1)
|
||||
activemodel (= 6.0.1)
|
||||
activerecord (= 6.0.1)
|
||||
activestorage (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
rails (6.0.2.1)
|
||||
actioncable (= 6.0.2.1)
|
||||
actionmailbox (= 6.0.2.1)
|
||||
actionmailer (= 6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
actiontext (= 6.0.2.1)
|
||||
actionview (= 6.0.2.1)
|
||||
activejob (= 6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activerecord (= 6.0.2.1)
|
||||
activestorage (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.1)
|
||||
railties (= 6.0.2.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
railties (6.0.2.1)
|
||||
actionpack (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
@ -296,12 +294,12 @@ GEM
|
||||
rake (13.0.1)
|
||||
rakismet (1.5.4)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.0)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
recaptcha (5.2.1)
|
||||
json
|
||||
redis (4.1.3)
|
||||
request_store (1.4.1)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
responders (3.0.0)
|
||||
actionpack (>= 5.0)
|
||||
@ -327,12 +325,12 @@ GEM
|
||||
shoulda-context (1.2.2)
|
||||
shoulda-matchers (4.1.2)
|
||||
activesupport (>= 4.2.0)
|
||||
sidekiq (6.0.3)
|
||||
sidekiq (6.0.4)
|
||||
connection_pool (>= 2.2.2)
|
||||
rack (>= 2.0.0)
|
||||
rack-protection (>= 2.0.0)
|
||||
redis (>= 4.1.0)
|
||||
sidekiq-unique-jobs (6.0.15)
|
||||
sidekiq-unique-jobs (6.0.18)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.5)
|
||||
sidekiq (>= 4.0, < 7.0)
|
||||
thor (~> 0)
|
||||
@ -378,12 +376,12 @@ GEM
|
||||
multipart-post (~> 2.0)
|
||||
naught (~> 1.0)
|
||||
simple_oauth (~> 0.3.0)
|
||||
tzinfo (1.2.5)
|
||||
tzinfo (1.2.6)
|
||||
thread_safe (~> 0.1)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.6)
|
||||
unicorn (5.5.1)
|
||||
unicorn (5.5.2)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
unicorn-worker-killer (0.4.4)
|
||||
@ -393,7 +391,7 @@ GEM
|
||||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
webpacker (4.2.0)
|
||||
webpacker (4.2.2)
|
||||
activesupport (>= 4.2)
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 4.2)
|
||||
@ -410,7 +408,7 @@ GEM
|
||||
win32-file-stat (1.5.5)
|
||||
ffi
|
||||
ffi-win32-extensions
|
||||
zeitwerk (2.2.1)
|
||||
zeitwerk (2.2.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -1,8 +1,4 @@
|
||||
module PostsHelper
|
||||
def post_search_counts_enabled?
|
||||
Danbooru.config.enable_post_search_counts && Danbooru.config.reportbooru_server.present? && Danbooru.config.reportbooru_key.present?
|
||||
end
|
||||
|
||||
def discover_mode?
|
||||
params[:tags] =~ /order:rank/
|
||||
end
|
||||
@ -21,43 +17,6 @@ module PostsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def missed_post_search_count_js
|
||||
return nil unless post_search_counts_enabled?
|
||||
|
||||
if params[:ms] == "1" && @post_set.post_count == 0 && @post_set.is_single_tag?
|
||||
session_id = session.id
|
||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
||||
sig = verifier.generate("#{params[:tags]},#{session_id}")
|
||||
return render("posts/partials/index/missed_search_count", sig: sig)
|
||||
end
|
||||
end
|
||||
|
||||
def post_search_count_js
|
||||
return nil unless post_search_counts_enabled?
|
||||
|
||||
if action_name == "index" && params[:page].nil?
|
||||
tags = Tag.scan_query(params[:tags]).sort.join(" ")
|
||||
|
||||
if tags.present?
|
||||
key = "ps-#{tags}"
|
||||
value = session.id
|
||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
|
||||
sig = verifier.generate("#{key},#{value}")
|
||||
return render("posts/partials/index/search_count", sig: sig)
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
def post_view_count_js
|
||||
return nil unless post_search_counts_enabled?
|
||||
|
||||
msg = "#{params[:id]},#{session.id}"
|
||||
msg = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256").generate(msg)
|
||||
return render("posts/partials/show/view_count", msg: msg)
|
||||
end
|
||||
|
||||
def post_source_tag(source)
|
||||
|
||||
if source =~ %r!\Ahttp://img\d+\.pixiv\.net/img/([^\/]+)/!i
|
||||
|
@ -42,9 +42,6 @@
|
||||
<%= render "posts/partials/index/excerpt", :post_set => @post_set %>
|
||||
<%= render "posts/partials/index/posts", :post_set => @post_set %>
|
||||
</section>
|
||||
|
||||
|
||||
<%= post_search_count_js %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -65,6 +62,5 @@
|
||||
<% if prev_page_url %>
|
||||
<%= tag.link rel: "prev", href: prev_page_url %>
|
||||
<% end %>
|
||||
<%= missed_post_search_count_js %>
|
||||
<%= render "posts/partials/index/seo_meta_tags" %>
|
||||
<% end %>
|
||||
|
@ -1,7 +1 @@
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$.post("<%= Danbooru.config.reportbooru_server %>/post_views", {
|
||||
msg: "<%= msg %>"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -180,13 +180,11 @@
|
||||
<% if @fixup_post_url %>
|
||||
<script>
|
||||
// This just fixes up the history path for this page so you don't end up getting the wrong url when navigating.
|
||||
history.replaceState({}, "", <%= post_path(@post, q: params[:q]).to_json.html_safe %>);
|
||||
history.pushState({}, "", <%= post_path(@post, q: params[:q]).to_json.html_safe %>);
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= post_view_count_js %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@ -204,10 +202,6 @@
|
||||
<%= tag.meta name: "og:image", content: @post.open_graph_image_url %>
|
||||
<% end %>
|
||||
|
||||
<% if Danbooru.config.enable_post_search_counts %>
|
||||
<meta name="report-server" content="<%= Danbooru.config.reportbooru_server %>">
|
||||
<% end %>
|
||||
|
||||
<%= tag.meta name: "canonical", content: post_url(@post, host: Danbooru.config.hostname, protocol: "https") %>
|
||||
|
||||
<%# Twitter properties %>
|
||||
|
Loading…
Reference in New Issue
Block a user