enable s3 proxy (wave 1)

This commit is contained in:
r888888888
2017-03-09 18:18:06 -08:00
parent 97cc8b5931
commit e946d23fa7
2 changed files with 15 additions and 6 deletions

View File

@@ -105,16 +105,20 @@ class Post < ActiveRecord::Base
end
def file_url
# if cdn_hosted?
# Danbooru.config.danbooru_s3_base_url + "/#{file_path_prefix}#{md5}.#{file_ext}"
# else
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
# end
if Danbooru.config.use_s3_proxy?(self)
"/cached/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
else
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
end
end
def large_file_url
if has_large?
"/data/sample/#{seo_tag_string}#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.#{large_file_ext}"
if Danbooru.config.use_s3_proxy?(self)
"/cached/data/sample/#{seo_tag_string}#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.#{large_file_ext}"
else
"/data/sample/#{seo_tag_string}#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.#{large_file_ext}"
end
else
file_url
end