enable s3 proxy (wave 1)
This commit is contained in:
@@ -105,16 +105,20 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
# if cdn_hosted?
|
if Danbooru.config.use_s3_proxy?(self)
|
||||||
# Danbooru.config.danbooru_s3_base_url + "/#{file_path_prefix}#{md5}.#{file_ext}"
|
"/cached/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
|
||||||
# else
|
else
|
||||||
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
|
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
|
||||||
# end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def large_file_url
|
def large_file_url
|
||||||
if has_large?
|
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
|
else
|
||||||
file_url
|
file_url
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -410,6 +410,11 @@ module Danbooru
|
|||||||
def addthis_key
|
def addthis_key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# enable s3-nginx proxy caching
|
||||||
|
def use_s3_proxy?(post)
|
||||||
|
post.id < 100
|
||||||
|
end
|
||||||
|
|
||||||
# include essential tags in image urls (requires nginx/apache rewrites)
|
# include essential tags in image urls (requires nginx/apache rewrites)
|
||||||
def enable_seo_post_urls
|
def enable_seo_post_urls
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user