mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Rename secure_media to secure_uploads (#18376)
This commit renames all secure_media related settings to secure_uploads_* along with the associated functionality. This is being done because "media" does not really cover it, we aren't just doing this for images and videos etc. but for all uploads in the site. Additionally, in future we want to secure more types of uploads, and enable a kind of "mixed mode" where some uploads are secure and some are not, so keeping media in the name is just confusing. This also keeps compatibility with the `secure-media-uploads` path, and changes new secure URLs to be `secure-uploads`. Deprecated settings: * secure_media -> secure_uploads * secure_media_allow_embed_images_in_emails -> secure_uploads_allow_embed_images_in_emails * secure_media_max_email_embed_image_size_kb -> secure_uploads_max_email_embed_image_size_kb
This commit is contained in:
@@ -45,6 +45,7 @@ if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
|
||||
/^\/site_customizations/,
|
||||
/^\/uploads/,
|
||||
/^\/secure-media-uploads/,
|
||||
/^\/secure-uploads/,
|
||||
/^\/javascripts\//,
|
||||
/^\/images\//,
|
||||
/^\/stylesheets\//,
|
||||
|
||||
@@ -139,7 +139,7 @@ en:
|
||||
unsubscribe_not_allowed: "Happens when unsubscribing via email is not allowed for this user."
|
||||
email_not_allowed: "Happens when the email address is not on the allowlist or is on the blocklist."
|
||||
unrecognized_error: "Unrecognized Error"
|
||||
secure_media_placeholder: "Redacted: This site has secure media enabled, visit the topic or click View Media to see the attached media."
|
||||
secure_uploads_placeholder: "Redacted: This site has secure uploads enabled, visit the topic or click View Media to see the attached uploads."
|
||||
view_redacted_media: "View Media"
|
||||
|
||||
errors: &errors
|
||||
@@ -210,7 +210,7 @@ en:
|
||||
page_publishing_requirements: "Page publishing cannot be enabled if secure media is enabled."
|
||||
s3_backup_requires_s3_settings: "You cannot use S3 as backup location unless you've provided the '%{setting_name}'."
|
||||
s3_bucket_reused: "You cannot use the same bucket for 's3_upload_bucket' and 's3_backup_bucket'. Choose a different bucket or use a different path for each bucket."
|
||||
secure_media_requirements: "S3 uploads must be enabled before enabling secure media."
|
||||
secure_uploads_requirements: "S3 uploads must be enabled before enabling secure uploads."
|
||||
share_quote_facebook_requirements: "You must set a Facebook app id to enable quote sharing for Facebook."
|
||||
second_factor_cannot_enforce_with_socials: "You cannot enforce 2FA with social logins enabled. You must first disable login via: %{auth_provider_names}"
|
||||
second_factor_cannot_be_enforced_with_disabled_local_login: "You cannot enforce 2FA if local logins are disabled."
|
||||
@@ -2219,9 +2219,12 @@ en:
|
||||
bootstrap_mode_min_users: "Minimum number of users required to disable bootstrap mode (set to 0 to disable)"
|
||||
|
||||
prevent_anons_from_downloading_files: "Prevent anonymous users from downloading attachments."
|
||||
secure_media: 'Limits access to ALL uploads (images, video, audio, text, pdfs, zips, and others). If “login required” is enabled, only logged-in users can access uploads. Otherwise, access will be limited only for media uploads in private messages and private categories. WARNING: This setting is complex and requires deep administrative understanding. See <a target="_blank" href="https://meta.discourse.org/t/secure-media-uploads/140017">the secure media topic on Meta</a> for details.'
|
||||
secure_media_allow_embed_images_in_emails: "Allows embedding secure images that would normally be redacted in emails, if their size is smaller than the 'secure media max email embed image size kb' setting."
|
||||
secure_media_max_email_embed_image_size_kb: "The size cutoff for secure images that will be embedded in emails if the 'secure media allow embed in emails' setting is enabled. Without that setting enabled, this setting has no effect."
|
||||
secure_media: 'DEPRECATED: Use the secure_uploads setting instead, will be removed in Discourse 3.0.'
|
||||
secure_uploads: 'Limits access to ALL uploads (images, video, audio, text, pdfs, zips, and others). If "login required” is enabled, only logged-in users can access uploads. Otherwise, access will be limited only for media uploads in private messages and private categories. WARNING: This setting is complex and requires deep administrative understanding. See <a target="_blank" href="https://meta.discourse.org/t/-/140017">the secure uploads topic on Meta</a> for details.'
|
||||
secure_media_allow_embed_images_in_emails: "DEPRECATED: Use secure_uploads_allow_embed_images_in_emails, will remove in Discourse 3.0."
|
||||
secure_uploads_allow_embed_images_in_emails: "Allows embedding secure images that would normally be redacted in emails, if their size is smaller than the 'secure uploads max email embed image size kb' setting."
|
||||
secure_media_max_email_embed_image_size_kb: "DEPRECATED: Use secure_uploads_max_email_embed_image_size_kb, will be removed in Discourse 3.0."
|
||||
secure_uploads_max_email_embed_image_size_kb: "The size cutoff for secure images that will be embedded in emails if the 'secure uploads allow embed in emails' setting is enabled. Without that setting enabled, this setting has no effect."
|
||||
slug_generation_method: "Choose a slug generation method. 'encoded' will generate percent encoding string. 'none' will disable slug at all."
|
||||
|
||||
enable_emoji: "Enable emoji"
|
||||
|
||||
@@ -110,7 +110,7 @@ server {
|
||||
break;
|
||||
}
|
||||
|
||||
location ~ ^/secure-media-uploads/ {
|
||||
location ~ ^/(secure-media-uploads/|secure-uploads)/ {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Request-Start "t=${msec}";
|
||||
|
||||
@@ -583,7 +583,12 @@ Discourse::Application.routes.draw do
|
||||
end
|
||||
# used to download attachments (old route)
|
||||
get "uploads/:site/:id/:sha" => "uploads#show", constraints: { site: /\w+/, id: /\d+/, sha: /\h{16}/, format: /.*/ }
|
||||
get "secure-media-uploads/*path(.:extension)" => "uploads#show_secure", constraints: { extension: /[a-z0-9\._]+/i }
|
||||
|
||||
# NOTE: secure-media-uploads is the old form, all new URLs generated for
|
||||
# secure uploads will be secure-uploads, this is left in for backwards
|
||||
# compat without needing to rebake all posts for each site.
|
||||
get "secure-media-uploads/*path(.:extension)" => "uploads#_show_secure_deprecated", constraints: { extension: /[a-z0-9\._]+/i }
|
||||
get "secure-uploads/*path(.:extension)" => "uploads#show_secure", constraints: { extension: /[a-z0-9\._]+/i }
|
||||
|
||||
get "posts" => "posts#latest", id: "latest_posts", constraints: { format: /(json|rss)/ }
|
||||
get "private-posts" => "posts#latest", id: "private_posts", constraints: { format: /(json|rss)/ }
|
||||
|
||||
@@ -1365,12 +1365,24 @@ files:
|
||||
secure_media:
|
||||
default: false
|
||||
client: true
|
||||
hidden: true
|
||||
secure_media_allow_embed_images_in_emails:
|
||||
default: true
|
||||
hidden: true
|
||||
secure_media_max_email_embed_image_size_kb:
|
||||
default: 1024
|
||||
min: 1
|
||||
max: 10240
|
||||
hidden: true
|
||||
secure_uploads:
|
||||
default: false
|
||||
client: true
|
||||
secure_uploads_allow_embed_images_in_emails:
|
||||
default: true
|
||||
secure_uploads_max_email_embed_image_size_kb:
|
||||
default: 1024
|
||||
min: 1
|
||||
max: 10240
|
||||
enable_s3_uploads:
|
||||
default: false
|
||||
client: true
|
||||
|
||||
Reference in New Issue
Block a user