add cdn hosted flag to posts
This commit is contained in:
@@ -21,7 +21,8 @@ class AmazonBackup < ActiveRecord::Base
|
||||
region: "us-east-1",
|
||||
credentials: credentials
|
||||
})
|
||||
client = Aws::S3::Client.new
|
||||
logger = Logger.new(STDOUT)
|
||||
client = Aws::S3::Client.new(logger: logger)
|
||||
bucket = Danbooru.config.aws_s3_bucket_name
|
||||
|
||||
Post.where("id > ?", last_id).limit(1000).order("id").each do |post|
|
||||
|
||||
@@ -105,7 +105,11 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def file_url
|
||||
"/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
|
||||
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
|
||||
end
|
||||
|
||||
def large_file_url
|
||||
@@ -1709,6 +1713,7 @@ class Post < ActiveRecord::Base
|
||||
|
||||
BOOLEAN_ATTRIBUTES = %w(
|
||||
has_embedded_notes
|
||||
cdn_hosted
|
||||
)
|
||||
has_bit_flags BOOLEAN_ATTRIBUTES
|
||||
|
||||
|
||||
Reference in New Issue
Block a user