2013-02-05 14:16:51 -05:00
|
|
|
require 'sidekiq/web'
|
|
|
|
|
|
|
|
require_dependency 'admin_constraint'
|
|
|
|
|
|
|
|
# This used to be User#username_format, but that causes a preload of the User object
|
2013-02-14 14:11:13 -05:00
|
|
|
# and makes Guard not work properly.
|
2013-03-08 15:04:37 -05:00
|
|
|
USERNAME_ROUTE_FORMAT = /[A-Za-z0-9\_]+/
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
Discourse::Application.routes.draw do
|
|
|
|
|
2013-03-23 11:02:59 -04:00
|
|
|
match "/404", to: "exceptions#not_found"
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
mount Sidekiq::Web => '/sidekiq', constraints: AdminConstraint.new
|
|
|
|
|
2013-02-14 14:11:13 -05:00
|
|
|
resources :forums do
|
|
|
|
collection do
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'request_access'
|
|
|
|
post 'request_access_submit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
get 'srv/status' => 'forums#status'
|
|
|
|
|
|
|
|
namespace :admin, constraints: AdminConstraint.new do
|
|
|
|
get '' => 'admin#index'
|
|
|
|
|
|
|
|
resources :site_settings
|
2013-02-27 22:39:42 -05:00
|
|
|
get 'reports/:type' => 'reports#show'
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
resources :users, id: USERNAME_ROUTE_FORMAT do
|
|
|
|
collection do
|
|
|
|
get 'list/:query' => 'users#index'
|
|
|
|
put 'approve-bulk' => 'users#approve_bulk'
|
|
|
|
end
|
2013-02-24 09:01:58 -05:00
|
|
|
put 'ban'
|
|
|
|
put 'delete_all_posts'
|
|
|
|
put 'unban'
|
|
|
|
put 'revoke_admin'
|
|
|
|
put 'grant_admin'
|
|
|
|
put 'revoke_moderation'
|
|
|
|
put 'grant_moderation'
|
|
|
|
put 'approve'
|
|
|
|
post 'refresh_browsers'
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
resources :impersonate
|
|
|
|
resources :email_logs do
|
|
|
|
collection do
|
2013-02-24 09:01:58 -05:00
|
|
|
post 'test'
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
get 'customize' => 'site_customizations#index'
|
|
|
|
get 'flags' => 'flags#index'
|
|
|
|
get 'flags/:filter' => 'flags#index'
|
|
|
|
post 'flags/clear/:id' => 'flags#clear'
|
|
|
|
resources :site_customizations
|
|
|
|
resources :export
|
|
|
|
get 'version_check' => 'versions#show'
|
2013-03-14 18:26:12 -04:00
|
|
|
resources :dashboard, only: [:index]
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
get 'email_preferences' => 'email#preferences_redirect'
|
|
|
|
get 'email/unsubscribe/:key' => 'email#unsubscribe', as: 'email_unsubscribe'
|
|
|
|
post 'email/resubscribe/:key' => 'email#resubscribe', as: 'email_resubscribe'
|
|
|
|
|
|
|
|
|
2013-03-23 11:02:59 -04:00
|
|
|
resources :session, id: USERNAME_ROUTE_FORMAT, only: [:create, :destroy] do
|
2013-02-14 14:11:13 -05:00
|
|
|
collection do
|
2013-02-05 14:16:51 -05:00
|
|
|
post 'forgot_password'
|
|
|
|
end
|
2013-02-14 14:11:13 -05:00
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-03-23 11:02:59 -04:00
|
|
|
resources :users, except: [:show, :update] do
|
2013-02-14 14:11:13 -05:00
|
|
|
collection do
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'check_username'
|
|
|
|
get 'is_local_username'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :static
|
2013-03-13 10:22:56 -04:00
|
|
|
post 'login' => 'static#enter'
|
2013-02-14 14:11:13 -05:00
|
|
|
get 'faq' => 'static#show', id: 'faq'
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'tos' => 'static#show', id: 'tos'
|
|
|
|
get 'privacy' => 'static#show', id: 'privacy'
|
2013-02-14 14:11:13 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'users/search/users' => 'users#search_users'
|
|
|
|
get 'users/password-reset/:token' => 'users#password_reset'
|
|
|
|
put 'users/password-reset/:token' => 'users#password_reset'
|
|
|
|
get 'users/activate-account/:token' => 'users#activate_account'
|
|
|
|
get 'users/authorize-email/:token' => 'users#authorize_email'
|
2013-02-06 19:25:21 -05:00
|
|
|
get 'users/hp' => 'users#get_honeypot_value'
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
get 'user_preferences' => 'users#user_preferences_redirect'
|
2013-03-23 11:02:59 -04:00
|
|
|
get 'users/:username/private-messages' => 'user_actions#private_messages', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put 'users/:username' => 'users#update', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username/preferences' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}, as: :email_preferences
|
|
|
|
get 'users/:username/preferences/email' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put 'users/:username/preferences/email' => 'users#change_email', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username/preferences/username' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put 'users/:username/preferences/username' => 'users#username', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username/avatar(/:size)' => 'users#avatar', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username/invited' => 'users#invited', constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get 'users/:username/send_activation_email' => 'users#send_activation_email', constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
resources :uploads
|
|
|
|
|
|
|
|
|
|
|
|
get 'posts/by_number/:topic_id/:post_number' => 'posts#by_number'
|
|
|
|
resources :posts do
|
|
|
|
get 'versions'
|
|
|
|
put 'bookmark'
|
|
|
|
get 'replies'
|
2013-02-07 15:12:55 -05:00
|
|
|
put 'recover'
|
2013-02-05 14:16:51 -05:00
|
|
|
collection do
|
|
|
|
delete 'destroy_many'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :notifications
|
|
|
|
resources :categories
|
2013-02-12 01:51:44 -05:00
|
|
|
|
2013-02-12 08:47:22 -05:00
|
|
|
match "/auth/:provider/callback", to: "users/omniauth_callbacks#complete"
|
2013-02-14 14:11:13 -05:00
|
|
|
match "/auth/failure", to: "users/omniauth_callbacks#failure"
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
resources :clicks do
|
|
|
|
collection do
|
2013-02-24 09:01:58 -05:00
|
|
|
get 'track'
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
get 'excerpt' => 'excerpt#show'
|
|
|
|
|
|
|
|
resources :post_actions do
|
|
|
|
collection do
|
2013-02-24 09:01:58 -05:00
|
|
|
get 'users'
|
|
|
|
post 'clear_flags'
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
resources :user_actions
|
2013-02-14 12:10:53 -05:00
|
|
|
resources :education
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-27 22:36:12 -05:00
|
|
|
get 'category/:category.rss' => 'list#category_feed', format: :rss, as: 'category_feed'
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'category/:category' => 'list#category'
|
2013-02-27 22:36:12 -05:00
|
|
|
get 'category/:category' => 'list#category', as: 'category'
|
|
|
|
get 'category/:category/more' => 'list#category', as: 'category'
|
|
|
|
get 'categories' => 'categories#index'
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'popular' => 'list#index'
|
|
|
|
get 'popular/more' => 'list#index'
|
|
|
|
get 'favorited' => 'list#favorited'
|
|
|
|
get 'favorited/more' => 'list#favorited'
|
|
|
|
get 'read' => 'list#read'
|
|
|
|
get 'read/more' => 'list#read'
|
|
|
|
get 'unread' => 'list#unread'
|
|
|
|
get 'unread/more' => 'list#unread'
|
|
|
|
get 'new' => 'list#new'
|
|
|
|
get 'new/more' => 'list#new'
|
|
|
|
get 'posted' => 'list#posted'
|
|
|
|
get 'posted/more' => 'list#posted'
|
|
|
|
|
|
|
|
get 'search' => 'search#query'
|
|
|
|
|
|
|
|
# Topics resource
|
|
|
|
get 't/:id' => 'topics#show'
|
|
|
|
delete 't/:id' => 'topics#destroy'
|
|
|
|
put 't/:id' => 'topics#update'
|
2013-02-14 14:11:13 -05:00
|
|
|
post 't' => 'topics#create'
|
2013-03-14 14:45:29 -04:00
|
|
|
post 'topics/timings'
|
|
|
|
get 'topics/similar_to'
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
# Legacy route for old avatars
|
2013-03-23 11:02:59 -04:00
|
|
|
get 'threads/:topic_id/:post_number/avatar' => 'topics#avatar', constraints: {topic_id: /\d+/, post_number: /\d+/}
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-14 14:11:13 -05:00
|
|
|
# Topic routes
|
2013-03-23 11:02:59 -04:00
|
|
|
get 't/:slug/:topic_id/best_of' => 'topics#show', defaults: {best_of: true}, constraints: {topic_id: /\d+/, post_number: /\d+/}
|
|
|
|
get 't/:topic_id/best_of' => 'topics#show', constraints: {topic_id: /\d+/, post_number: /\d+/}
|
|
|
|
put 't/:slug/:topic_id' => 'topics#update', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:slug/:topic_id/star' => 'topics#star', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:topic_id/star' => 'topics#star', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:slug/:topic_id/status' => 'topics#status', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:topic_id/status' => 'topics#status', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:topic_id/clear-pin' => 'topics#clear_pin', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:topic_id/mute' => 'topics#mute', constraints: {topic_id: /\d+/}
|
|
|
|
put 't/:topic_id/unmute' => 'topics#unmute', constraints: {topic_id: /\d+/}
|
|
|
|
|
|
|
|
get 't/:topic_id/:post_number' => 'topics#show', constraints: {topic_id: /\d+/, post_number: /\d+/}
|
|
|
|
get 't/:slug/:topic_id.rss' => 'topics#feed', format: :rss, constraints: {topic_id: /\d+/}
|
|
|
|
get 't/:slug/:topic_id' => 'topics#show', constraints: {topic_id: /\d+/}
|
|
|
|
get 't/:slug/:topic_id/:post_number' => 'topics#show', constraints: {topic_id: /\d+/, post_number: /\d+/}
|
|
|
|
post 't/:topic_id/timings' => 'topics#timings', constraints: {topic_id: /\d+/}
|
|
|
|
post 't/:topic_id/invite' => 'topics#invite', constraints: {topic_id: /\d+/}
|
|
|
|
post 't/:topic_id/move-posts' => 'topics#move_posts', constraints: {topic_id: /\d+/}
|
|
|
|
delete 't/:topic_id/timings' => 'topics#destroy_timings', constraints: {topic_id: /\d+/}
|
|
|
|
|
|
|
|
post 't/:topic_id/notifications' => 'topics#set_notifications' , constraints: {topic_id: /\d+/}
|
2013-02-14 14:11:13 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
resources :invites
|
|
|
|
delete 'invites' => 'invites#destroy'
|
2013-02-14 14:11:13 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
get 'request_access' => 'request_access#new'
|
|
|
|
post 'request_access' => 'request_access#create'
|
|
|
|
|
|
|
|
get 'onebox' => 'onebox#show'
|
|
|
|
|
|
|
|
get 'error' => 'forums#error'
|
|
|
|
|
|
|
|
get 'message-bus/poll' => 'message_bus#poll'
|
|
|
|
|
|
|
|
get 'draft' => 'draft#show'
|
|
|
|
post 'draft' => 'draft#update'
|
|
|
|
delete 'draft' => 'draft#destroy'
|
|
|
|
|
2013-02-10 19:02:57 -05:00
|
|
|
|
|
|
|
get 'robots.txt' => 'robots_txt#index'
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
# You can have the root of your site routed with "root"
|
|
|
|
# just remember to delete public/index.html.
|
2013-02-24 09:01:58 -05:00
|
|
|
root to: 'list#index'
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
end
|