2011-09-18 15:47:15 -04:00
require 'socket'
2010-02-06 16:48:40 -05:00
module Danbooru
class Configuration
# The version of this Danbooru.
def version
2021-02-25 15:31:57 -05:00
" 2.1.0 "
2010-02-06 16:48:40 -05:00
end
2013-03-19 08:10:10 -04:00
2010-02-06 16:48:40 -05:00
# The name of this Danbooru.
def app_name
2022-10-10 07:26:12 -04:00
" e621 "
2010-02-06 16:48:40 -05:00
end
2013-03-19 08:10:10 -04:00
2016-02-09 17:25:23 -05:00
def description
2019-06-16 21:47:05 -04:00
" Find good furry art, fast "
2016-02-09 17:25:23 -05:00
end
2018-04-26 13:24:20 -04:00
def domain
2019-06-16 21:47:05 -04:00
" e621.net "
2018-04-26 13:24:20 -04:00
end
2020-07-04 21:27:17 -04:00
# Force rating:s on this version of the site.
2021-11-14 16:16:36 -05:00
def safe_mode?
2020-07-04 21:27:17 -04:00
false
end
2017-06-16 01:36:31 -04:00
# The canonical hostname of the site.
2011-09-18 15:47:15 -04:00
def hostname
Socket . gethostname
end
2013-03-19 08:10:10 -04:00
2010-02-20 18:08:22 -05:00
# Contact email address of the admin.
def contact_email
2022-03-16 13:34:23 -04:00
" management@ #{ domain } "
2010-02-20 18:08:22 -05:00
end
2013-03-19 08:10:10 -04:00
2019-02-23 11:45:10 -05:00
def takedown_email
2022-03-16 13:34:23 -04:00
" management@ #{ domain } "
2019-02-23 11:45:10 -05:00
end
2017-12-21 12:56:12 -05:00
# System actions, such as sending automated dmails, will be performed with
# this account. This account must have Moderator privileges.
#
# Run `rake db:seed` to create this account if it doesn't already exist in your install.
2017-02-23 21:15:29 -05:00
def system_user
2021-04-30 17:46:28 -04:00
" auto_moderator "
2017-02-23 21:15:29 -05:00
end
2016-10-24 19:06:39 -04:00
def source_code_url
2023-01-23 14:43:56 -05:00
" https://github.com/e621ng/e621ng "
2016-10-24 19:06:39 -04:00
end
2010-02-08 01:40:39 -05:00
# Stripped of any special characters.
def safe_app_name
app_name . gsub ( / [^a-zA-Z0-9_-] / , " _ " )
end
2013-03-19 08:10:10 -04:00
2010-02-06 16:48:40 -05:00
# The default name to use for anyone who isn't logged in.
def default_guest_name
" Anonymous "
end
2013-03-19 08:10:10 -04:00
2019-06-29 15:25:44 -04:00
def levels
{
" Anonymous " = > 0 ,
" Blocked " = > 10 ,
" Member " = > 20 ,
" Privileged " = > 30 ,
" Former Staff " = > 34 ,
" Janitor " = > 35 ,
2019-06-30 13:37:32 -04:00
" Moderator " = > 40 ,
2019-06-29 15:25:44 -04:00
" Admin " = > 50
}
end
2023-08-21 15:41:06 -04:00
# Prevent new users from going above 80k while allowing those currently above
# it to continue adding new favorites with the old limit.
# { 123 => 200_000 }
def legacy_favorite_limit
{ }
end
2016-10-04 20:56:07 -04:00
# Set the default level, permissions, and other settings for new users here.
def customize_new_user ( user )
2022-12-22 06:44:07 -05:00
user . blacklisted_tags = default_blacklist . join ( " \n " )
2022-11-27 11:44:03 -05:00
user . comment_threshold = - 10
user . enable_auto_complete = true
2022-12-22 06:44:07 -05:00
user . enable_keyboard_navigation = true
user . per_page = 75
user . show_post_statistics = true
2022-11-27 11:44:03 -05:00
user . style_usernames = true
2022-12-22 06:44:07 -05:00
end
def default_blacklist
[ ]
2010-02-06 16:48:40 -05:00
end
2013-03-19 08:10:10 -04:00
2023-09-03 12:24:40 -04:00
def safeblocked_tags
[ ]
end
2019-06-16 21:47:05 -04:00
# This allows using statically linked copies of ffmpeg in non default locations. Not universally supported across
# the codebase at this time.
def ffmpeg_path
" /usr/bin/ffmpeg "
end
2010-02-06 16:48:40 -05:00
# Thumbnail size
def small_image_width
150
end
2013-03-19 08:10:10 -04:00
2010-02-08 01:40:39 -05:00
# Large resize image width. Set to nil to disable.
2010-02-06 16:48:40 -05:00
def large_image_width
2013-01-06 14:54:01 -05:00
850
2010-02-06 16:48:40 -05:00
end
2013-03-19 08:10:10 -04:00
2012-08-21 18:29:09 -04:00
def large_image_prefix
" sample- "
end
2013-03-19 08:10:10 -04:00
2019-02-12 06:00:57 -05:00
def protected_path_prefix
" deleted "
end
def protected_file_secret
" abc123 "
end
2020-05-10 18:07:43 -04:00
def replacement_path_prefix
" replacements "
end
def replacement_file_secret
" abc123 "
end
2019-02-15 06:14:35 -05:00
def deleted_preview_url
" /images/deleted-preview.png "
end
2010-02-06 23:11:26 -05:00
# When calculating statistics based on the posts table, gather this many posts to sample from.
def post_sample_size
300
end
2013-03-19 08:10:10 -04:00
2010-02-06 16:48:40 -05:00
# List of memcached servers
def memcached_servers
2016-10-17 18:53:37 -04:00
%w( 127.0.0.1:11211 )
2010-02-06 16:48:40 -05:00
end
2013-03-19 08:10:10 -04:00
2020-07-04 21:27:17 -04:00
def alias_implication_forum_category
1
end
2010-02-06 16:48:40 -05:00
# After a post receives this many comments, new comments will no longer bump the post in comment/index.
def comment_threshold
40
end
2013-03-19 08:10:10 -04:00
2021-11-14 16:16:36 -05:00
def disable_throttles?
2019-07-19 06:48:16 -04:00
false
end
2021-11-14 16:16:36 -05:00
def disable_age_checks?
2019-09-15 13:19:16 -04:00
false
end
2021-11-14 16:16:36 -05:00
def disable_cache_store?
2021-08-24 13:22:01 -04:00
false
end
2010-02-06 16:48:40 -05:00
# Members cannot post more than X comments in an hour.
def member_comment_limit
2019-06-27 11:33:02 -04:00
15
end
2019-09-04 00:56:41 -04:00
def comment_vote_limit
10
end
def post_vote_limit
3_000
end
2019-06-27 11:33:02 -04:00
def dmail_limit
20
end
def dmail_minute_limit
1
end
2020-07-10 07:20:24 -04:00
def tag_suggestion_limit
15
end
2021-03-04 23:33:56 -05:00
def forum_vote_limit
2021-03-11 14:28:43 -05:00
50
2021-03-04 23:33:56 -05:00
end
2019-06-27 11:33:02 -04:00
# Blips created in the last hour
def blip_limit
25
end
# Artists creator or edited in the last hour
def artist_edit_limit
25
end
# Wiki pages created or edited in the last hour
def wiki_edit_limit
60
end
# Notes applied to posts edited or created in the last hour
def note_edit_limit
50
end
# Pools created in the last hour
def pool_limit
2010-02-06 16:48:40 -05:00
2
end
2019-06-27 11:33:02 -04:00
# Pools created or edited in the last hour
def pool_edit_limit
10
end
2020-04-12 21:03:36 -04:00
# Pools that you can edit the posts for in the last hour
def pool_post_edit_limit
30
end
2019-06-22 04:48:08 -04:00
# Members cannot create more than X post versions in an hour.
def post_edit_limit
150
end
2019-09-04 02:06:30 -04:00
def post_flag_limit
2022-11-09 11:32:32 -05:00
20
2019-09-04 02:06:30 -04:00
end
2019-09-04 00:56:41 -04:00
# Flat limit that applies to all users, regardless of level
def hourly_upload_limit
30
end
2019-09-04 02:06:30 -04:00
def ticket_limit
30
end
2018-11-07 17:10:16 -05:00
# Members cannot change the category of pools with more than this many posts.
def pool_category_change_limit
2019-09-04 00:56:41 -04:00
30
2018-11-07 17:10:16 -05:00
end
2020-11-29 01:01:40 -05:00
def post_replacement_per_day_limit
2
end
def post_replacement_per_post_limit
5
end
2020-04-12 22:08:33 -04:00
def remember_key
" abc123 "
end
2019-04-03 21:56:47 -04:00
def tag_type_change_cutoff
100
end
2013-03-19 08:10:10 -04:00
2010-02-06 16:48:40 -05:00
# Users cannot search for more than X regular tags at a time.
2013-02-20 21:56:09 -05:00
def tag_query_limit
2022-10-10 07:26:12 -04:00
40
2013-02-20 21:56:09 -05:00
end
2013-03-19 08:10:10 -04:00
2017-11-19 21:27:30 -05:00
# Return true if the given tag shouldn't count against the user's tag search limit.
def is_unlimited_tag? ( tag )
! ! ( tag =~ / \ A(-?status:deleted|rating:s.*|limit:.+) \ z /i )
end
2011-06-24 18:22:54 -04:00
# After this many pages, the paginator will switch to sequential mode.
def max_numbered_pages
2021-11-02 09:32:40 -04:00
750
2011-06-24 18:22:54 -04:00
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def blip_max_size
1_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def comment_max_size
10_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def dmail_max_size
50_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def forum_post_max_size
50_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def note_max_size
1_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def pool_descr_max_size
10_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def post_descr_max_size
50_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def ticket_max_size
5_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def user_about_max_size
50_000
end
2022-09-20 14:11:03 -04:00
2021-10-31 23:30:37 -04:00
def wiki_page_max_size
250_000
end
2013-03-19 08:10:10 -04:00
2020-02-02 16:50:20 -05:00
def discord_site
end
def discord_secret
end
2018-02-17 17:07:56 -05:00
# Maximum size of an upload. If you change this, you must also change
# `client_max_body_size` in your nginx.conf.
2010-02-08 01:40:39 -05:00
def max_file_size
2019-06-16 21:47:05 -04:00
100 . megabytes
end
def max_file_sizes
{
2022-03-21 11:50:17 -04:00
'jpg' = > 100 . megabytes ,
'png' = > 100 . megabytes ,
2022-10-15 10:30:33 -04:00
'gif' = > 20 . megabytes ,
2022-03-21 11:50:17 -04:00
'webm' = > 100 . megabytes
2019-06-16 21:47:05 -04:00
}
end
def max_apng_file_size
20 . megabytes
end
# Measured in seconds
def max_video_duration
2019-10-30 12:33:57 -04:00
3600
2010-02-08 01:40:39 -05:00
end
2013-03-19 08:10:10 -04:00
2018-03-25 19:05:52 -04:00
# Maximum resolution (width * height) of an upload. Default: 441 megapixels (21000x21000 pixels).
def max_image_resolution
2019-06-16 21:47:05 -04:00
15000 * 15000
2018-03-25 19:05:52 -04:00
end
# Maximum width of an upload.
def max_image_width
2019-06-16 21:47:05 -04:00
15000
2018-03-25 19:05:52 -04:00
end
# Maximum height of an upload.
def max_image_height
2019-06-16 21:47:05 -04:00
15000
2018-03-25 19:05:52 -04:00
end
2020-02-26 03:26:13 -05:00
def max_tags_per_post
2000
end
2018-01-28 20:57:45 -05:00
# Permanently redirect all HTTP requests to HTTPS.
#
# https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
# http://api.rubyonrails.org/classes/ActionDispatch/SSL.html
def ssl_options
{
redirect : { exclude : - > ( request ) { request . subdomain == " insecure " } } ,
hsts : {
expires : 1 . year ,
preload : true ,
subdomains : false ,
} ,
}
end
2018-03-14 17:57:29 -04:00
# The method to use for storing image files.
def storage_manager
# Store files on the local filesystem.
# base_dir - where to store files (default: under public/data)
# base_url - where to serve files from (default: http://#{hostname}/data)
# hierarchical: false - store files in a single directory
# hierarchical: true - store files in a hierarchical directory structure, based on the MD5 hash
2022-10-10 07:26:12 -04:00
StorageManager :: Local . new ( base_dir : " #{ Rails . root } /public/data " , hierarchical : true )
2018-03-14 17:57:29 -04:00
# Select the storage method based on the post's id and type (preview, large, or original).
# StorageManager::Hybrid.new do |id, md5, file_ext, type|
# if type.in?([:large, :original]) && id.in?(0..850_000)
2022-04-07 12:23:02 -04:00
# StorageManager::Local.new(base_dir: "/path/to/files", hierarchical: true)
2018-03-14 17:57:29 -04:00
# else
2022-04-07 12:23:02 -04:00
# StorageManager::Local.new(base_dir: "/path/to/files", hierarchical: true)
2018-03-14 17:57:29 -04:00
# end
# end
end
2018-03-18 17:33:26 -04:00
# The method to use for backing up image files.
def backup_storage_manager
# Don't perform any backups.
StorageManager :: Null . new
# Backup files to /mnt/backup on the local filesystem.
# StorageManager::Local.new(base_dir: "/mnt/backup", hierarchical: false)
end
2018-01-03 14:42:08 -05:00
2010-03-11 19:42:04 -05:00
# If enabled, users must verify their email addresses.
def enable_email_verification?
2010-10-27 20:16:43 -04:00
false
2010-03-11 19:42:04 -05:00
end
2013-03-19 08:10:10 -04:00
2019-08-17 12:00:26 -04:00
def enable_signups?
true
end
2019-08-02 18:25:00 -04:00
def flag_reasons
[
2022-08-20 12:19:08 -04:00
{
name : " uploading_guidelines " ,
reason : " Does not meet the [[uploading_guidelines|uploading guidelines]] " ,
text : " This post fails to meet the site's standards, be it for artistic worth, image quality, relevancy, or something else. \n Keep in mind that your personal preferences have no bearing on this. If you find the content of a post objectionable, simply [[e621:blacklist|blacklist]] it. "
} ,
{
name : 'dnp_artist' ,
reason : " The artist of this post is on the [[avoid_posting|avoid posting list]] " ,
text : " Certain artists have requested that their work is not to be published on this site, and were granted [[avoid_posting|Do Not Post]] status. \n Sometimes, that status comes with conditions; see [[conditional_dnp]] for more information "
} ,
{
name : 'pay_content' ,
reason : " Paysite, commercial, or subscription content " ,
text : " We do not host paysite or commercial content of any kind. This includes Patreon leaks, reposts from piracy websites, and so on. "
} ,
{
name : 'trace' ,
reason : " Trace of another artist's work " ,
text : " Images traced from other artists' artwork are not accepted on this site. Referencing from something is fine, but outright copying someone else's work is not. \n Please, leave more information in the comments, or simply add the original artwork as the posts's parent if it's hosted on this site. "
} ,
{
name : 'previously_deleted' ,
reason : " Previously deleted " ,
text : " Posts usually get removed for a good reason, and reuploading of deleted content is not acceptable. \n Please, leave more information in the comments, or simply add the original post as this post's parent. "
} ,
{
name : 'real_porn' ,
reason : " Real-life pornography " ,
text : " Posts featuring real-life pornography are not acceptable on this site. No exceptions. \n Note that images featuring non-erotic photographs are acceptable. "
} ,
{
name : 'corrupt' ,
reason : " File is either corrupted, broken, or otherwise does not work " ,
text : " Something about this post does not work quite right. This may be a broken video, or a corrupted image. \n Either way, in order to avoid confusion, please explain the situation in the comments. "
} ,
{
name : 'inferior' ,
reason : " Duplicate or inferior version of another post " ,
text : " A superior version of this post already exists on the site. \n This may include images with better visual quality (larger, less compressed), but may also feature \" fixed \" versions, with visual mistakes accounted for by the artist. \n Note that edits and alternate versions do not fall under this category. " ,
parent : true
} ,
2019-08-02 18:25:00 -04:00
]
end
2021-11-14 16:16:36 -05:00
2021-10-14 13:41:01 -04:00
def deletion_reasons
[
" Inferior version/duplicate of post # %PARENT_ID% " ,
" Previously deleted (post # %PARENT_ID%) " ,
" Excessive same base image set " ,
" Colored base " ,
2023-01-12 06:53:59 -05:00
" Advertisement " ,
2022-10-13 14:44:53 -04:00
" Underage artist " ,
2021-10-14 13:41:01 -04:00
" " ,
" Does not meet minimum quality standards (Artistic) " ,
" Does not meet minimum quality standards (Resolution) " ,
" Does not meet minimum quality standards (Compression) " ,
2023-04-02 17:15:51 -04:00
" Does not meet minimum quality standards (Trivial or low quality edit) " ,
2021-10-14 13:41:01 -04:00
" Does not meet minimum quality standards (Bad digitization of traditional media) " ,
2021-10-17 13:04:24 -04:00
" Does not meet minimum quality standards (Photo) " ,
2021-10-14 13:41:01 -04:00
" Does not meet minimum quality standards (%OTHER_ID%) " ,
" Broken/corrupted file " ,
" JPG resaved as PNG " ,
" " ,
" Irrelevant to site (Human only) " ,
" Irrelevant to site (Screencap) " ,
" Irrelevant to site (Zero pictured) " ,
2022-10-14 15:35:10 -04:00
" Irrelevant to site (AI assisted/generated) " ,
2021-10-14 13:41:01 -04:00
" Irrelevant to site (%OTHER_ID%) " ,
" " ,
" Paysite/commercial content " ,
" Traced artwork " ,
2021-10-17 13:04:24 -04:00
" Traced artwork (post # %PARENT_ID%) " ,
2021-10-14 13:41:01 -04:00
" Takedown # %OTHER_ID% " ,
" The artist of this post is on the [[avoid_posting|avoid posting list]] " ,
2021-10-17 13:04:24 -04:00
" [[conditional_dnp|Conditional DNP]] (Only the artist is allowed to post) " ,
" [[conditional_dnp|Conditional DNP]] (%OTHER_ID%) " ,
2021-10-14 13:41:01 -04:00
]
2021-10-18 00:55:59 -04:00
end
2019-08-02 18:25:00 -04:00
2010-03-10 18:21:43 -05:00
# Any custom code you want to insert into the default layout without
# having to modify the templates.
def custom_html_header_content
2010-11-19 13:44:11 -05:00
nil
2010-03-10 18:21:43 -05:00
end
2013-03-19 08:10:10 -04:00
2016-11-21 02:30:01 -05:00
def flag_notice_wiki_page
" help:flag_notice "
end
2017-05-16 23:51:05 -04:00
def replacement_notice_wiki_page
" help:replacement_notice "
end
2010-03-17 19:20:44 -04:00
# The number of posts displayed per page.
def posts_per_page
20
end
2010-10-08 18:42:26 -04:00
def is_post_restricted? ( post )
2010-11-19 13:44:11 -05:00
false
2010-10-08 18:42:26 -04:00
end
2013-03-19 08:10:10 -04:00
2019-06-29 11:45:58 -04:00
# TODO: Investigate what this does and where it is used.
2010-10-08 18:42:26 -04:00
def is_user_restricted? ( user )
2019-06-29 11:45:58 -04:00
! user . is_privileged?
2010-10-08 18:42:26 -04:00
end
2013-03-19 08:10:10 -04:00
2010-10-08 18:42:26 -04:00
def can_user_see_post? ( user , post )
2022-11-09 11:32:32 -05:00
return false if post . is_deleted? && ! user . is_janitor?
2019-02-13 22:58:38 -05:00
if is_user_restricted? ( user ) && is_post_restricted? ( post )
2010-10-08 18:42:26 -04:00
false
else
true
end
end
2013-03-19 08:10:10 -04:00
2019-07-17 15:30:28 -04:00
def user_needs_login_for_post? ( post )
false
end
2010-10-08 18:42:26 -04:00
def select_posts_visible_to_user ( user , posts )
2011-11-11 17:50:26 -05:00
posts . select { | x | can_user_see_post? ( user , x ) }
2010-10-08 18:42:26 -04:00
end
2013-03-19 08:10:10 -04:00
2021-11-14 16:16:36 -05:00
def enable_dimension_autotagging?
2013-03-12 17:01:52 -04:00
true
end
2014-03-21 19:43:02 -04:00
2017-07-19 20:37:14 -04:00
# The default headers to be sent with outgoing http requests. Some external
# services will fail if you don't set a valid User-Agent.
def http_headers
{
" User-Agent " = > " #{ Danbooru . config . safe_app_name } / #{ Danbooru . config . version } " ,
}
end
2017-07-12 18:52:09 -04:00
def httparty_options
# proxy example:
2017-06-29 21:07:07 -04:00
# {http_proxyaddr: "", http_proxyport: "", http_proxyuser: nil, http_proxypass: nil}
2017-07-19 20:37:14 -04:00
{
2019-09-28 03:43:43 -04:00
timeout : 10 ,
open_timout : 5 ,
2017-07-19 20:37:14 -04:00
headers : Danbooru . config . http_headers ,
}
2017-06-29 21:07:07 -04:00
end
2016-11-28 20:28:47 -05:00
# you should override this
2015-09-03 20:03:03 -04:00
def email_key
" zDMSATq0W3hmA5p3rKTgD "
end
2019-09-13 15:46:44 -04:00
def mailgun_api_key
''
end
def mailgun_domain
''
end
def mail_from_addr
'noreply@localhost'
end
2015-08-18 15:25:26 -04:00
# For downloads, if the host matches any of these IPs, block it
def banned_ip_for_download? ( ip_addr )
2015-08-18 15:45:10 -04:00
raise ArgumentError unless ip_addr . is_a? ( IPAddr )
2019-06-16 21:47:05 -04:00
ipv4s = %w( 127.0.0.1/8 169.254.0.0/16 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 )
ipv6s = %w( ::1 fe80::/10 fd00::/8 )
2015-08-18 15:45:10 -04:00
2015-08-18 17:18:27 -04:00
if ip_addr . ipv4?
2019-06-16 21:47:05 -04:00
ipv4s . any? { | range | IPAddr . new ( range ) . include? ( ip_addr ) }
2015-08-18 17:18:27 -04:00
elsif ip_addr . ipv6?
2019-06-16 21:47:05 -04:00
ipv6s . any? { | range | IPAddr . new ( range ) . include? ( ip_addr ) }
2015-08-18 15:45:10 -04:00
else
false
end
2015-08-18 15:25:26 -04:00
end
2015-08-25 19:34:51 -04:00
2018-01-02 17:32:38 -05:00
# disable this for tests
def enable_sock_puppet_validation?
true
end
2023-04-17 16:36:29 -04:00
def iqdb_server
end
2019-10-18 22:09:02 -04:00
def elasticsearch_host
'127.0.0.1'
end
2017-11-28 23:37:02 -05:00
# Use a recaptcha on the signup page to protect against spambots creating new accounts.
# https://developers.google.com/recaptcha/intro
def enable_recaptcha?
Rails . env . production? && Danbooru . config . recaptcha_site_key . present? && Danbooru . config . recaptcha_secret_key . present?
end
def recaptcha_site_key
end
def recaptcha_secret_key
end
2018-07-09 13:06:20 -04:00
2021-11-14 16:16:36 -05:00
def enable_image_cropping?
2018-07-09 13:06:20 -04:00
true
end
2019-06-16 21:47:05 -04:00
2018-11-12 21:02:49 -05:00
def redis_url
end
2019-02-07 00:08:03 -05:00
def bypass_upload_whitelist? ( user )
2019-02-07 13:05:50 -05:00
user . is_admin?
2019-02-07 00:08:03 -05:00
end
2019-08-23 15:48:18 -04:00
def ads_enabled?
false
end
2019-10-12 15:42:13 -04:00
def ads_zone_desktop
{ zone : nil , revive_id : nil , checksum : nil }
2019-08-23 15:48:18 -04:00
end
2019-10-12 15:42:13 -04:00
def ads_zone_mobile
{ zone : nil , revive_id : nil , checksum : nil }
2019-08-23 15:48:18 -04:00
end
2020-03-18 23:18:21 -04:00
2021-07-17 19:35:52 -04:00
# Additional video samples will be generated in these dimensions if it makes sense to do so
# They will be available as additional scale options on applicable posts in the order they appear here
2020-09-03 18:39:33 -04:00
def video_rescales
2021-07-17 19:35:52 -04:00
{ '720p' = > [ 1280 , 720 ] , '480p' = > [ 640 , 480 ] }
2020-09-03 18:39:33 -04:00
end
def image_rescales
[ ]
end
2021-07-18 11:50:57 -04:00
2021-11-14 16:16:36 -05:00
def readonly_mode?
false
2021-07-18 11:50:57 -04:00
end
2022-09-20 14:11:03 -04:00
def enable_visitor_metrics?
2022-12-17 13:24:15 -05:00
false
2022-09-20 14:11:03 -04:00
end
2023-06-26 15:10:28 -04:00
def janitor_reports_discord_webhook_url
nil
end
2010-02-06 16:48:40 -05:00
end
2017-01-21 02:15:11 -05:00
class EnvironmentConfiguration
2017-01-24 18:02:53 -05:00
def custom_configuration
@custom_configuration || = CustomConfiguration . new
end
2021-11-14 16:16:36 -05:00
def env_to_boolean ( method , var )
is_boolean = method . to_s . end_with? " ? "
return true if is_boolean && var . truthy?
return false if is_boolean && var . falsy?
var
end
2023-08-01 13:32:24 -04:00
def method_missing ( method , * )
2018-04-08 12:24:53 -04:00
var = ENV [ " DANBOORU_ #{ method . to_s . upcase . chomp ( " ? " ) } " ]
2017-01-21 02:15:11 -05:00
if var . present?
2021-11-14 16:16:36 -05:00
env_to_boolean ( method , var )
2017-01-21 02:15:11 -05:00
else
2023-08-01 13:32:24 -04:00
custom_configuration . send ( method , * )
2017-01-21 02:15:11 -05:00
end
end
end
2018-01-28 17:49:24 -05:00
def config
@configuration || = EnvironmentConfiguration . new
end
module_function :config
2010-02-06 16:48:40 -05:00
end