mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 07:13:38 +08:00
8ebd5edd1e
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
23 lines
590 B
Ruby
23 lines
590 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UploadSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:url,
|
|
:original_filename,
|
|
:filesize,
|
|
:width,
|
|
:height,
|
|
:thumbnail_width,
|
|
:thumbnail_height,
|
|
:extension,
|
|
:short_url,
|
|
:short_path,
|
|
:retain_hours,
|
|
:human_filesize,
|
|
:dominant_color
|
|
|
|
def url
|
|
object.for_site_setting ? object.url : UrlHelper.cook_url(object.url, secure: SiteSetting.secure_uploads? && object.secure)
|
|
end
|
|
end
|