support dedicated image servers
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# donmai.us specific
|
||||
|
||||
class ApiCacheGenerator
|
||||
def generate_tag_cache
|
||||
path = Danbooru.config.shared_dir_path
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# donmai.us specific
|
||||
|
||||
class CloudflareService
|
||||
def key
|
||||
Danbooru.config.cloudflare_key
|
||||
@@ -23,7 +25,7 @@ class CloudflareService
|
||||
def delete(md5, ext)
|
||||
url = "https://api.cloudflare.com/client/v4/zones/#{zone}/purge_cache"
|
||||
files = ["#{md5}.#{ext}", "preview/#{md5}.jpg", "sample/sample-#{md5}.jpg"].map do |name|
|
||||
["danbooru", "safebooru"].map do |subdomain|
|
||||
["danbooru", "safebooru", "raikou1"].map do |subdomain|
|
||||
"http://#{subdomain}.donmai.us/data/#{name}"
|
||||
end
|
||||
end.flatten
|
||||
|
||||
@@ -16,7 +16,21 @@ class CurrentUser
|
||||
end
|
||||
|
||||
def self.as_admin(&block)
|
||||
scoped(User.admins.first, "127.0.0.1", &block)
|
||||
if block_given?
|
||||
scoped(User.admins.first, "127.0.0.1", &block)
|
||||
else
|
||||
self.user = User.admins.first
|
||||
self.ip_addr = "127.0.0.1"
|
||||
end
|
||||
end
|
||||
|
||||
def self.as_system(&block)
|
||||
if block_given?
|
||||
scoped(User.system, "127.0.0.1", &block)
|
||||
else
|
||||
self.user = User.system
|
||||
self.ip_addr = "127.0.0.1"
|
||||
end
|
||||
end
|
||||
|
||||
def self.user=(user)
|
||||
|
||||
Reference in New Issue
Block a user