Fix version in exceptions

This commit is contained in:
Donovan Daniels 2024-08-06 05:28:38 -05:00
parent 0ca5f19509
commit 64c0e01118
Signed by: Donovan_DMC
GPG Key ID: 907D29CBFD6157BA
4 changed files with 18 additions and 4 deletions

View File

@ -1,7 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
module GitHelper module GitHelper
def self.init module_function
def init
if Rails.root.join("REVISION").exist? if Rails.root.join("REVISION").exist?
@hash = Rails.root.join("REVISION").read.strip @hash = Rails.root.join("REVISION").read.strip
elsif system("type git > /dev/null && git rev-parse --show-toplevel > /dev/null") elsif system("type git > /dev/null && git rev-parse --show-toplevel > /dev/null")
@ -11,7 +13,11 @@ module GitHelper
end end
end end
def self.short_hash def full_hash
@hash
end
def short_hash
return nil if @hash.nil? return nil if @hash.nil?
@hash[0..8] @hash[0..8]
end end

View File

@ -27,7 +27,7 @@ class ExceptionLog < ApplicationRecord
message: unwrapped_exception.message, message: unwrapped_exception.message,
trace: unwrapped_exception.backtrace.join("\n"), trace: unwrapped_exception.backtrace.join("\n"),
code: SecureRandom.uuid, code: SecureRandom.uuid,
version: Websites.config.version, version: Websites.config.full_version,
extra_params: extra_params, extra_params: extra_params,
) )
end end

View File

@ -28,3 +28,7 @@
<%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %> <%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %>
</div> </div>
</footer> </footer>
<% content_for(:page_title) do %>
Exceptions
<% end %>

View File

@ -6,6 +6,10 @@ module Websites
GitHelper.short_hash GitHelper.short_hash
end end
def full_version
GitHelper.full_hash
end
def version_link def version_link
GitHelper.commit_url(GitHelper.short_hash) GitHelper.commit_url(GitHelper.short_hash)
end end
@ -15,7 +19,7 @@ module Websites
end end
def source_code_url def source_code_url
"https://github.com/DonovanDMC/Websites" "https://git.furry.cool/Donovan_DMC/Websites"
end end
def e621_status_check_discord_id def e621_status_check_discord_id