diff --git a/.ruby-version b/.ruby-version index 6d5369b9..61a52c91 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.4 +ruby-3.4.9 diff --git a/Dockerfile b/Dockerfile index 7355509c..54f4c819 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3.4-alpine AS builder +FROM ruby:3.4.9-alpine AS builder WORKDIR /app ENV RAILS_ENV="production" \ @@ -32,7 +32,7 @@ RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails shakapacker:compile && \ RUN yarn install --production && \ yarn cache clean -FROM ruby:3.3.4-alpine AS runner +FROM ruby:3.4.9-alpine AS runner WORKDIR /app diff --git a/Gemfile b/Gemfile index d123f25e..4cb5b6a9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,14 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '~> 3.3.4' +ruby '~> 3.4.0' # gem 'turbo-rails', '~> 2.0.6' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 7.1.3.4' +gem 'rails', '~> 8.1.0' # Use Puma as the app server -gem 'puma', '~> 6.4.3' +gem 'puma', '~> 7.0' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker @@ -17,8 +17,7 @@ gem 'shakapacker', '~> 8.0.1' # gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.12.0' -# Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 4.0' +gem 'redis', '~> 5.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' @@ -31,14 +30,14 @@ gem 'feedjira', '~> 3.2.3' gem 'rack-attack' # Logger -gem 'bitquery_logger', git: 'https://github.com/bitquery/bitquery_logger.git', tag: 'v0.7.9' # , path: '../bitquery_logger' -gem 'exception_notification' -gem 'exception_notification-rake', '~> 0.3.1' +gem 'bitquery_logger', path: 'vendor/bitquery_logger' +gem 'exception_notification', '~> 5.0' gem 'lograge' gem 'logstash-event' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '~> 1.18.3', require: false +gem 'csv' group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. diff --git a/Gemfile.lock b/Gemfile.lock index 34536d18..1365ad0a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,8 @@ -GIT - remote: https://github.com/bitquery/bitquery_logger.git - revision: 233e44a43d4c10881197b16dc773a513ab0ae7aa - tag: v0.7.9 +PATH + remote: vendor/bitquery_logger specs: bitquery_logger (0.7.9) - exception_notification (~> 4.5.0) - exception_notification-rake (~> 0.3.1) + exception_notification (>= 4.5.0, < 6) logstash-logger (~> 0.26.1) oj (~> 3.13.16) oj_mimic_json (~> 1.0.1) @@ -13,164 +10,170 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + action_text-trix (2.1.19) + railties + actioncable (8.1.3) + actionpack (= 8.1.3) + activesupport (= 8.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (8.1.3) + actionpack (= 8.1.3) + activejob (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) + mail (>= 2.8.0) + actionmailer (8.1.3) + actionpack (= 8.1.3) + actionview (= 8.1.3) + activejob (= 8.1.3) + activesupport (= 8.1.3) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (8.1.3) + actionview (= 8.1.3) + activesupport (= 8.1.3) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (8.1.3) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (8.1.3) + activesupport (= 8.1.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (8.1.3) + activesupport (= 8.1.3) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (8.1.3) + activesupport (= 8.1.3) + activerecord (8.1.3) + activemodel (= 8.1.3) + activesupport (= 8.1.3) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (8.1.3) + actionpack (= 8.1.3) + activejob (= 8.1.3) + activerecord (= 8.1.3) + activesupport (= 8.1.3) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (8.1.3) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - airbrussh (1.5.2) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + airbrussh (1.6.1) sshkit (>= 1.6.1, != 1.7.0) - anyway_config (2.6.4) + anyway_config (2.8.0) ruby-next-core (~> 1.0) - ast (2.4.2) - base64 (0.2.0) + ast (2.4.3) + base64 (0.3.0) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - bigdecimal (3.1.8) + bigdecimal (4.1.2) bindex (0.8.1) binding_of_caller (1.0.1) debug_inspector (>= 1.2.0) - bootsnap (1.18.3) + bootsnap (1.18.6) msgpack (~> 1.2) builder (3.3.0) - capistrano (3.19.1) + capistrano (3.19.2) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (2.1.0) + capistrano-bundler (2.2.0) capistrano (~> 3.1) - capistrano-rails (1.6.3) + capistrano-rails (1.7.0) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) crass (1.0.6) - date (3.3.4) + csv (3.3.5) + date (3.5.1) debug_inspector (1.2.0) - dotenv (3.1.2) - dotenv-rails (3.1.2) - dotenv (= 3.1.2) + dotenv (3.1.8) + dotenv-rails (3.1.8) + dotenv (= 3.1.8) railties (>= 6.1) - drb (2.2.1) - dry-initializer (3.1.1) - erubi (1.13.0) + drb (2.2.3) + dry-initializer (3.2.0) + erb (6.0.4) + erubi (1.13.1) eventmachine (1.2.7) - exception_notification (4.5.0) - actionmailer (>= 5.2, < 8) - activesupport (>= 5.2, < 8) - exception_notification-rake (0.3.1) - exception_notification (~> 4.3) - rake (>= 0.9.0) + exception_notification (5.0.1) + actionmailer (>= 7.1, < 9) + activesupport (>= 7.1, < 9) faye-websocket (0.12.0) eventmachine (>= 0.12.0) websocket-driver (>= 0.8.0) - feedjira (3.2.3) + feedjira (3.2.6) + logger (>= 1.0, < 2) loofah (>= 2.3.1, < 3) sax-machine (>= 1.0, < 2) - ffi (1.17.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) - globalid (1.2.1) + ffi (1.17.4) + ffi (1.17.4-aarch64-linux-gnu) + ffi (1.17.4-aarch64-linux-musl) + ffi (1.17.4-arm-linux-gnu) + ffi (1.17.4-arm-linux-musl) + ffi (1.17.4-arm64-darwin) + ffi (1.17.4-x86-linux-gnu) + ffi (1.17.4-x86-linux-musl) + ffi (1.17.4-x86_64-darwin) + ffi (1.17.4-x86_64-linux-gnu) + ffi (1.17.4-x86_64-linux-musl) + fiber-storage (1.0.1) + globalid (1.3.0) activesupport (>= 6.1) - graphql (2.3.10) + graphql (2.6.3) base64 - graphql-client (0.23.0) + fiber-storage + logger + graphql-client (0.26.0) activesupport (>= 3.0) graphql (>= 1.13.0) - i18n (1.14.5) + i18n (1.14.8) concurrent-ruby (~> 1.0) - io-console (0.7.2) - irb (1.14.0) + io-console (0.8.2) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.12.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.7.2) - language_server-protocol (3.17.0.3) + json (2.19.8) + language_server-protocol (3.17.0.5) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) lograge (0.14.0) actionpack (>= 4) activesupport (>= 4) @@ -179,129 +182,175 @@ GEM logstash-event (1.2.02) logstash-logger (0.26.1) logstash-event (~> 1.2) - loofah (2.22.0) + loofah (2.25.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) + marcel (1.2.1) mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.24.1) - msgpack (1.7.2) - mutex_m (0.2.0) - net-imap (0.4.14) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) + msgpack (1.8.3) + net-imap (0.6.4.1) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-scp (4.0.0) + net-scp (4.1.0) net-ssh (>= 2.6.5, < 8.0.0) net-sftp (4.0.0) net-ssh (>= 5.0.0, < 8.0.0) - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - net-ssh (7.2.3) - nio4r (2.7.3) - nokogiri (1.16.6) + net-ssh (7.3.2) + nio4r (2.7.5) + nokogiri (1.19.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.6-aarch64-linux) + nokogiri (1.19.3-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.3-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.6-arm-linux) + nokogiri (1.19.3-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.6-arm64-darwin) + nokogiri (1.19.3-arm-linux-musl) racc (~> 1.4) - nokogiri (1.16.6-x86-linux) + nokogiri (1.19.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86_64-darwin) + nokogiri (1.19.3-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86_64-linux) + nokogiri (1.19.3-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.3-x86_64-linux-musl) racc (~> 1.4) oj (3.13.23) oj_mimic_json (1.0.1) - package_json (0.1.0) - parallel (1.25.1) - parser (3.3.4.0) + ostruct (0.6.3) + package_json (0.2.0) + parallel (1.28.0) + parser (3.3.11.1) ast (~> 2.4.1) racc - prometheus-client-mmap (1.1.1) - rb_sys (~> 0.9.86) - prometheus-client-mmap (1.1.1-aarch64-linux) - rb_sys (~> 0.9.86) - prometheus-client-mmap (1.1.1-arm64-darwin) - rb_sys (~> 0.9.86) - prometheus-client-mmap (1.1.1-x86_64-darwin) - rb_sys (~> 0.9.86) - prometheus-client-mmap (1.1.1-x86_64-linux) - rb_sys (~> 0.9.86) - psych (5.1.2) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.9.0) + prometheus-client-mmap (1.5.0) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-aarch64-linux-gnu) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-aarch64-linux-musl) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-arm64-darwin) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-x86_64-darwin) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-x86_64-linux-gnu) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + prometheus-client-mmap (1.5.0-x86_64-linux-musl) + base64 + bigdecimal + logger + rb_sys (~> 0.9.124) + psych (5.4.0) + date stringio - puma (6.4.3) + puma (7.2.1) nio4r (~> 2.0) - racc (1.8.0) - rack (2.2.9) - rack-attack (6.7.0) + racc (1.8.1) + rack (3.2.6) + rack-attack (6.8.0) rack (>= 1.0, < 4) - rack-proxy (0.7.7) + rack-proxy (0.8.2) rack - rack-session (1.0.2) - rack (< 3) - rack-test (2.1.0) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (1.0.0) - rack (< 3) - webrick - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rackup (2.3.1) + rack (>= 3) + rails (8.1.3) + actioncable (= 8.1.3) + actionmailbox (= 8.1.3) + actionmailer (= 8.1.3) + actionpack (= 8.1.3) + actiontext (= 8.1.3) + actionview (= 8.1.3) + activejob (= 8.1.3) + activemodel (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) bundler (>= 1.15.0) - railties (= 7.1.3.4) - rails-dom-testing (2.2.0) + railties (= 8.1.3) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + rails-html-sanitizer (1.7.0) + loofah (~> 2.25) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.1.3) + actionpack (= 8.1.3) + activesupport (= 8.1.3) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) + rake (13.4.2) + rake-compiler-dock (1.12.0) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rb_sys (0.9.99) - rdoc (6.7.0) + rb_sys (0.9.128) + rake-compiler-dock (= 1.12.0) + rdoc (7.2.0) + erb psych (>= 4.0.0) - regexp_parser (2.9.2) - reline (0.5.9) + tsort + redis (5.4.1) + redis-client (>= 0.22.0) + redis-client (0.29.0) + connection_pool + regexp_parser (2.12.0) + reline (0.6.3) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - rexml (3.3.6) - strscan - rouge (4.3.0) + rexml (3.4.4) + rouge (5.0.0) + strscan (~> 3.1) rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -313,8 +362,9 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) - parser (>= 3.3.1.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) @@ -323,7 +373,7 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - ruby-next-core (1.0.3) + ruby-next-core (1.2.0) ruby-progressbar (1.13.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -336,8 +386,9 @@ GEM sprockets-rails tilt sax-machine (1.3.2) - semantic_range (3.0.0) - shakapacker (8.0.1) + securerandom (0.4.1) + semantic_range (3.1.1) + shakapacker (8.0.2) activesupport (>= 5.2) package_json rack-proxy (>= 0.6.1) @@ -350,63 +401,69 @@ GEM spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) - sprockets (4.2.1) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sshkit (1.23.0) + sshkit (1.25.0) base64 + logger net-scp (>= 1.1.2) net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) + ostruct sshkit-sudo (0.1.0) sshkit (~> 1.8) - stringio (3.1.1) - strscan (3.1.0) - thor (1.3.1) - tilt (2.4.0) - timeout (0.4.1) + stringio (3.2.0) + strscan (3.1.8) + thor (1.5.0) + tilt (2.7.0) + timeout (0.6.1) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2024.1) + tzinfo-data (1.2026.2) tzinfo (>= 1.0.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) + uri (1.1.1) + useragent (0.16.11) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.1) - websocket-driver (0.8.0) + websocket-driver (0.8.1) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - yabeda (0.12.0) + yabeda (0.16.0) anyway_config (>= 1.0, < 3) concurrent-ruby dry-initializer - yabeda-graphql (0.2.3) - graphql (>= 1.9, < 3) + yabeda-graphql (0.3.0) + graphql (~> 2.2) yabeda (~> 0.2) - yabeda-http_requests (0.2.1) + yabeda-http_requests (0.3.0) + anyway_config (>= 1.3, < 3.0) sniffer yabeda yabeda-prometheus-mmap (0.4.0) prometheus-client-mmap yabeda (~> 0.10) - yabeda-puma-plugin (0.7.1) + yabeda-puma-plugin (0.9.0) json puma yabeda (~> 0.5) - yabeda-rails (0.9.0) + yabeda-rails (0.11.0) activesupport anyway_config (>= 1.3, < 3) railties yabeda (~> 0.8) - zeitwerk (2.6.16) + zeitwerk (2.8.2) PLATFORMS aarch64-linux @@ -429,9 +486,9 @@ DEPENDENCIES capistrano (~> 3.19.0) capistrano-bundler capistrano-rails + csv dotenv-rails (~> 3.1.2) - exception_notification - exception_notification-rake (~> 0.3.1) + exception_notification (~> 5.0) faye-websocket (~> 0.12.0) feedjira (~> 3.2.3) graphql-client @@ -439,9 +496,10 @@ DEPENDENCIES listen (~> 3.9.0) lograge logstash-event - puma (~> 6.4.3) + puma (~> 7.0) rack-attack - rails (~> 7.1.3.4) + rails (~> 8.1.0) + redis (~> 5.0) rubocop (~> 1.64.1) rubocop-performance (~> 1.21.1) rubocop-rails (~> 2.25.0) @@ -460,7 +518,7 @@ DEPENDENCIES yabeda-rails RUBY VERSION - ruby 3.3.4p94 + ruby 3.4.9 BUNDLED WITH - 2.5.11 + 4.0.8 diff --git a/Rakefile b/Rakefile index e85f9139..8c597e8a 100644 --- a/Rakefile +++ b/Rakefile @@ -2,5 +2,6 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative 'config/application' +require 'exception_notification/rake' Rails.application.load_tasks diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index add05d60..ea93dc9f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,9 +1,14 @@ class ApplicationController < ActionController::Base around_action :store_request_for_logging before_action :get_session_streaming_token, :set_locale, :set_theme, :set_date, :set_feed + before_action :set_sitemap_url_options, if: :sitemap_request? def default_url_options - {locale: (I18n.locale == I18n.default_locale) ? nil : I18n.locale} + opts = { locale: (I18n.locale == I18n.default_locale) ? nil : I18n.locale } + if sitemap_request? + opts.merge!(host: CANONICAL_HOST, protocol: CANONICAL_PROTOCOL, port: canonical_port) + end + opts end def innovation_in_blockchain? @@ -117,11 +122,32 @@ def set_feed def get_session_streaming_token token = StreamingTokenService.get payload = StreamingTokenService.payload - + + session["streaming_access_token"] = token @streaming_access_token = token @streaming_token_time_live = payload&.dig(:expires_at) end + def streaming_authorization_header + StreamingTokenService.get + end + + def sitemap_request? + controller_name.in?(%w[sitemap sitemaps]) + end + + def set_sitemap_url_options + Rails.application.routes.default_url_options.merge!( + host: CANONICAL_HOST, + protocol: CANONICAL_PROTOCOL, + port: canonical_port + ) + end + + def canonical_port + CANONICAL_PROTOCOL == "https" ? 443 : 80 + end + # def get_streaming_access_token # url = URI("https://oauth2.bitquery.io/oauth2/token") # https = Net::HTTP.new(url.host, url.port) diff --git a/app/controllers/proxy_eap_graphql_controller.rb b/app/controllers/proxy_eap_graphql_controller.rb index cf82e8f6..18055b5b 100644 --- a/app/controllers/proxy_eap_graphql_controller.rb +++ b/app/controllers/proxy_eap_graphql_controller.rb @@ -13,7 +13,7 @@ def index { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-API-KEY' => api_key, - 'Authorization' => session['streaming_access_token'] }) + 'Authorization' => streaming_authorization_header }) unless res.is_a?(Net::HTTPSuccess) Rails.logger.error "EAP GraphQL failed with status #{res.code}: #{res.body}" diff --git a/app/controllers/proxy_graphql_controller.rb b/app/controllers/proxy_graphql_controller.rb index 9f6478e3..53e9f7ee 100644 --- a/app/controllers/proxy_graphql_controller.rb +++ b/app/controllers/proxy_graphql_controller.rb @@ -11,7 +11,7 @@ def index { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-API-KEY' => api_key, - 'Authorization' => session['streaming_access_token'] }) + 'Authorization' => streaming_authorization_header }) respond_to do |format| format.json do diff --git a/app/controllers/proxy_streaming_graphql_controller.rb b/app/controllers/proxy_streaming_graphql_controller.rb index 129e66f4..a2e06327 100644 --- a/app/controllers/proxy_streaming_graphql_controller.rb +++ b/app/controllers/proxy_streaming_graphql_controller.rb @@ -14,7 +14,7 @@ def index { query: params[:query], variables: params[:variables] }.to_json, { 'Content-Type' => 'application/json', 'Accept' => 'application/json', - 'X-API-KEY' => api_key, 'Authorization' => session['streaming_access_token'] }) + 'X-API-KEY' => api_key, 'Authorization' => streaming_authorization_header }) respond_to do |format| format.json do diff --git a/app/helpers/seo_helper.rb b/app/helpers/seo_helper.rb new file mode 100644 index 00000000..fa98cc6d --- /dev/null +++ b/app/helpers/seo_helper.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module SeoHelper + def canonical_page_url + path = request.path + "#{CANONICAL_BASE_URL}#{path}" + end + + def robots_meta_content + if @noindex_entity + "noindex,follow" + else + "index,follow" + end + end + + def page_h1_text + return @page_h1 if @page_h1.present? + return content_for(:title).presence if content_for?(:title) + + @breadcrumbs&.last&.dig(:name) + end + + def breadcrumb_json_ld + return unless @breadcrumbs&.any? + + items = @breadcrumbs.each_with_index.map do |crumb, index| + url = crumb[:url].to_s + url = "#{CANONICAL_BASE_URL}#{url}" unless url.start_with?("http") + + { + "@type" => "ListItem", + "position" => index + 1, + "name" => crumb[:name].to_s.gsub(/<[^>]*>/, ""), + "item" => url + } + end + + { + "@context" => "https://schema.org", + "@type" => "BreadcrumbList", + "itemListElement" => items + }.to_json + end + + def website_json_ld + { + "@context" => "https://schema.org", + "@type" => "WebSite", + "name" => "Bitquery Explorer", + "url" => CANONICAL_BASE_URL, + "potentialAction" => { + "@type" => "SearchAction", + "target" => { + "@type" => "EntryPoint", + "urlTemplate" => "#{CANONICAL_BASE_URL}/search/{search_term_string}" + }, + "query-input" => "required name=search_term_string" + } + }.to_json + end + + def explorer_absolute_url(url_options = {}) + url_for(url_options.merge(host: CANONICAL_HOST, protocol: CANONICAL_PROTOCOL, only_path: false)) + end +end diff --git a/app/services/streaming_token_service.rb b/app/services/streaming_token_service.rb index 4e30f137..1deadd36 100644 --- a/app/services/streaming_token_service.rb +++ b/app/services/streaming_token_service.rb @@ -8,9 +8,18 @@ def self.get return payload[:token] end + static_token = ENV["BITQUERY_ACCESS_TOKEN"].to_s + unless static_token.empty? + token = static_token.start_with?("Bearer ") ? static_token : "Bearer #{static_token}" + data = { token: token, expires_at: 1.year.from_now } + Rails.cache.write(KEY, data, expires_in: 1.year, race_condition_ttl: 10) + Rails.logger.info "[StreamingToken] STATIC token from BITQUERY_ACCESS_TOKEN" + return token + end + cid = ENV["GRAPHQL_CLIENT_ID"]; csec = ENV["GRAPHQL_CLIENT_SECRET"] if cid.to_s.empty? || csec.to_s.empty? - Rails.logger.error "[StreamingToken] MISSING ENV GRAPHQL_CLIENT_ID/SECRET" + Rails.logger.error "[StreamingToken] MISSING ENV GRAPHQL_CLIENT_ID/SECRET or BITQUERY_ACCESS_TOKEN" return payload&.dig(:token) end diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index cb837ea5..11ac6730 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -36,12 +36,6 @@ | <%= link_to "Youtube", 'https://www.youtube.com/@bitquery', target: '_blank' %>
-The requested page does not exist in this explorer.
++ Try the home page, + Ethereum explorer, or + Bitcoin explorer. +