diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index d94ace4114..689c6f3c04 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -33,11 +33,11 @@ module Mastodon end def repository - ENV.fetch('GITHUB_REPOSITORY', 'glitch-soc/mastodon') + ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon' end def source_base_url - ENV.fetch('SOURCE_BASE_URL', "https://github.com/#{repository}") + ENV.fetch('SOURCE_BASE_URL', "https://gitea.treehouse.systems/#{repository}") end # specify git tag or commit hash here @@ -46,8 +46,13 @@ module Mastodon end def source_url - if source_tag - "#{source_base_url}/tree/#{source_tag}" + if source_tag && source_base_url =~ /gitea/ + suffix = if !str[/\H/] + "commit/#{source_tag}" + else + "branch/#{source_tag}" + end + "#{source_base_url}/#{suffix}" else source_base_url end diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb index f4c415d2f1..82aff5fa2c 100644 --- a/spec/presenters/instance_presenter_spec.rb +++ b/spec/presenters/instance_presenter_spec.rb @@ -87,8 +87,8 @@ describe InstancePresenter do end describe '#source_url' do - it 'returns "https://github.com/glitch-soc/mastodon"' do - expect(instance_presenter.source_url).to eq('https://github.com/glitch-soc/mastodon') + it 'returns the default URL' do + expect(instance_presenter.source_url).to eq('https://gitea.treehouse.systems/treehouse/mastodon') end end