This commit is contained in:
r888888888
2014-04-14 14:32:01 -07:00
parent 7a61048d69
commit fad0ab7c93
105 changed files with 610 additions and 485 deletions

View File

@@ -2,10 +2,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
Bundler.require(:default, Rails.env)
end
module Danbooru

View File

@@ -1,6 +1,4 @@
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

View File

@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Danbooru::Application.initialize!
Rails.application.initialize!

View File

@@ -1,37 +1,37 @@
Danbooru::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View File

@@ -1,67 +1,83 @@
Danbooru::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests
# Code is not reloaded between requests.
config.cache_classes = true
# Full error reports are disabled and caching is turned on
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs
# Generate digests for assets URLs.
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# Set to :debug to see everything in the log.
config.log_level = :error
# Prepend all log lines with the following tags
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# Use a different cache store in production.
# config.cache_store = :dalli_store, Danbooru.config.memcached_servers
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end

View File

@@ -1,5 +1,5 @@
Danbooru::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
@@ -7,31 +7,33 @@ Danbooru::Application.configure do
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View File

@@ -23,7 +23,7 @@ module Danbooru
%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]))
self.class.connection.__send__(method_name, self.class.sanitize_sql_array([sql, *params]))
end
self.class.__send__(:define_method, "#{method_name}_sql") do |sql, *params|

View File

@@ -0,0 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@@ -23,3 +23,9 @@ end
class String
include Danbooru::Extensions::String
end
class FalseClass
def to_i
0
end
end

View File

@@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View File

@@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
#
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end

View File

@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View File

@@ -2,8 +2,8 @@ require File.expand_path('../../state_checker', __FILE__)
StateChecker.new.check!
Danbooru::Application.config.action_dispatch.session = {
Rails.application.config.action_dispatch.session = {
:key => '_danbooru2_session',
:secret => File.read(File.expand_path("~/.danbooru/session_secret_key"))
}
Danbooru::Application.config.secret_token = File.read(File.expand_path("~/.danbooru/secret_token"))
Rails.application.config.secret_token = File.read(File.expand_path("~/.danbooru/secret_token"))

View File

@@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
Danbooru::Application.config.session_store :cookie_store, :key => '_danbooru_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Danbooru::Application.config.session_store :active_record_store
Rails.application.config.session_store :cookie_store, key: '_danbooru_session'

View File

@@ -1,14 +1,14 @@
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# Disable root element in JSON by default.
# To enable root element in JSON for ActiveRecord objects.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end

View File

@@ -1,5 +1,5 @@
if Danbooru.config.amazon_ses && Rails.env == "production"
Danbooru::Application.config.action_mailer.smtp_settings = {
Rails.application.config.action_mailer.smtp_settings = {
:address => Danbooru.config.amazon_ses[:smtp_server_name],
:user_name => Danbooru.config.amazon_ses[:ses_smtp_user_name],
:password => Danbooru.config.amazon_ses[:ses_smtp_password],

View File

@@ -3,7 +3,7 @@ unless defined?(MEMCACHE)
end
if Rails.env.production?
Danbooru::Application.configure do
Rails.application.configure do
config.cache_store = :dalli_store, Danbooru.config.memcached_servers
end
end

View File

@@ -1,4 +1,4 @@
Danbooru::Application.routes.draw do
Rails.application.routes.draw do
namespace :admin do
resources :users, :only => [:edit, :update]
resource :alias_and_implication_import, :only => [:new, :create]
@@ -149,7 +149,7 @@ Danbooru::Application.routes.draw do
put :revert
post :undelete
end
resource :order, :only => [:edit, :update], :controller => "PoolOrders"
resource :order, :only => [:edit, :update], :controller => "pool_orders"
end
resource :pool_element, :only => [:create, :destroy] do
collection do
@@ -191,7 +191,7 @@ Danbooru::Application.routes.draw do
end
resources :artist_commentary_versions, :only => [:index]
resource :related_tag, :only => [:show]
match "reports/user_promotions" => "reports#user_promotions"
get "reports/user_promotions" => "reports#user_promotions"
resource :session do
collection do
get :sign_out
@@ -199,10 +199,10 @@ Danbooru::Application.routes.draw do
end
resource :source, :only => [:show]
resources :tags do
resource :correction, :only => [:new, :create, :show], :controller => "TagCorrections"
resource :correction, :only => [:new, :create, :show], :controller => "tag_corrections"
end
resources :tag_aliases do
resource :correction, :only => [:create, :new, :show], :controller => "TagAliasCorrections"
resource :correction, :only => [:create, :new, :show], :controller => "tag_alias_corrections"
member do
post :approve
end
@@ -262,28 +262,25 @@ Danbooru::Application.routes.draw do
resources :wpages, :controller => "wiki_pages"
resources :ftopics, :controller => "forum_topics"
resources :fposts, :controller => "forum_posts"
match "/m/posts", :controller => "mobile/posts", :action => "index"
match "/m/posts/:id", :controller => "mobile/posts", :action => "show"
match "/iqdb/similar_by_source", :controller => "iqdb", :action => "similar_by_source"
get "/m/posts", :controller => "mobile/posts", :action => "index"
get "/m/posts/:id", :controller => "mobile/posts", :action => "show"
get "/iqdb/similar_by_source", :controller => "iqdb", :action => "similar_by_source"
# legacy aliases
match "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}&search[name]=#{CGI::escape(req.params[:name].to_s)}"}
match "/artist/index.xml", :controller => "legacy", :action => "artists", :format => "xml"
match "/artist/index.json", :controller => "legacy", :action => "artists", :format => "json"
match "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
match "/artist/show/:id" => redirect("/artists/%{id}")
match "/artist/show" => redirect {|params, req| "/artists?name=#{CGI::escape(req.params[:name].to_s)}"}
match "/artist/history/:id" => redirect("/artist_versions?search[artist_id]=%{id}")
match "/artist/update/:id" => redirect("/artists/%{id}")
match "/artist/destroy/:id" => redirect("/artists/%{id}")
match "/artist/recent_changes" => redirect("/artist_versions")
match "/artist/create" => redirect("/artists")
get "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}&search[name]=#{CGI::escape(req.params[:name].to_s)}"}
get "/artist/index.xml", :controller => "legacy", :action => "artists", :format => "xml"
get "/artist/index.json", :controller => "legacy", :action => "artists", :format => "json"
get "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
get "/artist/show/:id" => redirect("/artists/%{id}")
get "/artist/show" => redirect {|params, req| "/artists?name=#{CGI::escape(req.params[:name].to_s)}"}
get "/artist/history/:id" => redirect("/artist_versions?search[artist_id]=%{id}")
get "/artist/recent_changes" => redirect("/artist_versions")
match "/comment" => redirect {|params, req| "/comments?page=#{req.params[:page]}"}
match "/comment/index" => redirect {|params, req| "/comments?page=#{req.params[:page]}"}
match "/comment/show/:id" => redirect("/comments/%{id}")
match "/comment/new" => redirect("/comments")
match("/comment/search" => redirect do |params, req|
get "/comment" => redirect {|params, req| "/comments?page=#{req.params[:page]}"}
get "/comment/index" => redirect {|params, req| "/comments?page=#{req.params[:page]}"}
get "/comment/show/:id" => redirect("/comments/%{id}")
get "/comment/new" => redirect("/comments")
get("/comment/search" => redirect do |params, req|
if req.params[:query] =~ /^user:(.+)/i
"/comments?group_by=comment&search[creator_name]=#{CGI::escape($1)}"
else
@@ -291,88 +288,85 @@ Danbooru::Application.routes.draw do
end
end)
match "/favorite" => redirect {|params, req| "/favorites?page=#{req.params[:page]}"}
match "/favorite/index" => redirect {|params, req| "/favorites?page=#{req.params[:page]}"}
match "/favorite/list_users.json", :controller => "legacy", :action => "unavailable"
get "/favorite" => redirect {|params, req| "/favorites?page=#{req.params[:page]}"}
get "/favorite/index" => redirect {|params, req| "/favorites?page=#{req.params[:page]}"}
get "/favorite/list_users.json", :controller => "legacy", :action => "unavailable"
match "/forum" => redirect {|params, req| "/forum_topics?page=#{req.params[:page]}"}
match "/forum/index" => redirect {|params, req| "/forum_topics?page=#{req.params[:page]}"}
match "/forum/show/:id" => redirect {|params, req| "/forum_posts/#{req.params[:id]}?page=#{req.params[:page]}"}
match "/forum/search" => redirect("/forum_posts/search")
match "/forum/new" => redirect("/forum_posts/new")
match "/forum/edit/:id" => redirect("/forum_posts/%{id}/edit")
get "/forum" => redirect {|params, req| "/forum_topics?page=#{req.params[:page]}"}
get "/forum/index" => redirect {|params, req| "/forum_topics?page=#{req.params[:page]}"}
get "/forum/show/:id" => redirect {|params, req| "/forum_posts/#{req.params[:id]}?page=#{req.params[:page]}"}
get "/forum/search" => redirect("/forum_posts/search")
match "/help/:title" => redirect {|params, req| ("/wiki_pages?title=#{CGI::escape('help:' + req.params[:title])}")}
get "/help/:title" => redirect {|params, req| ("/wiki_pages?title=#{CGI::escape('help:' + req.params[:title])}")}
match "/note" => redirect {|params, req| "/notes?page=#{req.params[:page]}"}
match "/note/index" => redirect {|params, req| "/notes?page=#{req.params[:page]}"}
match "/note/history" => redirect {|params, req| "/note_versions?search[updater_id]=#{req.params[:user_id]}"}
get "/note" => redirect {|params, req| "/notes?page=#{req.params[:page]}"}
get "/note/index" => redirect {|params, req| "/notes?page=#{req.params[:page]}"}
get "/note/history" => redirect {|params, req| "/note_versions?search[updater_id]=#{req.params[:user_id]}"}
match "/pool" => redirect {|params, req| "/pools?page=#{req.params[:page]}"}
match "/pool/index" => redirect {|params, req| "/pools?page=#{req.params[:page]}"}
match "/pool/show/:id" => redirect("/pools/%{id}")
match "/pool/history/:id" => redirect("/pool_versions?search[pool_id]=%{id}")
match "/pool/recent_changes" => redirect("/pool_versions")
get "/pool" => redirect {|params, req| "/pools?page=#{req.params[:page]}"}
get "/pool/index" => redirect {|params, req| "/pools?page=#{req.params[:page]}"}
get "/pool/show/:id" => redirect("/pools/%{id}")
get "/pool/history/:id" => redirect("/pool_versions?search[pool_id]=%{id}")
get "/pool/recent_changes" => redirect("/pool_versions")
match "/post/index.xml", :controller => "legacy", :action => "posts", :format => "xml"
match "/post/index.json", :controller => "legacy", :action => "posts", :format => "json"
match "/post/create.xml", :controller => "legacy", :action => "create_post", :format => "xml"
match "/post/piclens", :controller => "legacy", :action => "unavailable"
match "/post/index" => redirect {|params, req| "/posts?tags=#{CGI::escape(req.params[:tags].to_s)}&page=#{req.params[:page]}"}
match "/post" => redirect {|params, req| "/posts?tags=#{CGI::escape(req.params[:tags].to_s)}&page=#{req.params[:page]}"}
match "/post/upload" => redirect("/uploads/new")
match "/post/moderate" => redirect("/moderator/post/queue")
match "/post/atom" => redirect {|params, req| "/posts.atom?tags=#{CGI::escape(req.params[:tags].to_s)}"}
match "/post/atom.feed" => redirect {|params, req| "/posts.atom?tags=#{CGI::escape(req.params[:tags].to_s)}"}
match "/post/popular_by_day" => redirect("/explore/posts/popular")
match "/post/popular_by_week" => redirect("/explore/posts/popular")
match "/post/popular_by_month" => redirect("/explore/posts/popular")
match "/post/show/:id/:tag_title" => redirect("/posts/%{id}")
match "/post/show/:id" => redirect("/posts/%{id}")
match "/post/show" => redirect {|params, req| "/posts?md5=#{req.params[:md5]}"}
match "/post/view/:id/:tag_title" => redirect("/posts/%{id}")
match "/post/view/:id" => redirect("/posts/%{id}")
match "/post/flag/:id" => redirect("/posts/%{id}")
get "/post/index.xml", :controller => "legacy", :action => "posts", :format => "xml"
get "/post/index.json", :controller => "legacy", :action => "posts", :format => "json"
get "/post/create.xml", :controller => "legacy", :action => "create_post", :format => "xml"
get "/post/piclens", :controller => "legacy", :action => "unavailable"
get "/post/index" => redirect {|params, req| "/posts?tags=#{CGI::escape(req.params[:tags].to_s)}&page=#{req.params[:page]}"}
get "/post" => redirect {|params, req| "/posts?tags=#{CGI::escape(req.params[:tags].to_s)}&page=#{req.params[:page]}"}
get "/post/upload" => redirect("/uploads/new")
get "/post/moderate" => redirect("/moderator/post/queue")
get "/post/atom" => redirect {|params, req| "/posts.atom?tags=#{CGI::escape(req.params[:tags].to_s)}"}
get "/post/atom.feed" => redirect {|params, req| "/posts.atom?tags=#{CGI::escape(req.params[:tags].to_s)}"}
get "/post/popular_by_day" => redirect("/explore/posts/popular")
get "/post/popular_by_week" => redirect("/explore/posts/popular")
get "/post/popular_by_month" => redirect("/explore/posts/popular")
get "/post/show/:id/:tag_title" => redirect("/posts/%{id}")
get "/post/show/:id" => redirect("/posts/%{id}")
get "/post/show" => redirect {|params, req| "/posts?md5=#{req.params[:md5]}"}
get "/post/view/:id/:tag_title" => redirect("/posts/%{id}")
get "/post/view/:id" => redirect("/posts/%{id}")
get "/post/flag/:id" => redirect("/posts/%{id}")
match("/post_tag_history" => redirect do |params, req|
get("/post_tag_history" => redirect do |params, req|
page = req.params[:before_id].present? ? "b#{req.params[:before_id]}" : req.params[:page]
"/post_versions?page=#{page}&search[updater_id]=#{req.params[:user_id]}"
end)
match "/post_tag_history/index" => redirect {|params, req| "/post_versions?page=#{req.params[:page]}&search[post_id]=#{req.params[:post_id]}"}
get "/post_tag_history/index" => redirect {|params, req| "/post_versions?page=#{req.params[:page]}&search[post_id]=#{req.params[:post_id]}"}
match "/tag/index.xml", :controller => "legacy", :action => "tags", :format => "xml"
match "/tag/index.json", :controller => "legacy", :action => "tags", :format => "json"
match "/tag" => redirect {|params, req| "/tags?page=#{req.params[:page]}&search[name_matches]=#{CGI::escape(req.params[:name].to_s)}&search[order]=#{req.params[:order]}&search[category]=#{req.params[:type]}"}
match "/tag/index" => redirect {|params, req| "/tags?page=#{req.params[:page]}&search[name_matches]=#{CGI::escape(req.params[:name].to_s)}&search[order]=#{req.params[:order]}"}
get "/tag/index.xml", :controller => "legacy", :action => "tags", :format => "xml"
get "/tag/index.json", :controller => "legacy", :action => "tags", :format => "json"
get "/tag" => redirect {|params, req| "/tags?page=#{req.params[:page]}&search[name_matches]=#{CGI::escape(req.params[:name].to_s)}&search[order]=#{req.params[:order]}&search[category]=#{req.params[:type]}"}
get "/tag/index" => redirect {|params, req| "/tags?page=#{req.params[:page]}&search[name_matches]=#{CGI::escape(req.params[:name].to_s)}&search[order]=#{req.params[:order]}"}
match "/tag_implication" => redirect {|params, req| "/tag_implications?search[name_matches]=#{CGI::escape(req.params[:query].to_s)}"}
get "/tag_implication" => redirect {|params, req| "/tag_implications?search[name_matches]=#{CGI::escape(req.params[:query].to_s)}"}
match "/user/index.xml", :controller => "legacy", :action => "users", :format => "xml"
match "/user/index.json", :controller => "legacy", :action => "users", :format => "json"
match "/user" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
match "/user/index" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
match "/user/show/:id" => redirect("/users/%{id}")
match "/user/login" => redirect("/sessions/new")
match "/user_record" => redirect {|params, req| "/user_feedbacks?search[user_id]=#{req.params[:user_id]}"}
get "/user/index.xml", :controller => "legacy", :action => "users", :format => "xml"
get "/user/index.json", :controller => "legacy", :action => "users", :format => "json"
get "/user" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
get "/user/index" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
get "/user/show/:id" => redirect("/users/%{id}")
get "/user/login" => redirect("/sessions/new")
get "/user_record" => redirect {|params, req| "/user_feedbacks?search[user_id]=#{req.params[:user_id]}"}
match "/wiki" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
match "/wiki/index" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
match "/wiki/revert" => redirect("/wiki_pages")
match "/wiki/rename" => redirect("/wiki_pages")
match "/wiki/show" => redirect {|params, req| "/wiki_pages?title=#{CGI::escape(req.params[:title].to_s)}"}
match "/wiki/recent_changes" => redirect {|params, req| "/wiki_page_versions?search[updater_id]=#{req.params[:user_id]}"}
match "/wiki/history/:title" => redirect("/wiki_page_versions?title=%{title}")
get "/wiki" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
get "/wiki/index" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
get "/wiki/rename" => redirect("/wiki_pages")
get "/wiki/show" => redirect {|params, req| "/wiki_pages?title=#{CGI::escape(req.params[:title].to_s)}"}
get "/wiki/recent_changes" => redirect {|params, req| "/wiki_page_versions?search[updater_id]=#{req.params[:user_id]}"}
get "/wiki/history/:title" => redirect("/wiki_page_versions?title=%{title}")
match "/static/keyboard_shortcuts" => "static#keyboard_shortcuts", :as => "keyboard_shortcuts"
match "/static/bookmarklet" => "static#bookmarklet", :as => "bookmarklet"
match "/static/site_map" => "static#site_map", :as => "site_map"
match "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
match "/static/accept_terms_of_service" => "static#accept_terms_of_service", :as => "accept_terms_of_service"
match "/static/mrtg" => "static#mrtg", :as => "mrtg"
match "/static/contact" => "static#contact", :as => "contact"
match "/static/benchmark" => "static#benchmark"
match "/static/name_change" => "static#name_change", :as => "name_change"
match "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
get "/static/keyboard_shortcuts" => "static#keyboard_shortcuts", :as => "keyboard_shortcuts"
get "/static/bookmarklet" => "static#bookmarklet", :as => "bookmarklet"
get "/static/site_map" => "static#site_map", :as => "site_map"
get "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
get "/static/accept_terms_of_service" => "static#accept_terms_of_service", :as => "accept_terms_of_service"
get "/static/mrtg" => "static#mrtg", :as => "mrtg"
get "/static/contact" => "static#contact", :as => "contact"
get "/static/benchmark" => "static#benchmark"
get "/static/name_change" => "static#name_change", :as => "name_change"
get "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
root :to => "posts#index"
end

22
config/secrets.yml Normal file
View File

@@ -0,0 +1,22 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# 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.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: bcc62a512b9c055c292c17742f1e65bd6d88fa37f4d01c8475103809f3ac4c03e3e98605c47d55cd8801333010ea98920a61b722770629926759624bce732539
test:
secret_key_base: 60e32a818af77bdfc40bca866e3b4d7b88d7ba767057ffc9e4532279358af8c67d42f2b99c084b700727303ce25b812a592b52723ebc1e3b812fd09a1f969435
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>