-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathWhySaurus.py
169 lines (158 loc) · 9.54 KB
/
WhySaurus.py
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
import constants
import os
import jinja2
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
from django.template import Library
from google.appengine.ext import webapp
from webapp2 import Route, WSGIApplication
from google.appengine.ext.webapp.util import run_wsgi_app
from models.whysaurususer import WhysaurusUser
from handlers import MainPage, About, Help, Contact, Manifesto, PrivacyPolicy, ListSignUp, \
Education, CommonCore, APUSH, Walkthrough, ContactSend, NewPoint,\
DeletePoint, EditPoint, UnlinkPoint, ViewPoint, AddSupportingPoint,\
LinkPoint, Vote, SetRibbon, TestPage, Search, \
AjaxSearch, PointHistory, GetPointsList, AuthHandler, SetEditorPickSort, \
UpdateSupportingPointsSchema, AaronTask, BatchJobs, RebuildSearchIndex, \
DBIntegrityCheck, Outliner, AddTree, Profile, AdminPage, Comments, \
NotificationHandler, Chat, EventRecorder, CreatePrivateAreaPage, PointCard, \
Home, History, HeaderSearch
from handlers.whysaurusgraphql import WhysaurusGraphQL
import schema
# Map URLs to handlers
routes = [
Route('/', Home),
Route('/graphql', WhysaurusGraphQL),
Route('/getMainPageLeft', handler='WhySaurus.MainPage:getMainPageLeft', name='getMainPageLeft'),
Route('/getMainPageRight', handler='WhySaurus.MainPage:getMainPageRight', name='getMainPageRight'),
Route('/about', About),
Route('/manifesto', Manifesto),
Route('/privacyPolicy', PrivacyPolicy),
Route('/listSignUp', ListSignUp),
Route('/education', Education),
Route('/commonCore', CommonCore),
Route('/apushistory', APUSH),
Route('/walkthrough', Walkthrough),
Route('/team', About),
Route('/help', Help),
Route('/WhatIsWhysaurus', Help),
Route('/contact', Contact),
Route('/contactSend', ContactSend),
Route('/newPoint', handler='WhySaurus.NewPoint:newPoint', name='newPoint'),
Route('/deletePoint', DeletePoint),
Route('/editPoint', EditPoint),
Route('/changeEditorsPick', handler='WhySaurus.EditPoint:changeEditorsPick', name='changeEditorsPick'),
Route('/changeLowQualityAdmin', handler='WhySaurus.EditPoint:changeLowQualityAdmin', name='changeLowQualityAdmin'),
Route('/makeFeatured', handler='WhySaurus.EditPoint:makeFeatured', name='makeFeatured'),
Route('/refreshTopStatus', handler='WhySaurus.EditPoint:refreshTopStatus', name='refreshTopStatus'),
Route('/unlinkPoint', UnlinkPoint),
Route('/point/<pointURL>', ViewPoint),
Route('/claim/<pointURL>', PointCard),
Route('/history/<pointURL>', History),
Route('/oldhome', MainPage),
Route('/api/point/<pointURL>',
handler='WhySaurus.PointCard:apiPointGET',
name='apiPointGET'),
Route('/getPointContent', handler='WhySaurus.ViewPoint:getPointContent', name='getPointContent'),
Route('/getPointComments', handler='WhySaurus.ViewPoint:getPointComments', name='getPointComments'),
Route('/user/<userURL>', Profile),
Route('/addSupportingPoint', AddSupportingPoint),
Route('/linkPoint', LinkPoint),
Route('/vote', Vote),
Route('/relVote', handler='WhySaurus.Vote:relevanceVote', name='relevanceVote'),
Route('/setribbon', SetRibbon),
Route('/oldsearch', Search),
Route('/search', HeaderSearch),
Route('/admin', AdminPage),
Route('/roster', handler='WhySaurus.AdminPage:get_pa', name='get_pa'),
Route('/dailyReport', handler='WhySaurus.AdminPage:dailyReport', name='dailyReport'),
Route('/ajaxSearch', AjaxSearch),
Route('/pointHistory', PointHistory),
Route('/getPointCreator', handler='WhySaurus.PointHistory:getPointCreator', name='getPointCreator'),
Route('/getPointsList', GetPointsList),
Route('/outliner', Outliner),
Route('/addTree', AddTree),
Route('/addNotifications', handler='WhySaurus.NotificationHandler:AddNotification', name='addNotifications'),
Route('/newNotificationChannel', handler='WhySaurus.NotificationHandler:NewNotificationChannel',
name='newNotificationChannel'),
Route('/clearNotifications', handler='WhySaurus.NotificationHandler:ClearNotifications',
name='clearNotifications'),
Route('/uploadUsers', handler='WhySaurus.AdminPage:uploadUsers', name='uploadUsers'),
Route('/uploadUserPage', handler='WhySaurus.AdminPage:uploadUserPage', name='uploadUserPage'),
Route('/job/adminTest', handler='WhySaurus.AdminPage:adminTest', name='adminTest'),
Route('/job/updateCachedValues', handler='WhySaurus.AdminPage:adminTest', name='updateCachedValues'),
Route('/job/testPage', TestPage),
Route('/job/setEditorPickSort', SetEditorPickSort),
Route('/job/updateSupportingPointsSchema', UpdateSupportingPointsSchema),
Route('/job/ArchiveAllComments', handler='WhySaurus.AaronTask:ArchiveAllComments'),
Route('/job/sendNotificationEmails', handler='WhySaurus.NotificationHandler:sendNotificationEmails'),
Route('/job/sendSingleNotificationEmail', handler='WhySaurus.NotificationHandler:sendSingleNotificationEmail'),
# Route('/job/MakeLinks', handler='WhySaurus.AaronTask:MakeLinks'),
# Route('/job/MakeLinksAll', handler='WhySaurus.AaronTask:MakeLinksAllAreas'),
Route('/job/DBCheck', handler='WhySaurus.AaronTask:DBCheck'),
# Route('/DeleteDuplicateFollows', handler='WhySaurus.AaronTask:DeleteDuplicateFollows'),
Route('/job/AaronTask', AaronTask),
Route('/job/QueueTask', handler='WhySaurus.AaronTask:QueueTask', name='queueTask'),
Route('/job/CalculateTopPoints', handler='WhySaurus.AaronTask:CalculateTopPoints'),
Route('/job/PopulateCreators', handler='WhySaurus.BatchJobs:PopulateCreators'),
Route('/job/updateCachedValuesAll', handler='WhySaurus.BatchJobs:updateCachedValuesAll',
name='updateCachedValuesAll'),
Route('/job/updateCachedValues/<pointURL>', handler='WhySaurus.EditPoint:updateCachedValues',
name='updateCachedValues'),
Route('/job/DailyBatch', handler='WhySaurus.BatchJobs:dailyBatchJobs', name='dailyBatch'),
Route('/job/RebuildSearchIndex', RebuildSearchIndex),
Route('/job/DBIntegrityCheck', DBIntegrityCheck),
Route('/job/addDBTask', handler='WhySaurus.DBIntegrityCheck:addDBTask', name='addDBTask'),
Route('/job/fixPoint/<pointURL>', handler='WhySaurus.DBIntegrityCheck:fixPoint', name='fixPoint'),
Route('/job/cleanDeadBacklinks/<pointURL>', handler='WhySaurus.DBIntegrityCheck:cleanDeadBacklinks',
name='cleanDeadBacklinks'),
Route('/job/cleanEmptyLinks/<pointURL>', handler='WhySaurus.DBIntegrityCheck:cleanEmptyLinks',
name='cleanEmptyLinks'),
Route('/job/addMissingBacklinks/<pointURL>', handler='WhySaurus.DBIntegrityCheck:addMissingBacklinks',
name='addMissingBacklinks'),
Route('/job/DBcheckPoint/<pointURL>', handler='WhySaurus.DBIntegrityCheck:checkDBPoint',
name='checkDBPoint'),
Route('/job/cleanCurrents/<pointURL>', handler='WhySaurus.DBIntegrityCheck:cleanMultipleCurrent',
name='checkDBPoint'),
# Route('/enterChatRoom', handler='WhySaurus.Chat:enterChatRoom', name='enterChatRoom'),
# Route('/leaveChatRoom', handler='WhySaurus.Chat:leaveChatRoom', name='leaveChatRoom'),
# Route('/send', handler='WhySaurus.Chat:send', name='send'),
# Route('/broadcastChatroom', handler='WhySaurus.Chat:broadcastChatroom', name='broadcastChatroom'),
Route('/recordEvent', handler='WhySaurus.EventRecorder:recordEvent', name='recordEvent'),
# Private Areas
Route('/switchArea/<area_name>', handler='WhySaurus.Profile:setArea', name='switchArea'),
Route('/createArea', handler='WhySaurus.CreatePrivateAreaPage', name='createPrivateAreaPage'),
Route('/area/<areaName>', handler='WhySaurus.AuthHandler:setPrivateAreaUser', name='setPrivateAreaUser'),
Route('/saveComment', handler='WhySaurus.Comments:saveComment', name='saveComment'),
Route('/archiveComments', handler='WhySaurus.Comments:archiveComments', name='archiveComments'),
Route('/getArchivedComments', handler='WhySaurus.Comments:getArchivedComments', name='getArchivedComments'),
Route('/logout', handler='WhySaurus.AuthHandler:logout', name='logout'),
Route('/signup', handler='WhySaurus.AuthHandler:signup', name='signup'),
Route('/login', handler='WhySaurus.AuthHandler:login', name='login'),
Route('/forgot', 'WhySaurus.AuthHandler:forgotPassword', name='forgot'),
Route('/password', 'WhySaurus.AuthHandler:changePassword', name='change'),
Route('/resetPassword', 'WhySaurus.AuthHandler:resetPassword', name='change'),
Route('/setUserGaid', 'WhySaurus.AuthHandler:setUserGaid', name='setGaid'),
Route('/setInternalUser', 'WhySaurus.AuthHandler:setInternalUser', name='setInternalUser'),
Route('/changePassword', 'WhySaurus.AuthHandler:passwordChangePage', name='changePage'),
Route('/<type:v|p>/<user_id:\d+>-<signup_token:.+>', handler='WhySaurus.AuthHandler:verify', name='verification'),
Route('/auth/<provider>', handler='WhySaurus.AuthHandler:_simple_auth', name='auth_login'),
Route('/auth/<provider>/callback', handler='WhySaurus.AuthHandler:_auth_callback', name='auth_callback'),
Route('/.well-known/acme-challenge/<challenge>', handler='WhySaurus.AuthHandler:LetsEncryptHandler', name='letsEnrypt')
]
# webapp2 config
app_config = {
'webapp2_extras.sessions': {
'cookie_name': '_simpleauth_sess',
'secret_key': constants.SESSION_KEY
},
'webapp2_extras.auth': {
'user_attributes': [],
'user_model': WhysaurusUser
},
'graphql_schema' : schema.schema
}
webapp.template.register_template_library('gae_mini_profiler.templatetags.profiler_tags')
app = WSGIApplication(routes=routes, config=app_config, debug=True)
if __name__ == '__main__':
run_wsgi_app(app)