2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class UploadSerializer < ApplicationSerializer
|
2017-08-22 16:40:01 -04:00
|
|
|
attributes :id,
|
|
|
|
:url,
|
|
|
|
:original_filename,
|
|
|
|
:filesize,
|
|
|
|
:width,
|
|
|
|
:height,
|
2018-08-27 22:48:43 -04:00
|
|
|
:thumbnail_width,
|
|
|
|
:thumbnail_height,
|
2017-08-22 16:40:01 -04:00
|
|
|
:extension,
|
|
|
|
:short_url,
|
2019-02-20 21:13:37 -05:00
|
|
|
:retain_hours,
|
|
|
|
:human_filesize
|
2020-01-15 22:50:27 -05:00
|
|
|
|
|
|
|
def url
|
|
|
|
return object.url if !object.secure || !SiteSetting.secure_media?
|
|
|
|
UrlHelper.cook_url(object.url, secure: object.secure)
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|