delegate post url generation to config
This commit is contained in:
@@ -145,7 +145,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
"#{Danbooru.config.image_server_host(self)}/data/#{seo_tag_string}#{file_path_prefix}#{md5}.#{file_ext}"
|
Danbooru.config.build_file_url(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
# this is for the 640x320 version
|
# this is for the 640x320 version
|
||||||
@@ -154,7 +154,7 @@ class Post < ApplicationRecord
|
|||||||
|
|
||||||
def large_file_url
|
def large_file_url
|
||||||
if has_large?
|
if has_large?
|
||||||
"#{Danbooru.config.image_server_host(self)}/data/sample/#{seo_tag_string}#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.#{large_file_ext}"
|
Danbooru.config.build_large_file_url(self)
|
||||||
else
|
else
|
||||||
file_url
|
file_url
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -217,8 +217,12 @@ module Danbooru
|
|||||||
"albert"
|
"albert"
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_server_host(post)
|
def build_file_url(post)
|
||||||
""
|
"/data/#{post.file_path_prefix}/#{post.md5}.#{post.file_ext}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_large_file_url(post)
|
||||||
|
"/data/#{post.file_path_prefix}#{Danbooru.config.large_image_prefix}/#{post.md5}.#{post.large_file_ext}"
|
||||||
end
|
end
|
||||||
|
|
||||||
#TAG CONFIGURATION
|
#TAG CONFIGURATION
|
||||||
|
|||||||
Reference in New Issue
Block a user