Allow turning keybase off instance-wide

signup-info-prompt
Thibaut Girka 2019-04-17 21:50:18 +02:00 committed by ThibG
parent e3c1472040
commit d83068016b
7 changed files with 22 additions and 0 deletions

View File

@ -5,6 +5,7 @@ class Settings::IdentityProofsController < Settings::BaseController
before_action :authenticate_user! before_action :authenticate_user!
before_action :check_required_params, only: :new before_action :check_required_params, only: :new
before_action :check_enabled, only: :new
def index def index
@proofs = AccountIdentityProof.where(account: current_account).order(provider: :asc, provider_username: :asc) @proofs = AccountIdentityProof.where(account: current_account).order(provider: :asc, provider_username: :asc)
@ -41,6 +42,10 @@ class Settings::IdentityProofsController < Settings::BaseController
private private
def check_enabled
not_found unless Setting.enable_keybase
end
def check_required_params def check_required_params
redirect_to settings_identity_proofs_path unless [:provider, :provider_username, :username, :token].all? { |k| params[k].present? } redirect_to settings_identity_proofs_path unless [:provider, :provider_username, :username, :token].all? { |k| params[k].present? }
end end

View File

@ -2,8 +2,16 @@
module WellKnown module WellKnown
class KeybaseProofConfigController < ActionController::Base class KeybaseProofConfigController < ActionController::Base
before_action :check_enabled
def show def show
render json: {}, serializer: ProofProvider::Keybase::ConfigSerializer render json: {}, serializer: ProofProvider::Keybase::ConfigSerializer
end end
private
def check_enabled
head 404 unless Setting.enable_keybase
end
end end
end end

View File

@ -27,6 +27,7 @@ class Form::AdminSettings
custom_css custom_css
profile_directory profile_directory
hide_followers_count hide_followers_count
enable_keybase
flavour_and_skin flavour_and_skin
thumbnail thumbnail
hero hero
@ -43,6 +44,7 @@ class Form::AdminSettings
preview_sensitive_media preview_sensitive_media
profile_directory profile_directory
hide_followers_count hide_followers_count
enable_keybase
).freeze ).freeze
UPLOAD_KEYS = %i( UPLOAD_KEYS = %i(

View File

@ -49,6 +49,8 @@
= feature_hint(link_to(t('admin.dashboard.feature_profile_directory'), edit_admin_settings_path), @profile_directory) = feature_hint(link_to(t('admin.dashboard.feature_profile_directory'), edit_admin_settings_path), @profile_directory)
%li %li
= feature_hint(link_to(t('admin.dashboard.feature_timeline_preview'), edit_admin_settings_path), @timeline_preview) = feature_hint(link_to(t('admin.dashboard.feature_timeline_preview'), edit_admin_settings_path), @timeline_preview)
%li
= feature_hint(link_to(t('admin.dashboard.keybase'), edit_admin_settings_path), @timeline_preview)
%li %li
= feature_hint(link_to(t('admin.dashboard.feature_relay'), admin_relays_path), @relay_enabled) = feature_hint(link_to(t('admin.dashboard.feature_relay'), admin_relays_path), @relay_enabled)

View File

@ -69,6 +69,9 @@
.fields-group .fields-group
= f.input :hide_followers_count, as: :boolean, wrapper: :with_label, label: t('admin.settings.hide_followers_count.title'), hint: t('admin.settings.hide_followers_count.desc_html') = f.input :hide_followers_count, as: :boolean, wrapper: :with_label, label: t('admin.settings.hide_followers_count.title'), hint: t('admin.settings.hide_followers_count.desc_html')
.fields-group
= f.input :enable_keybase, as: :boolean, wrapper: :with_label, label: t('admin.settings.enable_keybase.title'), hint: t('admin.settings.enable_keybase.desc_html')
%hr.spacer/ %hr.spacer/
.fields-group .fields-group

View File

@ -252,6 +252,7 @@ en:
feature_timeline_preview: Timeline preview feature_timeline_preview: Timeline preview
features: Features features: Features
hidden_service: Federation with hidden services hidden_service: Federation with hidden services
keybase: Keybase integration
open_reports: open reports open_reports: open reports
recent_users: Recent users recent_users: Recent users
search: Full-text search search: Full-text search

View File

@ -31,6 +31,7 @@ defaults: &defaults
system_font_ui: false system_font_ui: false
noindex: false noindex: false
hide_followers_count: false hide_followers_count: false
enable_keybase: true
flavour: 'glitch' flavour: 'glitch'
skin: 'default' skin: 'default'
aggregate_reblogs: true aggregate_reblogs: true