From 3e6c7f3617b99db616142ebcd9f78094d4c6fca3 Mon Sep 17 00:00:00 2001 From: Sho Kusano Date: Sun, 21 Apr 2019 11:41:34 +0900 Subject: [PATCH] Configrationable repository url (#10600) * config: Add GITHUB_REPOSITORY for repository name * config: Add SOURCE_BASE_URL for repository url * Show source_url and repository name on getting started --- app/javascript/mastodon/features/getting_started/index.js | 4 ++-- app/javascript/mastodon/initial_state.js | 2 ++ app/serializers/initial_state_serializer.rb | 2 ++ lib/mastodon/version.rb | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index e1f84de27..77c27ac6b 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -7,7 +7,7 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me, invitesEnabled, version, profile_directory } from '../../initial_state'; +import { me, invitesEnabled, version, profile_directory, repository, source_url } from '../../initial_state'; import { fetchFollowRequests } from '../../actions/accounts'; import { List as ImmutableList } from 'immutable'; import { Link } from 'react-router-dom'; @@ -172,7 +172,7 @@ class GettingStarted extends ImmutablePureComponent { tootsuite/mastodon (v{version}) }} + values={{ github: {repository} (v{version}) }} />

diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 8c2e9d2de..74bcfee58 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -13,6 +13,8 @@ export const deleteModal = getMeta('delete_modal'); export const me = getMeta('me'); export const searchEnabled = getMeta('search_enabled'); export const invitesEnabled = getMeta('invites_enabled'); +export const repository = getMeta('repository'); +export const source_url = getMeta('source_url'); export const version = getMeta('version'); export const mascot = getMeta('mascot'); export const profile_directory = getMeta('profile_directory'); diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index a7a3d770c..0c9fc625f 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -14,6 +14,8 @@ class InitialStateSerializer < ActiveModel::Serializer domain: Rails.configuration.x.local_domain, admin: object.admin&.id&.to_s, search_enabled: Chewy.enabled?, + repository: Mastodon::Version.repository, + source_url: Mastodon::Version.source_url, version: Mastodon::Version.to_s, invites_enabled: Setting.min_invite_role == 'user', mascot: instance_presenter.mascot&.file&.url, diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index b53205ee4..a656031b1 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -33,11 +33,11 @@ module Mastodon end def repository - 'tootsuite/mastodon' + ENV.fetch('GITHUB_REPOSITORY') { 'tootsuite/mastodon' } end def source_base_url - "https://github.com/#{repository}" + ENV.fetch('SOURCE_BASE_URL') { "https://github.com/#{repository}" } end # specify git tag or commit hash here