From 83337d09d249392bd97178f430560d08769ca59d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Mar 2025 12:55:15 +0000 Subject: [PATCH 01/13] Bump pundit from 2.4.0 to 2.5.0 Bumps [pundit](https://github.com/varvet/pundit) from 2.4.0 to 2.5.0. - [Changelog](https://github.com/varvet/pundit/blob/main/CHANGELOG.md) - [Commits](https://github.com/varvet/pundit/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: pundit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index adff6149..edae0e98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -199,7 +199,7 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.4) + minitest (5.25.5) msgpack (1.7.3) multi_xml (0.7.1) bigdecimal (~> 3.1) @@ -258,7 +258,7 @@ GEM public_suffix (6.0.1) puma (6.6.0) nio4r (~> 2.0) - pundit (2.4.0) + pundit (2.5.0) activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) @@ -429,7 +429,7 @@ GEM unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) - uri (1.0.2) + uri (1.0.3) useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) From d723f2d8cb04046b1f34a933ab128bdf3c22aceb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Mar 2025 12:55:20 +0000 Subject: [PATCH 02/13] Bump redis from 5.3.0 to 5.4.0 Bumps [redis](https://github.com/redis/redis-rb) from 5.3.0 to 5.4.0. - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v5.3.0...v5.4.0) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index adff6149..b21a97f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -303,9 +303,9 @@ GEM rake (13.2.1) rdoc (6.12.0) psych (>= 4.0.0) - redis (5.3.0) + redis (5.4.0) redis-client (>= 0.22.0) - redis-client (0.23.2) + redis-client (0.24.0) connection_pool regexp_parser (2.10.0) reline (0.6.0) From c4c55583befed1838995178eb392df972295c2b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:56:30 +0000 Subject: [PATCH 03/13] Bump chartkick from 5.1.3 to 5.1.4 Bumps [chartkick](https://github.com/ankane/chartkick) from 5.1.3 to 5.1.4. - [Changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md) - [Commits](https://github.com/ankane/chartkick/compare/v5.1.3...v5.1.4) --- updated-dependencies: - dependency-name: chartkick dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff5a3ab7..ce614fa8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,7 +105,7 @@ GEM racc builder (3.3.0) byebug (11.1.3) - chartkick (5.1.3) + chartkick (5.1.4) coderay (1.1.3) concurrent-ruby (1.3.5) connection_pool (2.5.0) From 6545ee822563dab3bdd2f5b496cc9efd43b3c460 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:45:47 +0000 Subject: [PATCH 04/13] Bump rubocop-rails from 2.30.1 to 2.31.0 Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.30.1 to 2.31.0. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.30.1...v2.31.0) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.31.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff5a3ab7..484e8b45 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,7 @@ GEM uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - ast (2.4.2) + ast (2.4.3) attr_extras (7.1.0) aws-eventstream (1.3.2) aws-partitions (1.1072.0) @@ -180,7 +180,7 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) jmespath (1.6.2) - json (2.10.1) + json (2.10.2) json-schema (5.0.1) addressable (~> 2.8) jwt (2.10.1) @@ -199,7 +199,7 @@ GEM kaminari-core (1.2.2) language_server-protocol (3.17.0.4) lint_roller (1.1.0) - logger (1.6.6) + logger (1.7.0) lograge (0.14.0) actionpack (>= 4) activesupport (>= 4) @@ -217,7 +217,7 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.8) - minitest (5.25.4) + minitest (5.25.5) msgpack (1.7.3) multi_xml (0.7.1) bigdecimal (~> 3.1) @@ -251,7 +251,7 @@ GEM orm_adapter (0.5.0) ostruct (0.6.1) parallel (1.26.3) - parser (3.3.7.1) + parser (3.3.7.4) ast (~> 2.4.1) racc patience_diff (1.2.0) @@ -260,6 +260,7 @@ GEM pp (0.6.2) prettyprint prettyprint (0.2.0) + prism (1.4.0) prometheus_exporter (2.2.0) webrick pry (0.14.2) @@ -280,7 +281,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (3.1.10) + rack (3.1.12) rack-session (2.1.0) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -366,7 +367,7 @@ GEM rswag-ui (2.16.0) actionpack (>= 5.2, < 8.1) railties (>= 5.2, < 8.1) - rubocop (1.72.1) + rubocop (1.75.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -374,16 +375,17 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.0) - parser (>= 3.3.1.0) - rubocop-rails (2.30.1) + rubocop-ast (1.44.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-rails (2.31.0) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.72.1, < 2.0) + rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) securerandom (0.4.1) @@ -450,7 +452,7 @@ GEM unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) - uri (1.0.2) + uri (1.0.3) useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) From dae1733320bc05e6ebc87cc40f8a687afe45ecb5 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Fri, 11 Apr 2025 19:13:46 +0200 Subject: [PATCH 05/13] Remove telemetry --- .app_version | 2 +- .devcontainer/docker-compose.yml | 1 - .gitignore | 3 ++ CHANGELOG.md | 8 ++++ app/jobs/telemetry_sending_job.rb | 14 ------ app/models/user.rb | 2 +- app/services/telemetry/gather.rb | 32 ------------- app/services/telemetry/send.rb | 46 ------------------- app/views/layouts/application.html.erb | 3 +- .../settings/subscriptions/index.html.erb | 4 +- app/views/shared/_footer.html.erb | 2 +- app/views/shared/_legal_footer.html.erb | 34 ++++++++++++++ app/views/shared/_navbar.html.erb | 4 +- config/initializers/01_constants.rb | 4 +- config/routes.rb | 17 ++++++- ...206163450_create_telemetry_notification.rb | 41 +---------------- docker/docker-compose.yml | 4 +- docker/sidekiq-entrypoint.sh | 4 +- docker/web-entrypoint.sh | 6 +-- spec/jobs/telemetry_sending_job_spec.rb | 39 ---------------- spec/services/telemetry/gather_spec.rb | 45 ------------------ 21 files changed, 80 insertions(+), 235 deletions(-) delete mode 100644 app/jobs/telemetry_sending_job.rb delete mode 100644 app/services/telemetry/gather.rb delete mode 100644 app/services/telemetry/send.rb create mode 100644 app/views/shared/_legal_footer.html.erb delete mode 100644 spec/jobs/telemetry_sending_job_spec.rb delete mode 100644 spec/services/telemetry/gather_spec.rb diff --git a/.app_version b/.app_version index 35aa2f3c..16c6b58f 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.25.4 +0.25.5 diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 597df91b..d697d8f8 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -32,7 +32,6 @@ services: PROMETHEUS_EXPORTER_ENABLED: false PROMETHEUS_EXPORTER_HOST: 0.0.0.0 PROMETHEUS_EXPORTER_PORT: 9394 - ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry dawarich_redis: image: redis:7.4-alpine container_name: dawarich_redis diff --git a/.gitignore b/.gitignore index b3a85915..14295128 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,6 @@ .dotnet/ .cursorrules .cursormemory.md + +/config/credentials/production.key +/config/credentials/production.yml.enc diff --git a/CHANGELOG.md b/CHANGELOG.md index 2da4e84c..c8bda809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +# 0.25.5 - UNRELEASED + +## Removed + +- Optional telemetry was removed from the app. +- Sidekiq Web UI is now protected by basic auth in non-self-hosted mode. (Needs to be tested) + + # 0.25.4 - 2025-04-02 ⚠️ This release includes a breaking change. ⚠️ diff --git a/app/jobs/telemetry_sending_job.rb b/app/jobs/telemetry_sending_job.rb deleted file mode 100644 index 7bec3b00..00000000 --- a/app/jobs/telemetry_sending_job.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class TelemetrySendingJob < ApplicationJob - queue_as :default - - def perform - return unless ENV['ENABLE_TELEMETRY'] == 'true' - - data = Telemetry::Gather.new.call - Rails.logger.info("Telemetry data: #{data}") - - Telemetry::Send.new(data).call - end -end diff --git a/app/models/user.rb b/app/models/user.rb index dc0bb532..8d7282b4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -101,7 +101,7 @@ class User < ApplicationRecord end def can_subscribe? - active_until&.past? && !DawarichSettings.self_hosted? + (active_until.nil? || active_until&.past?) && !DawarichSettings.self_hosted? end def generate_subscription_token diff --git a/app/services/telemetry/gather.rb b/app/services/telemetry/gather.rb deleted file mode 100644 index 90b7ee01..00000000 --- a/app/services/telemetry/gather.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class Telemetry::Gather - def initialize(measurement: 'dawarich_usage_metrics') - @measurement = measurement - end - - def call - { - measurement:, - timestamp: Time.current.to_i, - tags: { instance_id: }, - fields: { dau:, app_version: } - } - end - - private - - attr_reader :measurement - - def instance_id - @instance_id ||= Digest::SHA2.hexdigest(User.first.api_key) - end - - def app_version - "\"#{APP_VERSION}\"" - end - - def dau - User.where(last_sign_in_at: Time.zone.today.beginning_of_day..Time.zone.today.end_of_day).count - end -end diff --git a/app/services/telemetry/send.rb b/app/services/telemetry/send.rb deleted file mode 100644 index 96f222af..00000000 --- a/app/services/telemetry/send.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -class Telemetry::Send - BUCKET = 'dawarich_metrics' - ORG = 'monitoring' - - def initialize(payload) - @payload = payload - end - - def call - return unless ENV['ENABLE_TELEMETRY'] == 'true' - - line_protocol = build_line_protocol - response = send_request(line_protocol) - handle_response(response) - end - - private - - attr_reader :payload - - def build_line_protocol - tag_string = payload[:tags].map { |k, v| "#{k}=#{v}" }.join(',') - field_string = payload[:fields].map { |k, v| "#{k}=#{v}" }.join(',') - - "#{payload[:measurement]},#{tag_string} #{field_string} #{payload[:timestamp].to_i}" - end - - def send_request(line_protocol) - HTTParty.post( - "#{TELEMETRY_URL}?org=#{ORG}&bucket=#{BUCKET}&precision=s", - body: line_protocol, - headers: { - 'Authorization' => "Token #{Base64.decode64(TELEMETRY_STRING)}", - 'Content-Type' => 'text/plain' - } - ) - end - - def handle_response(response) - Rails.logger.error("InfluxDB write failed: #{response.body}") unless response.success? - - response - end -end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0763304b..50a43317 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,7 +7,6 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> - @@ -25,7 +24,7 @@
<%= yield %>
- <%= render 'shared/footer' %> + <%= render SELF_HOSTED ? 'shared/footer' : 'shared/legal_footer' %> diff --git a/app/views/settings/subscriptions/index.html.erb b/app/views/settings/subscriptions/index.html.erb index 093b58a9..eeb23dad 100644 --- a/app/views/settings/subscriptions/index.html.erb +++ b/app/views/settings/subscriptions/index.html.erb @@ -16,13 +16,13 @@ Your subscription will be valid for the next <%= days_left(current_user.active_until) %>.

- <%= link_to 'Manage subscription', "#{ENV['SUBSCRIPTION_URL']}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-primary my-4' %> + <%= link_to 'Manage subscription', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-primary my-4' %> <% else %>

You are currently not subscribed to Dawarich. How about we fix that?

- <%= link_to 'Manage subscription', "#{ENV['SUBSCRIPTION_URL']}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-primary my-4' %> + <%= link_to 'Manage subscription', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-primary my-4' %> <% end %> diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 944a96ae..33c13122 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -1,4 +1,4 @@ -