Commit 25e461fe authored by Alex Gleason's avatar Alex Gleason

Merge branch 'canary' into 'master'

Add configurable warrant canary message

See merge request !144
parents fdf3cc0b be50975a
Pipeline #106411569 passed with stage
in 6 minutes and 30 seconds
# frozen_string_literal: true
class CanaryController < ApplicationController
layout 'public'
before_action :set_instance_presenter
before_action :check_set
respond_to :html, :text
private
def check_set
not_found if @instance_presenter.warrant_canary.blank?
end
def set_instance_presenter
@instance_presenter = InstancePresenter.new
end
end
......@@ -964,3 +964,7 @@ $small-breakpoint: 960px;
display: block !important;
}
}
.public-layout pre.canary {
white-space: pre-wrap;
}
......@@ -36,6 +36,7 @@ class Form::AdminSettings
funding_goal_amount
funding_goal_text
promo_items
warrant_canary
).freeze
BOOLEAN_KEYS = %i(
......
......@@ -9,6 +9,7 @@ class InstancePresenter
:site_extended_description,
:site_terms,
:closed_registrations_message,
:warrant_canary,
to: Setting
)
......
......@@ -82,5 +82,8 @@
= f.input :site_terms, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_terms.title'), hint: t('admin.settings.site_terms.desc_html'), input_html: { rows: 8 }
= f.input :custom_css, wrapper: :with_block_label, as: :text, input_html: { rows: 8 }, label: t('admin.settings.custom_css.title'), hint: t('admin.settings.custom_css.desc_html')
.fields-group
= f.input :warrant_canary, wrapper: :with_block_label, as: :text, label: t('admin.settings.warrant_canary.title'), hint: t('admin.settings.warrant_canary.desc_html'), input_html: { rows: 8 }
.actions
= f.button :button, t('generic.save_changes'), type: :submit
- content_for :page_title do
= site_hostname
- content_for :header_tags do
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
= render partial: 'shared/og'
.content
.box-widget
.rich-formatting
%pre.canary= @instance_presenter.warrant_canary.html_safe.presence
<%= @instance_presenter.warrant_canary.html_safe.presence %>
......@@ -439,6 +439,9 @@ en:
desc_html: Used for previews via OpenGraph and API. 1200x630px recommended
title: Server thumbnail
title: Site settings
warrant_canary:
desc_html: Canary text available on /canary and /canary.txt. Must be plain text only; whitespace will be preserved.
title: Warrant canary
statuses:
back_to_account: Back to account page
batch:
......
......@@ -470,6 +470,7 @@ Rails.application.routes.draw do
get '/@:account_username/posts/:id/embed', to: 'statuses#embed', account_username: username_regex, as: :embed_short_account_status
mount StripeEvent::Engine, at: '/webhooks/stripe'
resource :canary, only: :show, controller: :canary
get '/(*any)', to: 'react#react', as: :web
root 'react#react'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment