2010-02-06 16:48:40 -05:00
|
|
|
module Danbooru
|
|
|
|
class Configuration
|
|
|
|
# The version of this Danbooru.
|
|
|
|
def version
|
|
|
|
"2.0.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
# The name of this Danbooru.
|
|
|
|
def app_name
|
|
|
|
"Danbooru"
|
|
|
|
end
|
|
|
|
|
2010-02-20 18:08:22 -05:00
|
|
|
# Contact email address of the admin.
|
|
|
|
def contact_email
|
|
|
|
"webmaster#{server_host}"
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# This is a salt used to make dictionary attacks on account passwords harder.
|
|
|
|
def password_salt
|
|
|
|
"choujin-steiner"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Set to true to allow new account signups.
|
|
|
|
def enable_signups?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
# Set to true to give all new users privileged access.
|
|
|
|
def start_as_privileged?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
# Set to true to give all new users contributor access.
|
|
|
|
def start_as_contributor?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
# What method to use to store images.
|
|
|
|
# local_flat: Store every image in one directory.
|
|
|
|
# local_hierarchy: Store every image in a hierarchical directory, based on the post's MD5 hash. On some file systems this may be faster.
|
|
|
|
def image_store
|
|
|
|
:local_flat
|
|
|
|
end
|
|
|
|
|
|
|
|
# Thumbnail size
|
|
|
|
def small_image_width
|
|
|
|
150
|
|
|
|
end
|
|
|
|
|
2010-02-08 01:40:39 -05:00
|
|
|
# Medium resize image width. Set to nil to disable.
|
2010-02-06 16:48:40 -05:00
|
|
|
def medium_image_width
|
2010-02-08 01:40:39 -05:00
|
|
|
480
|
2010-02-06 16:48:40 -05:00
|
|
|
end
|
|
|
|
|
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
|
2010-02-08 01:40:39 -05:00
|
|
|
1280
|
2010-02-06 16:48:40 -05:00
|
|
|
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
|
|
|
|
|
2010-02-06 16:48:40 -05:00
|
|
|
# List of memcached servers
|
|
|
|
def memcached_servers
|
|
|
|
%w(localhost:11211)
|
|
|
|
end
|
|
|
|
|
|
|
|
# After a post receives this many comments, new comments will no longer bump the post in comment/index.
|
|
|
|
def comment_threshold
|
|
|
|
40
|
|
|
|
end
|
|
|
|
|
|
|
|
# Members cannot post more than X comments in an hour.
|
|
|
|
def member_comment_limit
|
|
|
|
2
|
|
|
|
end
|
|
|
|
|
|
|
|
# Determine who can see a post.
|
|
|
|
def can_see_post?(post, user)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
# Determines who can see ads.
|
|
|
|
def can_see_ads?(user)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
# This is required for Rails 2.0.
|
|
|
|
def session_secret_key
|
|
|
|
"This should be at least 30 characters long"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Users cannot search for more than X regular tags at a time.
|
|
|
|
def tag_query_limit
|
|
|
|
6
|
|
|
|
end
|
|
|
|
|
|
|
|
# Max number of posts to cache
|
|
|
|
def tag_subscription_post_limit
|
|
|
|
200
|
|
|
|
end
|
|
|
|
|
|
|
|
# Max number of tag subscriptions per user
|
|
|
|
def max_tag_subscriptions
|
|
|
|
5
|
|
|
|
end
|
|
|
|
|
2010-02-08 01:40:39 -05:00
|
|
|
# Maximum size of an upload.
|
|
|
|
def max_file_size
|
|
|
|
5.megabytes
|
|
|
|
end
|
|
|
|
|
2010-02-06 23:11:26 -05:00
|
|
|
# The name of the server the app is hosted on.
|
2010-02-06 16:48:40 -05:00
|
|
|
def server_host
|
|
|
|
Socket.gethostname
|
|
|
|
end
|
2010-02-06 23:11:26 -05:00
|
|
|
|
2010-02-08 01:40:39 -05:00
|
|
|
# Names of other Danbooru servers which serve out of the same common database.
|
|
|
|
# Used in conjunction with load balancing to distribute files from one server to
|
|
|
|
# the others. This should match whatever gethostname returns on the other servers.
|
|
|
|
def other_server_hosts
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
|
2010-02-06 23:11:26 -05:00
|
|
|
# Returns a hash mapping various tag categories to a numerical value.
|
|
|
|
# Be sure to update the reverse_tag_category_mapping also.
|
|
|
|
def tag_category_mapping
|
|
|
|
@tag_category_mapping ||= {
|
|
|
|
"general" => 0,
|
|
|
|
"gen" => 0,
|
|
|
|
|
|
|
|
"artist" => 1,
|
|
|
|
"art" => 1,
|
|
|
|
|
|
|
|
"copyright" => 3,
|
|
|
|
"copy" => 3,
|
|
|
|
"co" => 3,
|
|
|
|
|
|
|
|
"character" => 4,
|
|
|
|
"char" => 4,
|
|
|
|
"ch" => 4
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
# Returns a hash maping numerical category values to their
|
|
|
|
# string equivalent. Be sure to update the tag_category_mapping also.
|
|
|
|
def reverse_tag_category_mapping
|
|
|
|
@reverse_tag_category_mapping ||= {
|
|
|
|
0 => "General",
|
|
|
|
1 => "Artist",
|
|
|
|
3 => "Copyright",
|
|
|
|
4 => "Character"
|
|
|
|
}
|
|
|
|
end
|
2010-03-10 18:21:43 -05:00
|
|
|
|
2010-03-11 19:42:04 -05:00
|
|
|
# If enabled, users must verify their email addresses.
|
|
|
|
def enable_email_verification?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
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-03-11 19:42:04 -05:00
|
|
|
%{
|
|
|
|
<script type="text/javascript">
|
|
|
|
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
|
|
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
try {
|
|
|
|
var pageTracker = _gat._getTracker("UA-86094-4");
|
|
|
|
pageTracker._trackPageview();
|
|
|
|
} catch(err) {}
|
|
|
|
</script>
|
|
|
|
}.html_safe
|
2010-03-10 18:21:43 -05:00
|
|
|
end
|
2010-02-06 16:48:40 -05:00
|
|
|
end
|
|
|
|
end
|