From 36e1516ba205b20ae16d4c90679b6c7fccfc230f Mon Sep 17 00:00:00 2001 From: Ember <me@ember-is.gay> Date: Sat, 29 Jun 2024 16:22:47 +1000 Subject: [PATCH] hm --- app/controllers/api/v1/timelines/public_controller.rb | 2 +- app/helpers/admin/settings/discovery_helper.rb | 8 ++++++++ app/views/admin/settings/discovery/show.html.haml | 8 ++------ config/locales/en.yml | 1 + config/locales/simple_form.en.yml | 4 ++-- config/settings.yml | 4 ++-- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb index 5013d41fa0941c..7379b9c283880f 100644 --- a/app/controllers/api/v1/timelines/public_controller.rb +++ b/app/controllers/api/v1/timelines/public_controller.rb @@ -17,7 +17,7 @@ def require_auth? if Setting.timeline_preview false if truthy_param?(:local) !Setting.timeline_preview_local - elsif truthy_param?(:remote) + elsif truthy_param?(:remote) or truthy_param?(:allow_local_only) !Setting.timeline_preview_remote end else diff --git a/app/helpers/admin/settings/discovery_helper.rb b/app/helpers/admin/settings/discovery_helper.rb index 0aa4d4368f30bf..041f88416380ba 100644 --- a/app/helpers/admin/settings/discovery_helper.rb +++ b/app/helpers/admin/settings/discovery_helper.rb @@ -12,4 +12,12 @@ def discovery_hint_text def discovery_recommended_value authorized_fetch_overridden? ? :overridden : nil end + + def public_feed_auth + Setting.timeline_preview + end + + def public_timelines_warning_hint_text + public_feed_auth? ? t('admin.settings.security.public_timelines_warning_hint') : nil + end end diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index ebab8d2a770e79..fb281ee9873c8b 100644 --- a/app/views/admin/settings/discovery/show.html.haml +++ b/app/views/admin/settings/discovery/show.html.haml @@ -29,15 +29,11 @@ .fields-group = f.input :timeline_preview, as: :boolean, wrapper: :with_label - %h4= t('admin.settings.discovery.public_timelines_local') - .fields-group - = f.input :timeline_preview_local, as: :boolean, wrapper: :with_label - - %h4= t('admin.settings.discovery.public_timelines_remote') + = f.input :timeline_preview_local, as: :boolean, wrapper: :with_label, warning_hint: public_timelines_warning_hint_text, disabled: public_feed_auth? .fields-group - = f.input :timeline_preview_remote, as: :boolean, wrapper: :with_label + = f.input :timeline_preview_remote, as: :boolean, wrapper: :with_label, warning_hint: public_timelines_warning_hint_text, disabled: public_feed_auth? .fields-group = f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html') diff --git a/config/locales/en.yml b/config/locales/en.yml index 50ef690a5de92b..8450beae1904d7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -787,6 +787,7 @@ en: authorized_fetch_hint: Requiring authentication from federated servers enables stricter enforcement of both user-level and server-level blocks. However, this comes at the cost of a performance penalty, reduces the reach of your replies, and may introduce compatibility issues with some federated services. In addition, this will not prevent dedicated actors from fetching your public posts and accounts. authorized_fetch_overridden_hint: You are currently unable to change this setting because it is overridden by an environment variable. federation_authentication: Federation authentication enforcement + public_timelines_warning_hint: Overridden by the general toggle title: Server settings site_uploads: delete: Delete uploaded file diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 638986d746edb5..064e9af7e2612b 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -265,8 +265,8 @@ en: theme: Default theme thumbnail: Server thumbnail timeline_preview: Allow unauthenticated access to public timelines - timeline_preview: Allow unauthenticated access to local timeline - timeline_preview: Allow unauthenticated access to remote timeline + timeline_preview_local: Allow unauthenticated access to local timeline + timeline_preview_remote: Allow unauthenticated access to remote timeline trendable_by_default: Allow trends without prior review trends: Enable trends trends_as_landing_page: Use trends as the landing page diff --git a/config/settings.yml b/config/settings.yml index aa4c3069e8e120..6d4fc0f64bfc4d 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -13,8 +13,8 @@ defaults: &defaults profile_directory: true closed_registrations_message: '' timeline_preview: false - timeline_preview_local: false - timeline_preview_remote: false + timeline_preview_local: true + timeline_preview_remote: true show_staff_badge: true preview_sensitive_media: false noindex: false