config: remove more obsolete or unneeded config options.
Remove more config options that were either unused or that shouldn't need to be configured by downstream users.
This commit is contained in:
@@ -3,14 +3,13 @@ class StorageManager
|
||||
|
||||
DEFAULT_BASE_DIR = "#{Rails.root}/public/data"
|
||||
|
||||
attr_reader :base_url, :base_dir, :hierarchical, :tagged_filenames, :large_image_prefix, :original_subdir
|
||||
attr_reader :base_url, :base_dir, :hierarchical, :tagged_filenames, :original_subdir
|
||||
|
||||
def initialize(base_url: default_base_url, base_dir: DEFAULT_BASE_DIR, hierarchical: false, tagged_filenames: Danbooru.config.enable_seo_post_urls, large_image_prefix: Danbooru.config.large_image_prefix, original_subdir: "")
|
||||
def initialize(base_url: default_base_url, base_dir: DEFAULT_BASE_DIR, hierarchical: false, tagged_filenames: Danbooru.config.enable_seo_post_urls, original_subdir: "")
|
||||
@base_url = base_url.chomp("/")
|
||||
@base_dir = base_dir
|
||||
@hierarchical = hierarchical
|
||||
@tagged_filenames = tagged_filenames
|
||||
@large_image_prefix = large_image_prefix
|
||||
@original_subdir = original_subdir
|
||||
end
|
||||
|
||||
@@ -99,7 +98,7 @@ class StorageManager
|
||||
when :crop
|
||||
"#{md5}.jpg"
|
||||
when :large
|
||||
"#{large_image_prefix}#{md5}.#{large_file_ext}"
|
||||
"sample-#{md5}.#{large_file_ext}"
|
||||
when :original
|
||||
"#{md5}.#{file_ext}"
|
||||
end
|
||||
|
||||
@@ -168,8 +168,6 @@ class UploadService
|
||||
end
|
||||
|
||||
def automatic_tags(upload, file)
|
||||
return "" unless Danbooru.config.enable_dimension_autotagging
|
||||
|
||||
tags = []
|
||||
tags << "video_with_sound" if is_video_with_audio?(upload, file)
|
||||
tags << "animated_gif" if is_animated_gif?(upload, file)
|
||||
|
||||
@@ -671,8 +671,6 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def add_automatic_tags(tags)
|
||||
return tags if !Danbooru.config.enable_dimension_autotagging
|
||||
|
||||
tags -= %w(incredibly_absurdres absurdres highres lowres huge_filesize flash webm mp4)
|
||||
|
||||
if has_dimensions?
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
class PostAppeal < ApplicationRecord
|
||||
class Error < Exception; end
|
||||
|
||||
MAX_APPEALS_PER_DAY = 1
|
||||
|
||||
belongs_to :creator, :class_name => "User"
|
||||
belongs_to :post
|
||||
validates_presence_of :reason
|
||||
@@ -47,8 +49,8 @@ class PostAppeal < ApplicationRecord
|
||||
end
|
||||
|
||||
def validate_creator_is_not_limited
|
||||
if appeal_count_for_creator >= Danbooru.config.max_appeals_per_day
|
||||
errors[:creator] << "can appeal at most #{Danbooru.config.max_appeals_per_day} post a day"
|
||||
if appeal_count_for_creator >= MAX_APPEALS_PER_DAY
|
||||
errors[:creator] << "can appeal at most #{MAX_APPEALS_PER_DAY} post a day"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class Upload < ApplicationRecord
|
||||
def initialize_attributes
|
||||
self.uploader_id = CurrentUser.id
|
||||
self.uploader_ip_addr = CurrentUser.ip_addr
|
||||
self.server = Danbooru.config.server_host
|
||||
self.server = Socket.gethostname
|
||||
end
|
||||
|
||||
def self.prune!(date = 1.day.ago)
|
||||
|
||||
@@ -244,7 +244,8 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def sha1(pass)
|
||||
Digest::SHA1.hexdigest("#{Danbooru.config.password_salt}--#{pass}--")
|
||||
salt = "choujin-steiner"
|
||||
Digest::SHA1.hexdigest("#{salt}--#{pass}--")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user