forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.rb
243 lines (186 loc) · 7.19 KB
/
routes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'sidekiq/web'
require 'sidetiq/web'
Diaspora::Application.routes.draw do
resources :report, :except => [:edit, :new]
if Rails.env.production?
mount RailsAdmin::Engine => '/admin_panel', :as => 'rails_admin'
end
constraints ->(req) { req.env["warden"].authenticate?(scope: :user) &&
req.env['warden'].user.admin? } do
mount Sidekiq::Web => '/sidekiq', :as => 'sidekiq'
end
# Federation
mount DiasporaFederation::Engine => "/"
get "/atom.xml" => redirect('http://blog.diasporafoundation.org/feed/atom') #too many stupid redirects :()
get 'oembed' => 'posts#oembed', :as => 'oembed'
# Posting and Reading
resources :reshares
resources :status_messages, :only => [:new, :create]
resources :posts do
member do
get :interactions
end
resource :participation, only: %i(create destroy)
resources :poll_participations, only: :create
resources :likes, only: %i(create destroy index)
resources :comments, only: %i(new create destroy index)
end
get 'p/:id' => 'posts#show', :as => 'short_post'
get 'posts/:id/iframe' => 'posts#iframe', :as => 'iframe'
# roll up likes into a nested resource above
resources :comments, :only => [:create, :destroy] do
resources :likes, :only => [:create, :destroy, :index]
end
# Streams
get "activity" => "streams#activity", :as => "activity_stream"
get "stream" => "streams#multi", :as => "stream"
get "public" => "streams#public", :as => "public_stream"
get "followed_tags" => "streams#followed_tags", :as => "followed_tags_stream"
get "mentions" => "streams#mentioned", :as => "mentioned_stream"
get "liked" => "streams#liked", :as => "liked_stream"
get "commented" => "streams#commented", :as => "commented_stream"
get "aspects" => "streams#aspects", :as => "aspects_stream"
resources :aspects do
put :toggle_contact_visibility
put :toggle_chat_privilege
collection do
put "order" => :update_order
end
end
get 'bookmarklet' => 'status_messages#bookmarklet'
resources :photos, :except => [:index, :show] do
put :make_profile_photo
end
#Search
get 'search' => "search#search"
resources :conversations do
resources :messages, :only => [:create, :show]
delete 'visibility' => 'conversation_visibilities#destroy'
end
resources :notifications, :only => [:index, :update] do
collection do
get :read_all
end
end
resources :tags, :only => [:index]
resources "tag_followings", only: %i(create destroy index) do
collection do
get :manage
end
end
get 'tags/:name' => 'tags#show', :as => 'tag'
resources :apps, :only => [:show]
# Users and people
resource :user, :only => [:edit, :update, :destroy], :shallow => true do
get :getting_started_completed
post :export_profile
get :download_profile
post :export_photos
get :download_photos
end
controller :users do
get 'public/:username' => :public, :as => 'users_public'
get 'getting_started' => :getting_started, :as => 'getting_started'
get 'privacy' => :privacy_settings, :as => 'privacy_settings'
get 'getting_started_completed' => :getting_started_completed
get 'confirm_email/:token' => :confirm_email, :as => 'confirm_email'
end
# This is a hack to overide a route created by devise.
# I couldn't find anything in devise to skip that route, see Bug #961
get 'users/edit' => redirect('/user/edit')
devise_for :users, :controllers => {:registrations => "registrations",
:sessions => "sessions"}
#legacy routes to support old invite routes
get 'users/invitation/accept' => 'invitations#edit'
get 'invitations/email' => 'invitations#email', :as => 'invite_email'
get 'users/invitations' => 'invitations#new', :as => 'new_user_invitation'
post 'users/invitations' => 'invitations#create', :as => 'user_invitation'
get 'login' => redirect('/users/sign_in')
# Admin backend routes
scope 'admins', :controller => :admins do
match :user_search, via: [:get, :post]
get :admin_inviter
get :weekly_user_stats
get :stats, :as => 'pod_stats'
get "add_invites/:invite_code_id" => 'admins#add_invites', :as => 'add_invites'
end
namespace :admin do
post 'users/:id/close_account' => 'users#close_account', :as => 'close_account'
post 'users/:id/lock_account' => 'users#lock_account', :as => 'lock_account'
post 'users/:id/unlock_account' => 'users#unlock_account', :as => 'unlock_account'
end
resource :profile, :only => [:edit, :update]
resources :profiles, :only => [:show]
resources :contacts, :except => [:update, :create] do
end
resources :aspect_memberships, :only => [:destroy, :create]
resources :share_visibilities, :only => [:update]
resources :blocks, :only => [:create, :destroy]
get 'i/:id' => 'invitation_codes#show', :as => 'invite_code'
get 'people/refresh_search' => "people#refresh_search"
resources :people, :except => [:edit, :update] do
resources :status_messages
resources :photos
get :contacts
get "aspect_membership_button" => :aspect_membership_dropdown, :as => "aspect_membership_button"
get :stream
get :hovercard
member do
get :last_post
end
collection do
post 'by_handle' => :retrieve_remote, :as => 'person_by_handle'
get :tag_index
end
end
get '/u/:username' => 'people#show', :as => 'user_profile', :constraints => { :username => /[^\/]+/ }
get '/u/:username/profile_photo' => 'users#user_photo', :constraints => { :username => /[^\/]+/ }
# External
resources :services, :only => [:index, :destroy]
controller :services do
scope "/auth", :as => "auth" do
get ':provider/callback' => :create
get :failure
end
end
scope 'api/v0', :controller => :apis do
get :me
end
namespace :api do
namespace :v0 do
get "/users/:username" => 'users#show', :as => 'user'
get "/tags/:name" => 'tags#show', :as => 'tag'
end
namespace :v1 do
resources :tokens, :only => [:create, :destroy]
end
end
get 'community_spotlight' => "contacts#spotlight", :as => 'community_spotlight'
# Mobile site
get 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
get "/m", to: "home#force_mobile", as: "force_mobile"
# Help
get 'help' => 'help#faq', :as => 'help'
get 'help/:topic' => 'help#faq'
#Protocol Url
get 'protocol' => redirect("http://wiki.diasporafoundation.org/Federation_Protocol_Overview")
# NodeInfo
get ".well-known/nodeinfo", to: "node_info#jrd"
get "nodeinfo/:version", to: "node_info#document", as: "node_info", constraints: {version: /\d+\.\d+/}
get "statistics", to: "node_info#statistics"
# Terms
if AppConfig.settings.terms.enable?
get 'terms' => 'terms#index'
end
# Legal
get 'legal', :to => 'home#legal', :as => 'legal'
# Resque web
#if AppConfig.admins.inline_resque_web?
# mount Resque::Server.new, :at => '/resque-jobs', :as => "resque_web"
#end
# Startpage
root :to => 'home#show'
end