2013-12-24 07:50:36 +08:00
|
|
|
require "sidekiq/web"
|
2014-02-06 07:14:41 +08:00
|
|
|
require_dependency "scheduler/web"
|
2013-12-24 07:50:36 +08:00
|
|
|
require_dependency "admin_constraint"
|
|
|
|
require_dependency "staff_constraint"
|
|
|
|
require_dependency "homepage_constraint"
|
2014-08-29 23:28:16 +08:00
|
|
|
require_dependency "permalink_constraint"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
# This used to be User#username_format, but that causes a preload of the User object
|
2013-02-15 03:11:13 +08:00
|
|
|
# and makes Guard not work properly.
|
2016-03-04 01:52:32 +08:00
|
|
|
USERNAME_ROUTE_FORMAT = /[\w.\-]+/ unless defined? USERNAME_ROUTE_FORMAT
|
2015-09-02 12:57:26 +08:00
|
|
|
|
2016-04-04 23:24:02 +08:00
|
|
|
BACKUP_ROUTE_FORMAT = /.+\.(tar\.gz|tgz)/i unless defined? BACKUP_ROUTE_FORMAT
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
Discourse::Application.routes.draw do
|
|
|
|
|
2013-07-02 02:00:06 +08:00
|
|
|
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
2014-04-30 03:17:40 +08:00
|
|
|
get "/404-body" => "exceptions#not_found_body"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2016-06-07 01:47:45 +08:00
|
|
|
post "webhooks/mailgun" => "webhooks#mailgun"
|
2016-06-02 03:48:06 +08:00
|
|
|
post "webhooks/sendgrid" => "webhooks#sendgrid"
|
2016-06-07 01:47:45 +08:00
|
|
|
post "webhooks/mailjet" => "webhooks#mailjet"
|
2016-06-13 18:31:01 +08:00
|
|
|
post "webhooks/mandrill" => "webhooks#mandrill"
|
2016-05-30 23:11:17 +08:00
|
|
|
|
2014-08-18 14:42:48 +08:00
|
|
|
if Rails.env.development?
|
2014-05-24 20:50:39 +08:00
|
|
|
mount Sidekiq::Web => "/sidekiq"
|
|
|
|
mount Logster::Web => "/logs"
|
|
|
|
else
|
2016-03-16 21:26:07 +08:00
|
|
|
# only allow sidekie in master site
|
|
|
|
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new(require_master: true)
|
2014-05-24 20:50:39 +08:00
|
|
|
mount Logster::Web => "/logs", constraints: AdminConstraint.new
|
2014-05-07 06:23:52 +08:00
|
|
|
end
|
|
|
|
|
2015-08-28 05:28:33 +08:00
|
|
|
resources :about do
|
|
|
|
collection do
|
|
|
|
get "live_post_counts"
|
|
|
|
end
|
|
|
|
end
|
2014-08-12 04:59:00 +08:00
|
|
|
|
2015-03-17 03:14:33 +08:00
|
|
|
resources :directory_items
|
|
|
|
|
2015-03-05 12:49:03 +08:00
|
|
|
get "site" => "site#site"
|
|
|
|
namespace :site do
|
|
|
|
get "settings"
|
|
|
|
get "custom_html"
|
|
|
|
get "banner"
|
|
|
|
get "emoji"
|
|
|
|
end
|
2014-12-23 09:46:10 +08:00
|
|
|
get "site_customizations/:key" => "site_customizations#show"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-06-26 03:05:16 +08:00
|
|
|
resources :forums
|
2013-12-24 07:50:36 +08:00
|
|
|
get "srv/status" => "forums#status"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-05-02 15:22:27 +08:00
|
|
|
namespace :admin, constraints: StaffConstraint.new do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "" => "admin#index"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2015-02-07 06:32:59 +08:00
|
|
|
get 'plugins' => 'plugins#index'
|
|
|
|
|
2013-11-14 03:02:47 +08:00
|
|
|
resources :site_settings, constraints: AdminConstraint.new do
|
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "category/:id" => "site_settings#index"
|
2013-11-14 03:02:47 +08:00
|
|
|
end
|
|
|
|
end
|
2013-05-02 13:15:17 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "reports/:type" => "reports#show"
|
2013-02-28 11:39:42 +08:00
|
|
|
|
2013-05-08 13:20:38 +08:00
|
|
|
resources :groups, constraints: AdminConstraint.new do
|
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
post "refresh_automatic_groups" => "groups#refresh_automatic_groups"
|
2015-10-27 03:56:59 +08:00
|
|
|
get 'bulk'
|
|
|
|
get 'bulk-complete' => 'groups#bulk'
|
|
|
|
put 'bulk' => 'groups#bulk_perform'
|
2013-05-08 13:20:38 +08:00
|
|
|
end
|
2015-01-22 03:52:48 +08:00
|
|
|
member do
|
2015-11-09 21:52:04 +08:00
|
|
|
put "owners" => "groups#add_owners"
|
|
|
|
delete "owners" => "groups#remove_owner"
|
2015-01-22 03:52:48 +08:00
|
|
|
end
|
2013-05-08 13:20:38 +08:00
|
|
|
end
|
|
|
|
|
2015-01-22 03:52:48 +08:00
|
|
|
get "groups/:type" => "groups#show", constraints: AdminConstraint.new
|
|
|
|
get "groups/:type/:id" => "groups#show", constraints: AdminConstraint.new
|
|
|
|
|
2015-09-26 21:56:36 +08:00
|
|
|
resources :users, id: USERNAME_ROUTE_FORMAT, except: [:show] do
|
2013-02-06 03:16:51 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "list/:query" => "users#index"
|
2014-07-08 04:18:18 +08:00
|
|
|
get "ip-info" => "users#ip_info"
|
2014-11-21 02:59:20 +08:00
|
|
|
delete "delete-others-with-same-ip" => "users#delete_other_accounts_with_same_ip"
|
2014-11-25 02:34:04 +08:00
|
|
|
get "total-others-with-same-ip" => "users#total_other_accounts_with_same_ip"
|
2013-12-24 07:50:36 +08:00
|
|
|
put "approve-bulk" => "users#approve_bulk"
|
|
|
|
delete "reject-bulk" => "users#reject_bulk"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2013-12-24 07:50:36 +08:00
|
|
|
put "suspend"
|
|
|
|
put "delete_all_posts"
|
|
|
|
put "unsuspend"
|
|
|
|
put "revoke_admin", constraints: AdminConstraint.new
|
|
|
|
put "grant_admin", constraints: AdminConstraint.new
|
|
|
|
post "generate_api_key", constraints: AdminConstraint.new
|
|
|
|
delete "revoke_api_key", constraints: AdminConstraint.new
|
|
|
|
put "revoke_moderation", constraints: AdminConstraint.new
|
|
|
|
put "grant_moderation", constraints: AdminConstraint.new
|
|
|
|
put "approve"
|
|
|
|
post "refresh_browsers", constraints: AdminConstraint.new
|
2014-06-06 11:02:52 +08:00
|
|
|
post "log_out", constraints: AdminConstraint.new
|
2013-12-24 07:50:36 +08:00
|
|
|
put "activate"
|
|
|
|
put "deactivate"
|
|
|
|
put "block"
|
|
|
|
put "unblock"
|
|
|
|
put "trust_level"
|
2014-09-14 04:55:26 +08:00
|
|
|
put "trust_level_lock"
|
2014-02-11 05:59:36 +08:00
|
|
|
put "primary_group"
|
2014-07-14 02:11:38 +08:00
|
|
|
post "groups" => "users#add_group", constraints: AdminConstraint.new
|
|
|
|
delete "groups/:group_id" => "users#remove_group", constraints: AdminConstraint.new
|
2014-03-19 22:27:21 +08:00
|
|
|
get "badges"
|
2014-09-25 08:19:26 +08:00
|
|
|
get "leader_requirements" => "users#tl3_requirements"
|
|
|
|
get "tl3_requirements"
|
2015-03-07 05:44:54 +08:00
|
|
|
put "anonymize"
|
2016-05-07 01:34:33 +08:00
|
|
|
post "reset_bounce_score"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2015-09-26 21:56:36 +08:00
|
|
|
get "users/:id.json" => 'users#show', defaults: {format: 'json'}
|
2016-06-09 15:52:42 +08:00
|
|
|
get 'users/:id/:username' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
|
2016-03-29 04:58:45 +08:00
|
|
|
get 'users/:id/:username/badges' => 'users#show'
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-10-28 08:25:02 +08:00
|
|
|
|
|
|
|
post "users/sync_sso" => "users#sync_sso", constraints: AdminConstraint.new
|
2014-11-24 12:42:39 +08:00
|
|
|
post "users/invite_admin" => "users#invite_admin", constraints: AdminConstraint.new
|
2014-10-28 08:25:02 +08:00
|
|
|
|
2013-05-02 13:15:17 +08:00
|
|
|
resources :impersonate, constraints: AdminConstraint.new
|
2013-06-04 04:12:24 +08:00
|
|
|
|
2015-09-30 00:37:46 +08:00
|
|
|
resources :email, constraints: AdminConstraint.new do
|
2013-02-06 03:16:51 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
post "test"
|
2014-02-15 07:50:08 +08:00
|
|
|
get "sent"
|
2014-02-15 02:06:21 +08:00
|
|
|
get "skipped"
|
2016-05-03 05:15:32 +08:00
|
|
|
get "bounced"
|
2016-01-19 07:57:55 +08:00
|
|
|
get "received"
|
|
|
|
get "rejected"
|
2016-02-02 04:41:49 +08:00
|
|
|
get "/incoming/:id/raw" => "email#raw_email"
|
2016-02-11 05:00:27 +08:00
|
|
|
get "/incoming/:id" => "email#incoming"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "preview-digest" => "email#preview_digest"
|
2015-10-19 05:33:24 +08:00
|
|
|
post "handle_mail"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
end
|
2013-06-04 04:12:24 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
scope "/logs" do
|
2013-10-22 02:49:51 +08:00
|
|
|
resources :staff_action_logs, only: [:index]
|
2014-06-02 14:52:43 +08:00
|
|
|
resources :screened_emails, only: [:index, :destroy]
|
2014-11-25 00:25:48 +08:00
|
|
|
resources :screened_ip_addresses, only: [:index, :create, :update, :destroy] do
|
|
|
|
collection do
|
|
|
|
post "roll_up"
|
|
|
|
end
|
|
|
|
end
|
2013-10-22 02:49:51 +08:00
|
|
|
resources :screened_urls, only: [:index]
|
2013-08-02 09:30:13 +08:00
|
|
|
end
|
|
|
|
|
2014-07-14 11:21:29 +08:00
|
|
|
get "/logs" => "staff_action_logs#index"
|
|
|
|
|
2014-04-16 21:49:06 +08:00
|
|
|
get "customize" => "color_schemes#index", constraints: AdminConstraint.new
|
|
|
|
get "customize/css_html" => "site_customizations#index", constraints: AdminConstraint.new
|
2015-08-07 00:43:56 +08:00
|
|
|
get "customize/css_html/:id/:section" => "site_customizations#index", constraints: AdminConstraint.new
|
2014-04-16 21:49:06 +08:00
|
|
|
get "customize/colors" => "color_schemes#index", constraints: AdminConstraint.new
|
2015-07-15 20:54:28 +08:00
|
|
|
get "customize/permalinks" => "permalinks#index", constraints: AdminConstraint.new
|
2015-08-19 05:15:46 +08:00
|
|
|
get "customize/embedding" => "embedding#show", constraints: AdminConstraint.new
|
|
|
|
put "customize/embedding" => "embedding#update", constraints: AdminConstraint.new
|
2013-12-24 07:50:36 +08:00
|
|
|
get "flags" => "flags#index"
|
|
|
|
get "flags/:filter" => "flags#index"
|
|
|
|
post "flags/agree/:id" => "flags#agree"
|
|
|
|
post "flags/disagree/:id" => "flags#disagree"
|
|
|
|
post "flags/defer/:id" => "flags#defer"
|
2013-05-02 13:15:17 +08:00
|
|
|
resources :site_customizations, constraints: AdminConstraint.new
|
2014-09-24 05:12:01 +08:00
|
|
|
scope "/customize" do
|
2014-09-25 23:32:08 +08:00
|
|
|
resources :user_fields, constraints: AdminConstraint.new
|
2014-12-23 08:12:26 +08:00
|
|
|
resources :emojis, constraints: AdminConstraint.new
|
2015-11-13 05:08:19 +08:00
|
|
|
|
|
|
|
# They have periods in their URLs often:
|
2016-04-07 03:57:54 +08:00
|
|
|
get 'site_texts' => 'site_texts#index'
|
|
|
|
get 'site_texts/(:id)' => 'site_texts#show', constraints: { id: /[\w.\-]+/i }
|
|
|
|
put 'site_texts/(:id)' => 'site_texts#update', constraints: { id: /[\w.\-]+/i }
|
|
|
|
delete 'site_texts/(:id)' => 'site_texts#revert', constraints: { id: /[\w.\-]+/i }
|
|
|
|
|
|
|
|
get 'email_templates' => 'email_templates#index'
|
|
|
|
get 'email_templates/(:id)' => 'email_templates#show', constraints: { id: /[0-9a-z_.]+/ }
|
|
|
|
put 'email_templates/(:id)' => 'email_templates#update', constraints: { id: /[0-9a-z_.]+/ }
|
|
|
|
delete 'email_templates/(:id)' => 'email_templates#revert', constraints: { id: /[0-9a-z_.]+/ }
|
2014-09-24 05:12:01 +08:00
|
|
|
end
|
|
|
|
|
2015-08-19 05:15:46 +08:00
|
|
|
resources :embeddable_hosts, constraints: AdminConstraint.new
|
2014-04-16 21:49:06 +08:00
|
|
|
resources :color_schemes, constraints: AdminConstraint.new
|
2014-02-13 12:33:40 +08:00
|
|
|
|
2015-07-15 20:54:28 +08:00
|
|
|
resources :permalinks, constraints: AdminConstraint.new
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "version_check" => "versions#show"
|
2014-02-13 12:33:40 +08:00
|
|
|
|
2013-03-30 03:48:26 +08:00
|
|
|
resources :dashboard, only: [:index] do
|
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "problems"
|
2013-03-30 03:48:26 +08:00
|
|
|
end
|
|
|
|
end
|
2014-02-13 12:33:40 +08:00
|
|
|
|
2013-05-02 13:15:17 +08:00
|
|
|
resources :api, only: [:index], constraints: AdminConstraint.new do
|
2013-03-26 09:04:28 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
post "key" => "api#create_master_key"
|
|
|
|
put "key" => "api#regenerate_key"
|
|
|
|
delete "key" => "api#revoke_key"
|
2013-03-26 09:04:28 +08:00
|
|
|
end
|
|
|
|
end
|
2014-02-13 12:33:40 +08:00
|
|
|
|
|
|
|
resources :backups, only: [:index, :create], constraints: AdminConstraint.new do
|
|
|
|
member do
|
|
|
|
get "" => "backups#show", constraints: { id: BACKUP_ROUTE_FORMAT }
|
|
|
|
delete "" => "backups#destroy", constraints: { id: BACKUP_ROUTE_FORMAT }
|
|
|
|
post "restore" => "backups#restore", constraints: { id: BACKUP_ROUTE_FORMAT }
|
|
|
|
end
|
|
|
|
collection do
|
|
|
|
get "logs" => "backups#logs"
|
|
|
|
get "status" => "backups#status"
|
|
|
|
get "cancel" => "backups#cancel"
|
|
|
|
get "rollback" => "backups#rollback"
|
|
|
|
put "readonly" => "backups#readonly"
|
2014-05-28 04:14:37 +08:00
|
|
|
get "upload" => "backups#check_backup_chunk"
|
|
|
|
post "upload" => "backups#upload_backup_chunk"
|
2014-02-13 12:33:40 +08:00
|
|
|
end
|
|
|
|
end
|
2014-02-15 07:50:08 +08:00
|
|
|
|
2014-03-05 20:52:20 +08:00
|
|
|
resources :badges, constraints: AdminConstraint.new do
|
|
|
|
collection do
|
|
|
|
get "types" => "badges#badge_types"
|
2014-07-27 16:22:01 +08:00
|
|
|
post "badge_groupings" => "badges#save_badge_groupings"
|
2014-07-24 16:28:09 +08:00
|
|
|
post "preview" => "badges#preview"
|
2014-03-05 20:52:20 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-02-14 12:43:08 +08:00
|
|
|
get "memory_stats"=> "diagnostics#memory_stats", constraints: AdminConstraint.new
|
2014-12-08 06:54:35 +08:00
|
|
|
get "dump_heap"=> "diagnostics#dump_heap", constraints: AdminConstraint.new
|
2015-10-19 11:02:22 +08:00
|
|
|
get "dump_statement_cache"=> "diagnostics#dump_statement_cache", constraints: AdminConstraint.new
|
2014-02-13 12:33:40 +08:00
|
|
|
|
2013-11-12 13:42:35 +08:00
|
|
|
end # admin namespace
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "email_preferences" => "email#preferences_redirect", :as => "email_preferences_redirect"
|
2016-06-17 09:27:52 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "email/unsubscribe/:key" => "email#unsubscribe", as: "email_unsubscribe"
|
2016-06-17 09:27:52 +08:00
|
|
|
get "email/unsubscribed" => "email#unsubscribed", as: "email_unsubscribed"
|
|
|
|
post "email/unsubscribe/:key" => "email#perform_unsubscribe", as: "email_perform_unsubscribe"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-10-08 00:25:25 +08:00
|
|
|
resources :session, id: USERNAME_ROUTE_FORMAT, only: [:create, :destroy, :become] do
|
|
|
|
get 'become'
|
2013-02-15 03:11:13 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
post "forgot_password"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2013-02-15 03:11:13 +08:00
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-02-25 11:30:49 +08:00
|
|
|
get "session/sso" => "session#sso"
|
|
|
|
get "session/sso_login" => "session#sso_login"
|
2014-11-26 14:25:54 +08:00
|
|
|
get "session/sso_provider" => "session#sso_provider"
|
2014-02-06 02:46:24 +08:00
|
|
|
get "session/current" => "session#current"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "session/csrf" => "session#csrf"
|
2016-06-07 01:52:24 +08:00
|
|
|
get "composer_messages" => "composer_messages#index"
|
2013-07-29 13:13:13 +08:00
|
|
|
|
2014-02-14 00:42:35 +08:00
|
|
|
resources :users, except: [:show, :update, :destroy] do
|
2013-02-15 03:11:13 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "check_username"
|
|
|
|
get "is_local_username"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :static
|
2016-03-25 01:21:57 +08:00
|
|
|
post "login" => "static#enter", constraints: { format: /(json|html)/ }
|
|
|
|
get "login" => "static#show", id: "login", constraints: { format: /(json|html)/ }
|
|
|
|
get "password-reset" => "static#show", id: "password_reset", constraints: { format: /(json|html)/ }
|
|
|
|
get "faq" => "static#show", id: "faq", constraints: { format: /(json|html)/ }
|
|
|
|
get "guidelines" => "static#show", id: "guidelines", as: 'guidelines', constraints: { format: /(json|html)/ }
|
|
|
|
get "tos" => "static#show", id: "tos", as: 'tos', constraints: { format: /(json|html)/ }
|
|
|
|
get "privacy" => "static#show", id: "privacy", as: 'privacy', constraints: { format: /(json|html)/ }
|
|
|
|
get "signup" => "static#show", id: "signup", constraints: { format: /(json|html)/ }
|
|
|
|
get "login-preferences" => "static#show", id: "login", constraints: { format: /(json|html)/ }
|
2013-12-24 07:50:36 +08:00
|
|
|
|
2015-04-27 18:59:48 +08:00
|
|
|
get "users/admin-login" => "users#admin_login"
|
|
|
|
put "users/admin-login" => "users#admin_login"
|
|
|
|
get "users/admin-login/:token" => "users#admin_login"
|
|
|
|
|
2015-04-07 16:02:10 +08:00
|
|
|
post "users/toggle-anon" => "users#toggle_anon"
|
2014-07-11 15:32:29 +08:00
|
|
|
post "users/read-faq" => "users#read_faq"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/search/users" => "users#search_users"
|
2014-10-01 22:30:26 +08:00
|
|
|
get "users/account-created/" => "users#account_created"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/password-reset/:token" => "users#password_reset"
|
2016-01-05 00:48:54 +08:00
|
|
|
get "users/confirm-email-token/:token" => "users#confirm_email_token", constraints: { format: 'json' }
|
2013-12-24 07:50:36 +08:00
|
|
|
put "users/password-reset/:token" => "users#password_reset"
|
|
|
|
get "users/activate-account/:token" => "users#activate_account"
|
2014-07-15 00:25:42 +08:00
|
|
|
put "users/activate-account/:token" => "users#perform_account_activation", as: 'perform_activate_account'
|
2016-03-08 03:40:11 +08:00
|
|
|
get "users/authorize-email/:token" => "users_email#confirm"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/hp" => "users#get_honeypot_value"
|
2014-06-15 01:51:06 +08:00
|
|
|
get "my/*path", to: 'users#my_redirect'
|
2013-12-24 07:50:36 +08:00
|
|
|
|
|
|
|
get "user_preferences" => "users#user_preferences_redirect"
|
|
|
|
get "users/:username/private-messages" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "users/:username/private-messages/:filter" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-04-18 00:01:50 +08:00
|
|
|
get "users/:username/messages" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "users/:username/messages/:filter" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-12-10 08:39:33 +08:00
|
|
|
get "users/:username/messages/group/:group_name" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT, group_name: USERNAME_ROUTE_FORMAT}
|
2015-12-23 08:09:17 +08:00
|
|
|
|
|
|
|
get "users/:username/messages/group/:group_name/archive" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT, group_name: USERNAME_ROUTE_FORMAT}
|
|
|
|
|
2015-09-02 12:57:26 +08:00
|
|
|
get "users/:username.json" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}, defaults: {format: :json}
|
2014-06-05 04:51:48 +08:00
|
|
|
get "users/:username" => "users#show", as: 'user', constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
put "users/:username" => "users#update", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-09-30 04:31:05 +08:00
|
|
|
put "users/:username/emails" => "users#check_emails", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/:username/preferences" => "users#preferences", constraints: {username: USERNAME_ROUTE_FORMAT}, as: :email_preferences
|
2016-03-08 02:45:33 +08:00
|
|
|
get "users/:username/preferences/email" => "users_email#index", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put "users/:username/preferences/email" => "users_email#update", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/:username/preferences/about-me" => "users#preferences", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-04-18 11:10:53 +08:00
|
|
|
get "users/:username/preferences/badge_title" => "users#preferences", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put "users/:username/preferences/badge_title" => "users#badge_title", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/:username/preferences/username" => "users#preferences", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put "users/:username/preferences/username" => "users#username", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-06-28 02:48:39 +08:00
|
|
|
delete "users/:username/preferences/user_image" => "users#destroy_user_image", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-05-26 17:46:43 +08:00
|
|
|
put "users/:username/preferences/avatar/pick" => "users#pick_avatar", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-10-21 01:15:58 +08:00
|
|
|
get "users/:username/preferences/card-badge" => "users#card_badge", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
put "users/:username/preferences/card-badge" => "users#update_card_badge", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-01-06 02:49:32 +08:00
|
|
|
get "users/:username/staff-info" => "users#staff_info", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-10-21 01:15:58 +08:00
|
|
|
|
2016-01-20 12:11:52 +08:00
|
|
|
get "users/:username/summary" => "users#summary", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/:username/invited" => "users#invited", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-08-25 03:03:25 +08:00
|
|
|
get "users/:username/invited_count" => "users#invited_count", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-07-11 20:09:12 +08:00
|
|
|
get "users/:username/invited/:filter" => "users#invited", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-09-25 15:42:48 +08:00
|
|
|
post "users/action/send_activation_email" => "users#send_activation_email"
|
2016-01-20 12:11:52 +08:00
|
|
|
get "users/:username/summary" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2016-03-31 21:10:50 +08:00
|
|
|
|
|
|
|
# user activity RSS feed
|
|
|
|
get "users/:username/activity/topics.rss" => "list#user_topics_feed", format: :rss, constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "users/:username/activity.rss" => "posts#user_posts_feed", format: :rss, constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users/:username/activity" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "users/:username/activity/:filter" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-04-17 02:49:28 +08:00
|
|
|
get "users/:username/badges" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-09-03 09:32:27 +08:00
|
|
|
get "users/:username/notifications" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-12-17 15:06:04 +08:00
|
|
|
get "users/:username/notifications/:filter" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2016-01-12 12:48:44 +08:00
|
|
|
get "users/:username/activity/pending" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2014-02-14 00:42:35 +08:00
|
|
|
delete "users/:username" => "users#destroy", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-02-03 01:55:32 +08:00
|
|
|
# The external_id constraint is to allow periods to be used in the value without becoming part of the format. ie: foo.bar.json
|
|
|
|
get "users/by-external/:external_id" => "users#show", constraints: {external_id: /[^\/]+/}
|
2014-07-17 03:04:55 +08:00
|
|
|
get "users/:username/flagged-posts" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "users/:username/deleted-posts" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-09-02 12:57:26 +08:00
|
|
|
get "user-badges/:username.json" => "user_badges#username", constraints: {username: USERNAME_ROUTE_FORMAT}, defaults: {format: :json}
|
|
|
|
get "user-badges/:username" => "user_badges#username", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
|
2015-09-02 12:57:26 +08:00
|
|
|
post "user_avatar/:username/refresh_gravatar" => "user_avatars#refresh_gravatar", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "letter_avatar/:username/:size/:version.png" => "user_avatars#show_letter", format: false, constraints: { hostname: /[\w\.-]+/, size: /\d+/, username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "user_avatar/:hostname/:username/:size/:version.png" => "user_avatars#show", format: false, constraints: { hostname: /[\w\.-]+/, size: /\d+/, username: USERNAME_ROUTE_FORMAT }
|
2014-05-26 17:46:43 +08:00
|
|
|
|
2015-11-25 11:42:46 +08:00
|
|
|
# in most production settings this is bypassed
|
|
|
|
get "letter_avatar_proxy/:version/letter/:letter/:color/:size.png" => "user_avatars#show_proxy_letter"
|
|
|
|
|
2015-03-13 13:15:13 +08:00
|
|
|
get "highlight-js/:hostname/:version.js" => "highlight_js#show", format: false, constraints: { hostname: /[\w\.-]+/ }
|
|
|
|
|
2015-05-20 06:04:03 +08:00
|
|
|
get "stylesheets/:name.css" => "stylesheets#show", constraints: { name: /[a-z0-9_]+/ }
|
2015-05-05 13:50:13 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
post "uploads" => "uploads#create"
|
|
|
|
|
2015-05-20 06:04:03 +08:00
|
|
|
# used to download original images
|
|
|
|
get "uploads/:site/:sha" => "uploads#show", constraints: { site: /\w+/, sha: /[a-f0-9]{40}/ }
|
2015-12-25 04:22:14 +08:00
|
|
|
# used to download attachments
|
2015-06-01 06:03:41 +08:00
|
|
|
get "uploads/:site/original/:tree:sha" => "uploads#show", constraints: { site: /\w+/, tree: /(\w+\/)+/i, sha: /[a-f0-9]{40}/ }
|
2015-05-20 20:55:42 +08:00
|
|
|
# used to download attachments (old route)
|
2015-06-01 06:03:41 +08:00
|
|
|
get "uploads/:site/:id/:sha" => "uploads#show", constraints: { site: /\w+/, id: /\d+/, sha: /[a-f0-9]{16}/ }
|
2015-05-20 06:04:03 +08:00
|
|
|
|
2016-03-21 18:22:36 +08:00
|
|
|
get "posts" => "posts#latest", id: "latest_posts"
|
|
|
|
get "private-posts" => "posts#latest", id: "private_posts"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "posts/by_number/:topic_id/:post_number" => "posts#by_number"
|
|
|
|
get "posts/:id/reply-history" => "posts#reply_history"
|
2014-07-17 03:04:55 +08:00
|
|
|
get "posts/:username/deleted" => "posts#deleted_posts", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "posts/:username/flagged" => "posts#flagged_posts", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
|
2014-02-07 02:06:19 +08:00
|
|
|
resources :groups do
|
2016-03-19 00:19:45 +08:00
|
|
|
get "posts.rss" => "groups#posts_feed", format: :rss
|
|
|
|
get "mentions.rss" => "groups#mentions_feed", format: :rss
|
|
|
|
|
2014-02-07 02:06:19 +08:00
|
|
|
get 'members'
|
2014-02-07 23:44:03 +08:00
|
|
|
get 'posts'
|
2015-12-01 13:52:43 +08:00
|
|
|
get 'topics'
|
|
|
|
get 'mentions'
|
2015-12-08 06:19:33 +08:00
|
|
|
get 'messages'
|
2014-02-19 05:17:04 +08:00
|
|
|
get 'counts'
|
2015-01-09 07:35:52 +08:00
|
|
|
|
2015-11-09 21:52:04 +08:00
|
|
|
member do
|
|
|
|
put "members" => "groups#add_members"
|
|
|
|
delete "members" => "groups#remove_member"
|
2015-12-15 06:17:09 +08:00
|
|
|
post "notifications" => "groups#set_notifications"
|
2015-11-09 21:52:04 +08:00
|
|
|
end
|
2014-02-07 02:06:19 +08:00
|
|
|
end
|
2014-01-31 06:10:36 +08:00
|
|
|
|
2015-11-09 21:52:04 +08:00
|
|
|
# aliases so old API code works
|
|
|
|
delete "admin/groups/:id/members" => "groups#remove_member", constraints: AdminConstraint.new
|
|
|
|
put "admin/groups/:id/members" => "groups#add_members", constraints: AdminConstraint.new
|
|
|
|
|
2014-10-15 03:10:51 +08:00
|
|
|
# In case people try the wrong URL
|
|
|
|
get '/group/:id', to: redirect('/groups/%{id}')
|
|
|
|
get '/group/:id/members', to: redirect('/groups/%{id}/members')
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
resources :posts do
|
2013-12-24 07:50:36 +08:00
|
|
|
put "bookmark"
|
2014-05-13 20:53:11 +08:00
|
|
|
put "wiki"
|
2014-09-11 05:08:33 +08:00
|
|
|
put "post_type"
|
2014-09-11 22:04:40 +08:00
|
|
|
put "rebake"
|
2014-09-23 00:55:13 +08:00
|
|
|
put "unhide"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "replies"
|
2014-10-28 05:06:43 +08:00
|
|
|
get "revisions/latest" => "posts#latest_revision"
|
|
|
|
get "revisions/:revision" => "posts#revisions", constraints: { revision: /\d+/ }
|
|
|
|
put "revisions/:revision/hide" => "posts#hide_revision", constraints: { revision: /\d+/ }
|
|
|
|
put "revisions/:revision/show" => "posts#show_revision", constraints: { revision: /\d+/ }
|
2016-03-09 23:40:49 +08:00
|
|
|
put "revisions/:revision/revert" => "posts#revert", constraints: { revision: /\d+/ }
|
2013-12-24 07:50:36 +08:00
|
|
|
put "recover"
|
2013-02-06 03:16:51 +08:00
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
delete "destroy_many"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-05-06 01:44:19 +08:00
|
|
|
get 'notifications' => 'notifications#index'
|
|
|
|
put 'notifications/mark-read' => 'notifications#mark_read'
|
2013-02-12 14:51:44 +08:00
|
|
|
|
2013-07-02 02:00:06 +08:00
|
|
|
match "/auth/:provider/callback", to: "users/omniauth_callbacks#complete", via: [:get, :post]
|
|
|
|
match "/auth/failure", to: "users/omniauth_callbacks#failure", via: [:get, :post]
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
resources :clicks do
|
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "track"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "excerpt" => "excerpt#show"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2015-10-01 00:28:13 +08:00
|
|
|
resources :post_action_users
|
2013-02-06 03:16:51 +08:00
|
|
|
resources :post_actions do
|
|
|
|
collection do
|
2013-12-24 07:50:36 +08:00
|
|
|
get "users"
|
2014-07-29 01:17:37 +08:00
|
|
|
post "defer_flags"
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
resources :user_actions
|
|
|
|
|
2014-04-16 21:12:06 +08:00
|
|
|
resources :badges, only: [:index]
|
2014-04-16 22:56:11 +08:00
|
|
|
get "/badges/:id(/:slug)" => "badges#show"
|
2014-03-05 20:52:20 +08:00
|
|
|
resources :user_badges, only: [:index, :create, :destroy]
|
|
|
|
|
2015-03-31 00:15:02 +08:00
|
|
|
|
|
|
|
get '/c', to: redirect('/categories')
|
|
|
|
|
2013-07-02 13:21:26 +08:00
|
|
|
resources :categories, :except => :show
|
2014-01-18 06:52:06 +08:00
|
|
|
post "category/:category_id/move" => "categories#move"
|
2015-08-28 01:14:59 +08:00
|
|
|
post "categories/reorder" => "categories#reorder"
|
2014-04-17 17:17:39 +08:00
|
|
|
post "category/:category_id/notifications" => "categories#set_notifications"
|
2014-12-20 22:07:29 +08:00
|
|
|
put "category/:category_id/slug" => "categories#update_slug"
|
2014-01-18 06:52:06 +08:00
|
|
|
|
2014-10-17 00:15:31 +08:00
|
|
|
get "c/:id/show" => "categories#show"
|
2016-03-15 00:38:29 +08:00
|
|
|
get "c/:category_slug/find_by_slug" => "categories#find_by_slug"
|
|
|
|
get "c/:parent_category_slug/:category_slug/find_by_slug" => "categories#find_by_slug"
|
2014-10-17 00:15:31 +08:00
|
|
|
get "c/:category.rss" => "list#category_feed", format: :rss
|
|
|
|
get "c/:parent_category/:category.rss" => "list#category_feed", format: :rss
|
|
|
|
get "c/:category" => "list#category_latest"
|
|
|
|
get "c/:category/none" => "list#category_none_latest"
|
2015-12-28 14:28:16 +08:00
|
|
|
get "c/:parent_category/:category/(:id)" => "list#parent_category_category_latest", constraints: { id: /\d+/ }
|
2014-10-17 00:15:31 +08:00
|
|
|
get "c/:category/l/top" => "list#category_top", as: "category_top"
|
|
|
|
get "c/:category/none/l/top" => "list#category_none_top", as: "category_none_top"
|
|
|
|
get "c/:parent_category/:category/l/top" => "list#parent_category_category_top", as: "parent_category_category_top"
|
|
|
|
|
2015-12-28 14:28:16 +08:00
|
|
|
get "category_hashtags/check" => "category_hashtags#check"
|
2014-01-14 08:02:14 +08:00
|
|
|
|
|
|
|
TopTopic.periods.each do |period|
|
|
|
|
get "top/#{period}" => "list#top_#{period}"
|
2014-10-17 00:15:31 +08:00
|
|
|
get "c/:category/l/top/#{period}" => "list#category_top_#{period}", as: "category_top_#{period}"
|
|
|
|
get "c/:category/none/l/top/#{period}" => "list#category_none_top_#{period}", as: "category_none_top_#{period}"
|
|
|
|
get "c/:parent_category/:category/l/top/#{period}" => "list#parent_category_category_top_#{period}", as: "parent_category_category_top_#{period}"
|
2013-07-06 04:49:06 +08:00
|
|
|
end
|
|
|
|
|
2014-10-16 11:52:21 +08:00
|
|
|
Discourse.anonymous_filters.each do |filter|
|
|
|
|
get "#{filter}.rss" => "list##{filter}_feed", format: :rss
|
|
|
|
end
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
Discourse.filters.each do |filter|
|
2015-09-11 02:46:37 +08:00
|
|
|
get "#{filter}" => "list##{filter}", constraints: { format: /(json|html)/ }
|
2014-10-17 00:15:31 +08:00
|
|
|
get "c/:category/l/#{filter}" => "list#category_#{filter}", as: "category_#{filter}"
|
|
|
|
get "c/:category/none/l/#{filter}" => "list#category_none_#{filter}", as: "category_none_#{filter}"
|
|
|
|
get "c/:parent_category/:category/l/#{filter}" => "list#parent_category_category_#{filter}", as: "parent_category_category_#{filter}"
|
2013-03-28 21:01:13 +08:00
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-10-17 00:15:31 +08:00
|
|
|
get "category/*path" => "categories#redirect"
|
|
|
|
|
|
|
|
get "top" => "list#top"
|
2015-04-04 04:55:32 +08:00
|
|
|
get "search/query" => "search#query"
|
2015-07-27 14:46:50 +08:00
|
|
|
get "search" => "search#show"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
# Topics resource
|
2013-12-24 07:50:36 +08:00
|
|
|
get "t/:id" => "topics#show"
|
|
|
|
post "t" => "topics#create"
|
2014-01-14 08:02:14 +08:00
|
|
|
put "t/:id" => "topics#update"
|
|
|
|
delete "t/:id" => "topics#destroy"
|
2015-12-30 10:26:21 +08:00
|
|
|
put "t/:id/archive-message" => "topics#archive_message"
|
|
|
|
put "t/:id/move-to-inbox" => "topics#move_to_inbox"
|
2016-05-01 19:48:43 +08:00
|
|
|
put "t/:id/convert-topic/:type" => "topics#convert_topic"
|
2014-01-30 04:48:52 +08:00
|
|
|
put "topics/bulk"
|
2014-03-04 04:46:38 +08:00
|
|
|
put "topics/reset-new" => 'topics#reset_new'
|
2013-12-24 07:50:36 +08:00
|
|
|
post "topics/timings"
|
2015-06-25 03:08:22 +08:00
|
|
|
|
|
|
|
get 'topics/similar_to' => 'similar_topics#index'
|
|
|
|
resources :similar_topics
|
|
|
|
|
2015-03-14 08:18:05 +08:00
|
|
|
get "topics/feature_stats"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "topics/created-by/:username" => "list#topics_by", as: "topics_by", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "topics/private-messages/:username" => "list#private_messages", as: "topics_private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
|
|
|
get "topics/private-messages-sent/:username" => "list#private_messages_sent", as: "topics_private_messages_sent", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-12-23 08:09:17 +08:00
|
|
|
get "topics/private-messages-archive/:username" => "list#private_messages_archive", as: "topics_private_messages_archive", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2013-12-24 07:50:36 +08:00
|
|
|
get "topics/private-messages-unread/:username" => "list#private_messages_unread", as: "topics_private_messages_unread", constraints: {username: USERNAME_ROUTE_FORMAT}
|
2015-12-10 08:39:33 +08:00
|
|
|
get "topics/private-messages-group/:username/:group_name.json" => "list#private_messages_group", as: "topics_private_messages_group", constraints: {
|
|
|
|
username: USERNAME_ROUTE_FORMAT,
|
|
|
|
group_name: USERNAME_ROUTE_FORMAT
|
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2015-12-23 08:09:17 +08:00
|
|
|
get "topics/private-messages-group/:username/:group_name/archive.json" => "list#private_messages_group_archive", as: "topics_private_messages_group_archive", constraints: {
|
|
|
|
username: USERNAME_ROUTE_FORMAT,
|
|
|
|
group_name: USERNAME_ROUTE_FORMAT
|
|
|
|
}
|
|
|
|
|
2014-01-04 01:52:24 +08:00
|
|
|
get 'embed/comments' => 'embed#comments'
|
2014-01-14 01:47:24 +08:00
|
|
|
get 'embed/count' => 'embed#count'
|
2015-05-06 09:00:31 +08:00
|
|
|
get 'embed/info' => 'embed#info'
|
2014-01-01 03:37:43 +08:00
|
|
|
|
2015-04-28 02:36:02 +08:00
|
|
|
get "new-topic" => "list#latest"
|
2015-11-24 20:46:42 +08:00
|
|
|
get "new-message" => "list#latest"
|
2015-04-28 02:36:02 +08:00
|
|
|
|
2013-02-15 03:11:13 +08:00
|
|
|
# Topic routes
|
2014-09-17 23:18:41 +08:00
|
|
|
get "t/id_for/:slug" => "topics#id_for_slug"
|
2013-12-24 07:50:36 +08:00
|
|
|
get "t/:slug/:topic_id/wordpress" => "topics#wordpress", constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:topic_id/wordpress" => "topics#wordpress", constraints: {topic_id: /\d+/}
|
2015-08-13 05:00:16 +08:00
|
|
|
get "t/:slug/:topic_id/moderator-liked" => "topics#moderator_liked", constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:slug/:topic_id/summary" => "topics#show", defaults: {summary: true}, constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:slug/:topic_id/unsubscribe" => "topics#unsubscribe", constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:topic_id/unsubscribe" => "topics#unsubscribe", constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:topic_id/summary" => "topics#show", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
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+/}
|
2014-04-10 08:56:56 +08:00
|
|
|
put "t/:topic_id/re-pin" => "topics#re_pin", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
put "t/:topic_id/mute" => "topics#mute", constraints: {topic_id: /\d+/}
|
|
|
|
put "t/:topic_id/unmute" => "topics#unmute", constraints: {topic_id: /\d+/}
|
|
|
|
put "t/:topic_id/autoclose" => "topics#autoclose", constraints: {topic_id: /\d+/}
|
2014-06-17 00:28:07 +08:00
|
|
|
put "t/:topic_id/make-banner" => "topics#make_banner", constraints: {topic_id: /\d+/}
|
|
|
|
put "t/:topic_id/remove-banner" => "topics#remove_banner", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
put "t/:topic_id/remove-allowed-user" => "topics#remove_allowed_user", constraints: {topic_id: /\d+/}
|
2016-06-20 14:29:11 +08:00
|
|
|
put "t/:topic_id/remove-allowed-group" => "topics#remove_allowed_group", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
put "t/:topic_id/recover" => "topics#recover", constraints: {topic_id: /\d+/}
|
|
|
|
get "t/:topic_id/:post_number" => "topics#show", constraints: {topic_id: /\d+/, post_number: /\d+/}
|
2014-01-31 04:23:42 +08:00
|
|
|
get "t/:topic_id/last" => "topics#show", post_number: 99999999, constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
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+/}
|
2014-01-31 04:23:42 +08:00
|
|
|
get "t/:slug/:topic_id/last" => "topics#show", post_number: 99999999, constraints: {topic_id: /\d+/}
|
2016-04-06 01:12:14 +08:00
|
|
|
get "t/:topic_id/posts" => "topics#posts", constraints: {topic_id: /\d+/}, format: :json
|
2013-12-24 07:50:36 +08:00
|
|
|
post "t/:topic_id/timings" => "topics#timings", constraints: {topic_id: /\d+/}
|
|
|
|
post "t/:topic_id/invite" => "topics#invite", constraints: {topic_id: /\d+/}
|
2016-06-20 14:29:11 +08:00
|
|
|
post "t/:topic_id/invite-group" => "topics#invite_group", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
post "t/:topic_id/move-posts" => "topics#move_posts", constraints: {topic_id: /\d+/}
|
|
|
|
post "t/:topic_id/merge-topic" => "topics#merge_topic", constraints: {topic_id: /\d+/}
|
2014-03-28 09:28:14 +08:00
|
|
|
post "t/:topic_id/change-owner" => "topics#change_post_owners", constraints: {topic_id: /\d+/}
|
2015-07-26 00:06:49 +08:00
|
|
|
put "t/:topic_id/change-timestamp" => "topics#change_timestamps", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
delete "t/:topic_id/timings" => "topics#destroy_timings", constraints: {topic_id: /\d+/}
|
2015-01-12 19:10:15 +08:00
|
|
|
put "t/:topic_id/bookmark" => "topics#bookmark", constraints: {topic_id: /\d+/}
|
2015-02-19 07:58:57 +08:00
|
|
|
put "t/:topic_id/remove_bookmarks" => "topics#remove_bookmarks", constraints: {topic_id: /\d+/}
|
2013-12-24 07:50:36 +08:00
|
|
|
|
|
|
|
post "t/:topic_id/notifications" => "topics#set_notifications" , constraints: {topic_id: /\d+/}
|
|
|
|
|
2014-07-12 05:34:26 +08:00
|
|
|
get "p/:post_id(/:user_id)" => "posts#short_link"
|
2014-06-21 05:06:44 +08:00
|
|
|
get "/posts/:id/cooked" => "posts#cooked"
|
2014-04-02 05:45:16 +08:00
|
|
|
get "/posts/:id/expand-embed" => "posts#expand_embed"
|
2014-07-12 05:34:26 +08:00
|
|
|
get "/posts/:id/raw" => "posts#markdown_id"
|
2014-10-18 03:18:29 +08:00
|
|
|
get "/posts/:id/raw-email" => "posts#raw_email"
|
2014-07-12 05:34:26 +08:00
|
|
|
get "raw/:topic_id(/:post_number)" => "posts#markdown_num"
|
2013-04-30 14:29:57 +08:00
|
|
|
|
2015-04-11 05:00:50 +08:00
|
|
|
resources :queued_posts, constraints: StaffConstraint.new
|
|
|
|
get 'queued-posts' => 'queued_posts#index'
|
|
|
|
|
2014-05-28 04:14:37 +08:00
|
|
|
resources :invites do
|
|
|
|
collection do
|
|
|
|
get "upload" => "invites#check_csv_chunk"
|
|
|
|
post "upload" => "invites#upload_csv_chunk"
|
|
|
|
end
|
|
|
|
end
|
2014-10-07 02:48:56 +08:00
|
|
|
post "invites/reinvite" => "invites#resend_invite"
|
2016-06-03 03:09:02 +08:00
|
|
|
post "invites/reinvite-all" => "invites#resend_all_invites"
|
2015-08-26 09:41:52 +08:00
|
|
|
post "invites/link" => "invites#create_invite_link"
|
2014-07-14 23:56:26 +08:00
|
|
|
post "invites/disposable" => "invites#create_disposable_invite"
|
|
|
|
get "invites/redeem/:token" => "invites#redeem_disposable_invite"
|
2013-12-24 07:50:36 +08:00
|
|
|
delete "invites" => "invites#destroy"
|
2013-02-15 03:11:13 +08:00
|
|
|
|
2014-12-23 00:17:04 +08:00
|
|
|
resources :export_csv do
|
|
|
|
collection do
|
2015-07-25 00:33:53 +08:00
|
|
|
post "export_entity" => "export_csv#export_entity"
|
2014-12-23 00:17:04 +08:00
|
|
|
end
|
2014-12-24 17:11:41 +08:00
|
|
|
member do
|
|
|
|
get "" => "export_csv#show", constraints: { id: /[^\/]+/ }
|
|
|
|
end
|
2014-12-23 00:17:04 +08:00
|
|
|
end
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "onebox" => "onebox#show"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-06-17 02:25:33 +08:00
|
|
|
get "exception" => "list#latest"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "message-bus/poll" => "message_bus#poll"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "draft" => "draft#show"
|
|
|
|
post "draft" => "draft#update"
|
|
|
|
delete "draft" => "draft#destroy"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-05-19 06:46:09 +08:00
|
|
|
get "cdn_asset/:site/*path" => "static#cdn_asset", format: false
|
|
|
|
|
2015-08-25 09:54:23 +08:00
|
|
|
get "favicon/proxied" => "static#favicon", format: false
|
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
get "robots.txt" => "robots_txt#index"
|
2016-02-14 02:29:53 +08:00
|
|
|
get "manifest.json" => "metadata#manifest", as: :manifest
|
|
|
|
get "opensearch" => "metadata#opensearch", format: :xml
|
2013-02-11 08:02:57 +08:00
|
|
|
|
2016-04-26 03:55:15 +08:00
|
|
|
scope "/tags" do
|
|
|
|
get '/' => 'tags#index'
|
|
|
|
get '/filter/list' => 'tags#index'
|
|
|
|
get '/filter/search' => 'tags#search'
|
|
|
|
get '/check' => 'tags#check_hashtag'
|
|
|
|
constraints(tag_id: /[^\/]+?/, format: /json|rss/) do
|
|
|
|
get '/:tag_id.rss' => 'tags#tag_feed'
|
2016-07-26 04:01:07 +08:00
|
|
|
get '/:tag_id' => 'tags#show', as: 'tag_show'
|
|
|
|
get '/c/:category/:tag_id' => 'tags#show', as: 'tag_category_show'
|
|
|
|
get '/c/:parent_category/:category/:tag_id' => 'tags#show', as: 'tag_parent_category_category_show'
|
2016-04-26 03:55:15 +08:00
|
|
|
get '/:tag_id/notifications' => 'tags#notifications'
|
|
|
|
put '/:tag_id/notifications' => 'tags#update_notifications'
|
|
|
|
put '/:tag_id' => 'tags#update'
|
|
|
|
delete '/:tag_id' => 'tags#destroy'
|
|
|
|
|
|
|
|
Discourse.filters.each do |filter|
|
2016-07-26 04:01:07 +08:00
|
|
|
get "/:tag_id/l/#{filter}" => "tags#show_#{filter}", as: "tag_show_#{filter}"
|
|
|
|
get "/c/:category/:tag_id/l/#{filter}" => "tags#show_#{filter}", as: "tag_category_show_#{filter}"
|
|
|
|
get "/c/:parent_category/:category/:tag_id/l/#{filter}" => "tags#show_#{filter}", as: "tag_parent_category_category_show_#{filter}"
|
2016-04-26 03:55:15 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-06-08 01:08:59 +08:00
|
|
|
|
|
|
|
resources :tag_groups, except: [:new, :edit] do
|
|
|
|
collection do
|
|
|
|
get '/filter/search' => 'tag_groups#search'
|
|
|
|
end
|
|
|
|
end
|
2016-04-26 03:55:15 +08:00
|
|
|
|
2013-12-24 07:50:36 +08:00
|
|
|
Discourse.filters.each do |filter|
|
2013-07-02 02:00:06 +08:00
|
|
|
root to: "list##{filter}", constraints: HomePageConstraint.new("#{filter}"), :as => "list_#{filter}"
|
2013-03-28 21:01:13 +08:00
|
|
|
end
|
|
|
|
# special case for categories
|
2013-07-02 02:00:06 +08:00
|
|
|
root to: "categories#index", constraints: HomePageConstraint.new("categories"), :as => "categories_index"
|
2014-01-04 02:36:49 +08:00
|
|
|
# special case for top
|
2014-01-18 06:52:06 +08:00
|
|
|
root to: "list#top", constraints: HomePageConstraint.new("top"), :as => "top_lists"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2014-08-29 23:28:16 +08:00
|
|
|
get "*url", to: 'permalinks#show', constraints: PermalinkConstraint.new
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|