added user test, basic user methods
This commit is contained in:
@@ -4,4 +4,4 @@
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
ActionController::Base.cookie_verifier_secret = '9d3404d788351e80007345ca60b0cc4484e1906a2feab4be105e0637946c220e1f7239902b4234892923b9b45cf6f9a0a818302d81f890849e9bfe19ce03a30d'
|
||||
ActionController::Base.cookie_verifier_secret = '214c98302eef905ab8bce4a19562e322097c526f28e718160a3c0d617ddc8edab6ae7e22cb5eec8930e215bfb936a7086d6f5b146c0092a9af1884613ce0a260'
|
||||
|
||||
31
config/initializers/core_extensions.rb
Normal file
31
config/initializers/core_extensions.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
class ActiveRecord::Base
|
||||
class << self
|
||||
public :sanitize_sql_array
|
||||
end
|
||||
|
||||
%w(execute select_value select_values select_all).each do |method_name|
|
||||
define_method("#{method_name}_sql") do |sql, *params|
|
||||
connection.__send__(method_name, self.class.sanitize_sql_array([sql, *params]))
|
||||
end
|
||||
|
||||
self.class.__send__(:define_method, "#{method_name}_sql") do |sql, *params|
|
||||
connection.__send__(method_name, sanitize_sql_array([sql, *params]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class NilClass
|
||||
def id
|
||||
raise NoMethodError
|
||||
end
|
||||
end
|
||||
|
||||
class String
|
||||
def to_escaped_for_sql_like
|
||||
return self.gsub(/\\/, '\0\0').gsub(/%/, '\\%').gsub(/_/, '\\_').gsub(/\*/, '%')
|
||||
end
|
||||
|
||||
def to_escaped_js
|
||||
return self.gsub(/\\/, '\0\0').gsub(/['"]/) {|m| "\\#{m}"}.gsub(/\r\n|\r|\n/, '\\n')
|
||||
end
|
||||
end
|
||||
10
config/initializers/danbooru_config.rb
Normal file
10
config/initializers/danbooru_config.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require "#{Rails.root}/config/danbooru_default_config"
|
||||
require "#{Rails.root}/config/danbooru_local_config"
|
||||
|
||||
module Danbooru
|
||||
def config
|
||||
@configuration ||= CustomConfiguration.new
|
||||
end
|
||||
|
||||
module_function :config
|
||||
end
|
||||
6
config/initializers/memcache.rb
Normal file
6
config/initializers/memcache.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
require 'memcache'
|
||||
|
||||
unless defined?(MEMCACHE)
|
||||
MEMCACHE = MemCache.new :c_threshold => 10_000, :compression => true, :debug => false, :namespace => Danbooru.config.app_name.gsub(/[^A-Za-z0-9]/, "_"), :readonly => false, :urlencode => false
|
||||
MEMCACHE.servers = Danbooru.config.memcached_servers
|
||||
end
|
||||
@@ -5,8 +5,8 @@
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
ActionController::Base.session = {
|
||||
:key => '_danbooru2_session',
|
||||
:secret => '8c46b9a05b0222b74454c6f4bd461be89cc762d9ef3dab4513997670ffed45086bc7a025d45ead5accca656cfb9ab64e70dd44c4379653cf8d4ca45f455ac8ec'
|
||||
:key => '_danbooru_session',
|
||||
:secret => '3102c705148af8124298f9e89d45da3d26e47cc4d9a67cb1c8d9c42c008ee253786346efda50331bb14811f1f445c1c9ed2d51597ad2017328de0dd263048d1a'
|
||||
}
|
||||
|
||||
# Use the database for sessions instead of the cookie-based default,
|
||||
|
||||
Reference in New Issue
Block a user