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