mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-26 16:03:42 +01:00
Merge commit '8b770ce8110e6cd609a6769c66210d95e291e3e5' into glitch-soc/merge-upstream
Conflicts: - `config/initializers/content_security_policy.rb`: Upstream changed how asset host CSP directives are used, and glitch-soc has a pretty different CSP file. It may be worth reconsidering the differences between upstream and glitch-soc but for now, just port the change.
This commit is contained in:
commit
57c0de949b
6 changed files with 93 additions and 52 deletions
|
@ -49,7 +49,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_instance
|
def set_instance
|
||||||
@instance = Instance.find(TagManager.instance.normalize_domain(params[:id]&.strip))
|
@instance = Instance.find_or_initialize_by(domain: TagManager.instance.normalize_domain(params[:id]&.strip))
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_instances
|
def set_instances
|
||||||
|
|
|
@ -142,6 +142,11 @@ class Report < ApplicationRecord
|
||||||
target_type: 'Status',
|
target_type: 'Status',
|
||||||
target_id: status_ids
|
target_id: status_ids
|
||||||
).unscope(:order).arel,
|
).unscope(:order).arel,
|
||||||
|
|
||||||
|
Admin::ActionLog.where(
|
||||||
|
target_type: 'AccountWarning',
|
||||||
|
target_id: AccountWarning.where(report_id: id).select(:id)
|
||||||
|
).unscope(:order).arel,
|
||||||
].reduce { |union, query| Arel::Nodes::UnionAll.new(union, query) }
|
].reduce { |union, query| Arel::Nodes::UnionAll.new(union, query) }
|
||||||
|
|
||||||
Admin::ActionLog.from(Arel::Nodes::As.new(subquery, Admin::ActionLog.arel_table))
|
Admin::ActionLog.from(Arel::Nodes::As.new(subquery, Admin::ActionLog.arel_table))
|
||||||
|
|
|
@ -7,27 +7,31 @@
|
||||||
= ' - '
|
= ' - '
|
||||||
= l(@time_period.last)
|
= l(@time_period.last)
|
||||||
|
|
||||||
%p
|
- if @instance.persisted?
|
||||||
= fa_icon 'info fw'
|
%p
|
||||||
= t('admin.instances.totals_time_period_hint_html')
|
= fa_icon 'info fw'
|
||||||
|
= t('admin.instances.totals_time_period_hint_html')
|
||||||
|
|
||||||
.dashboard
|
.dashboard
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_accounts_measure'), href: admin_accounts_path(origin: 'remote', by_domain: @instance.domain)
|
= react_admin_component :counter, measure: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_accounts_measure'), href: admin_accounts_path(origin: 'remote', by_domain: @instance.domain)
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_statuses', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_statuses_measure')
|
= react_admin_component :counter, measure: 'instance_statuses', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_statuses_measure')
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_media_attachments', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_media_attachments_measure')
|
= react_admin_component :counter, measure: 'instance_media_attachments', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_media_attachments_measure')
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_follows', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_follows_measure')
|
= react_admin_component :counter, measure: 'instance_follows', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_follows_measure')
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_followers', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_followers_measure')
|
= react_admin_component :counter, measure: 'instance_followers', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_followers_measure')
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :counter, measure: 'instance_reports', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_reports_measure'), href: admin_reports_path(by_target_domain: @instance.domain)
|
= react_admin_component :counter, measure: 'instance_reports', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_reports_measure'), href: admin_reports_path(by_target_domain: @instance.domain)
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :dimension, dimension: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_accounts_dimension')
|
= react_admin_component :dimension, dimension: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_accounts_dimension')
|
||||||
.dashboard__item
|
.dashboard__item
|
||||||
= react_admin_component :dimension, dimension: 'instance_languages', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_languages_dimension')
|
= react_admin_component :dimension, dimension: 'instance_languages', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_languages_dimension')
|
||||||
|
- else
|
||||||
|
%p
|
||||||
|
= t('admin.instances.unknown_instance')
|
||||||
|
|
||||||
%hr.spacer/
|
%hr.spacer/
|
||||||
|
|
||||||
|
@ -62,33 +66,34 @@
|
||||||
- else
|
- else
|
||||||
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
|
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
|
||||||
|
|
||||||
%hr.spacer/
|
- if @instance.persisted?
|
||||||
|
%hr.spacer/
|
||||||
|
|
||||||
%h3= t('admin.instances.availability.title')
|
%h3= t('admin.instances.availability.title')
|
||||||
|
|
||||||
%p
|
%p
|
||||||
= t('admin.instances.availability.description_html', count: DeliveryFailureTracker::FAILURE_DAYS_THRESHOLD)
|
= t('admin.instances.availability.description_html', count: DeliveryFailureTracker::FAILURE_DAYS_THRESHOLD)
|
||||||
|
|
||||||
.availability-indicator
|
.availability-indicator
|
||||||
%ul.availability-indicator__graphic
|
%ul.availability-indicator__graphic
|
||||||
- @instance.availability_over_days(14).each do |(date, failing)|
|
- @instance.availability_over_days(14).each do |(date, failing)|
|
||||||
%li.availability-indicator__graphic__item{ class: failing ? 'negative' : 'neutral', title: l(date) }
|
%li.availability-indicator__graphic__item{ class: failing ? 'negative' : 'neutral', title: l(date) }
|
||||||
.availability-indicator__hint
|
.availability-indicator__hint
|
||||||
- if @instance.unavailable?
|
- if @instance.unavailable?
|
||||||
%span.negative-hint
|
%span.negative-hint
|
||||||
= t('admin.instances.availability.failure_threshold_reached', date: l(@instance.unavailable_domain.created_at.to_date))
|
= t('admin.instances.availability.failure_threshold_reached', date: l(@instance.unavailable_domain.created_at.to_date))
|
||||||
= link_to t('admin.instances.delivery.restart'), restart_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
= link_to t('admin.instances.delivery.restart'), restart_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
||||||
- elsif @instance.exhausted_deliveries_days.empty?
|
- elsif @instance.exhausted_deliveries_days.empty?
|
||||||
%span.positive-hint
|
%span.positive-hint
|
||||||
= t('admin.instances.availability.no_failures_recorded')
|
= t('admin.instances.availability.no_failures_recorded')
|
||||||
= link_to t('admin.instances.delivery.stop'), stop_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
= link_to t('admin.instances.delivery.stop'), stop_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
||||||
- else
|
- else
|
||||||
%span.negative-hint
|
%span.negative-hint
|
||||||
= t('admin.instances.availability.failures_recorded', count: @instance.delivery_failure_tracker.days)
|
= t('admin.instances.availability.failures_recorded', count: @instance.delivery_failure_tracker.days)
|
||||||
%span= link_to t('admin.instances.delivery.clear'), clear_delivery_errors_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post } unless @instance.exhausted_deliveries_days.empty?
|
%span= link_to t('admin.instances.delivery.clear'), clear_delivery_errors_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post } unless @instance.exhausted_deliveries_days.empty?
|
||||||
%span= link_to t('admin.instances.delivery.stop'), stop_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
%span= link_to t('admin.instances.delivery.stop'), stop_delivery_admin_instance_path(@instance), data: { confirm: t('admin.accounts.are_you_sure'), method: :post }
|
||||||
|
|
||||||
- if @instance.purgeable?
|
- if @instance.purgeable?
|
||||||
%p= t('admin.instances.purge_description_html')
|
%p= t('admin.instances.purge_description_html')
|
||||||
|
|
||||||
= link_to t('admin.instances.purge'), admin_instance_path(@instance), data: { confirm: t('admin.instances.confirm_purge'), method: :delete }, class: 'button button--destructive'
|
= link_to t('admin.instances.purge'), admin_instance_path(@instance), data: { confirm: t('admin.instances.confirm_purge'), method: :delete }, class: 'button button--destructive'
|
||||||
|
|
|
@ -4,6 +4,14 @@
|
||||||
# For further information see the following documentation
|
# For further information see the following documentation
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||||
|
|
||||||
|
def host_to_url(str)
|
||||||
|
return if str.blank?
|
||||||
|
|
||||||
|
uri = Addressable::URI.parse("http#{Rails.configuration.x.use_https ? 's' : ''}://#{str}")
|
||||||
|
uri.path += '/' unless uri.path.blank? || uri.path.end_with?('/')
|
||||||
|
uri.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def sso_host
|
def sso_host
|
||||||
return unless ENV['ONE_CLICK_SSO_LOGIN'] == 'true'
|
return unless ENV['ONE_CLICK_SSO_LOGIN'] == 'true'
|
||||||
return unless ENV['OMNIAUTH_ONLY'] == 'true'
|
return unless ENV['OMNIAUTH_ONLY'] == 'true'
|
||||||
|
@ -27,8 +35,7 @@ unless Rails.env.development?
|
||||||
data_hosts = [assets_host]
|
data_hosts = [assets_host]
|
||||||
|
|
||||||
if ENV['S3_ENABLED'] == 'true' || ENV['AZURE_ENABLED'] == 'true'
|
if ENV['S3_ENABLED'] == 'true' || ENV['AZURE_ENABLED'] == 'true'
|
||||||
attachments_host = "https://#{ENV['S3_ALIAS_HOST'] || ENV['S3_CLOUDFRONT_HOST'] || ENV['AZURE_ALIAS_HOST'] || ENV['S3_HOSTNAME'] || "s3-#{ENV['S3_REGION'] || 'us-east-1'}.amazonaws.com"}"
|
attachments_host = host_to_url(ENV['S3_ALIAS_HOST'] || ENV['S3_CLOUDFRONT_HOST'] || ENV['AZURE_ALIAS_HOST'] || ENV['S3_HOSTNAME'] || "s3-#{ENV['S3_REGION'] || 'us-east-1'}.amazonaws.com")
|
||||||
attachments_host = "https://#{Addressable::URI.parse(attachments_host).host}"
|
|
||||||
elsif ENV['SWIFT_ENABLED'] == 'true'
|
elsif ENV['SWIFT_ENABLED'] == 'true'
|
||||||
attachments_host = ENV['SWIFT_OBJECT_URL']
|
attachments_host = ENV['SWIFT_OBJECT_URL']
|
||||||
attachments_host = "https://#{Addressable::URI.parse(attachments_host).host}"
|
attachments_host = "https://#{Addressable::URI.parse(attachments_host).host}"
|
||||||
|
|
|
@ -534,6 +534,7 @@ en:
|
||||||
total_reported: Reports about them
|
total_reported: Reports about them
|
||||||
total_storage: Media attachments
|
total_storage: Media attachments
|
||||||
totals_time_period_hint_html: The totals displayed below include data for all time.
|
totals_time_period_hint_html: The totals displayed below include data for all time.
|
||||||
|
unknown_instance: There is currently no record of this domain on this server.
|
||||||
invites:
|
invites:
|
||||||
deactivate_all: Deactivate all
|
deactivate_all: Deactivate all
|
||||||
filter:
|
filter:
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace :mastodon do
|
||||||
ENV.delete('SIDEKIQ_REDIS_URL')
|
ENV.delete('SIDEKIQ_REDIS_URL')
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
errors = false
|
||||||
|
|
||||||
prompt.say('Your instance is identified by its domain name. Changing it afterward will break things.')
|
prompt.say('Your instance is identified by its domain name. Changing it afterward will break things.')
|
||||||
env['LOCAL_DOMAIN'] = prompt.ask('Domain name:') do |q|
|
env['LOCAL_DOMAIN'] = prompt.ask('Domain name:') do |q|
|
||||||
q.required true
|
q.required true
|
||||||
|
@ -95,7 +97,12 @@ namespace :mastodon do
|
||||||
rescue => e
|
rescue => e
|
||||||
prompt.error 'Database connection could not be established with this configuration, try again.'
|
prompt.error 'Database connection could not be established with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
unless prompt.yes?('Try again?')
|
||||||
|
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||||
|
|
||||||
|
errors = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +142,12 @@ namespace :mastodon do
|
||||||
rescue => e
|
rescue => e
|
||||||
prompt.error 'Redis connection could not be established with this configuration, try again.'
|
prompt.error 'Redis connection could not be established with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
unless prompt.yes?('Try again?')
|
||||||
|
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||||
|
|
||||||
|
errors = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -420,7 +432,12 @@ namespace :mastodon do
|
||||||
rescue => e
|
rescue => e
|
||||||
prompt.error 'E-mail could not be sent with this configuration, try again.'
|
prompt.error 'E-mail could not be sent with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
unless prompt.yes?('Try again?')
|
||||||
|
return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
|
||||||
|
|
||||||
|
errors = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -466,6 +483,7 @@ namespace :mastodon do
|
||||||
prompt.ok 'Done!'
|
prompt.ok 'Done!'
|
||||||
else
|
else
|
||||||
prompt.error 'That failed! Perhaps your configuration is not right'
|
prompt.error 'That failed! Perhaps your configuration is not right'
|
||||||
|
errors = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -482,12 +500,17 @@ namespace :mastodon do
|
||||||
prompt.say 'Done!'
|
prompt.say 'Done!'
|
||||||
else
|
else
|
||||||
prompt.error 'That failed! Maybe you need swap space?'
|
prompt.error 'That failed! Maybe you need swap space?'
|
||||||
|
errors = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prompt.say "\n"
|
prompt.say "\n"
|
||||||
prompt.ok 'All done! You can now power on the Mastodon server 🐘'
|
if errors
|
||||||
|
prompt.warn 'Your Mastodon server is set up, but there were some errors along the way, you may have to fix them.'
|
||||||
|
else
|
||||||
|
prompt.ok 'All done! You can now power on the Mastodon server 🐘'
|
||||||
|
end
|
||||||
prompt.say "\n"
|
prompt.say "\n"
|
||||||
|
|
||||||
if db_connection_works && prompt.yes?('Do you want to create an admin user straight away?')
|
if db_connection_works && prompt.yes?('Do you want to create an admin user straight away?')
|
||||||
|
|
Loading…
Reference in a new issue