From 64c0e0111834e47aa2bdcd80881026d21a7ed08d Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Tue, 6 Aug 2024 05:28:38 -0500 Subject: [PATCH] Fix version in exceptions --- app/logical/git_helper.rb | 10 ++++++++-- app/models/exception_log.rb | 2 +- app/views/exceptions/index.html.erb | 4 ++++ config/default_config.rb | 6 +++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/logical/git_helper.rb b/app/logical/git_helper.rb index 1cd790d..201614b 100644 --- a/app/logical/git_helper.rb +++ b/app/logical/git_helper.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true module GitHelper - def self.init + module_function + + def init if Rails.root.join("REVISION").exist? @hash = Rails.root.join("REVISION").read.strip elsif system("type git > /dev/null && git rev-parse --show-toplevel > /dev/null") @@ -11,7 +13,11 @@ module GitHelper end end - def self.short_hash + def full_hash + @hash + end + + def short_hash return nil if @hash.nil? @hash[0..8] end diff --git a/app/models/exception_log.rb b/app/models/exception_log.rb index 3e343f8..cb939a4 100644 --- a/app/models/exception_log.rb +++ b/app/models/exception_log.rb @@ -27,7 +27,7 @@ class ExceptionLog < ApplicationRecord message: unwrapped_exception.message, trace: unwrapped_exception.backtrace.join("\n"), code: SecureRandom.uuid, - version: Websites.config.version, + version: Websites.config.full_version, extra_params: extra_params, ) end diff --git a/app/views/exceptions/index.html.erb b/app/views/exceptions/index.html.erb index cb65856..bd99576 100644 --- a/app/views/exceptions/index.html.erb +++ b/app/views/exceptions/index.html.erb @@ -28,3 +28,7 @@ <%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %> + +<% content_for(:page_title) do %> + Exceptions +<% end %> diff --git a/config/default_config.rb b/config/default_config.rb index c4410ef..b351963 100644 --- a/config/default_config.rb +++ b/config/default_config.rb @@ -6,6 +6,10 @@ module Websites GitHelper.short_hash end + def full_version + GitHelper.full_hash + end + def version_link GitHelper.commit_url(GitHelper.short_hash) end @@ -15,7 +19,7 @@ module Websites end def source_code_url - "https://github.com/DonovanDMC/Websites" + "https://git.furry.cool/Donovan_DMC/Websites" end def e621_status_check_discord_id