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 @@ -