Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
shadowban-eu-backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
shadowban-eu-backend
Commits
d4f316ad
Commit
d4f316ad
authored
Dec 03, 2021
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert
parent
fb4685e9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
689 additions
and
53 deletions
+689
-53
Procfile
Procfile
+1
-1
backend.backup
backend.backup
+680
-0
backend.py
backend.py
+8
-52
No files found.
Procfile
View file @
d4f316ad
web: gunicorn backend:app --log-file -
\ No newline at end of file
web: python3 backend.py --port=$PORT
\ No newline at end of file
backend.backup
0 → 100644
View file @
d4f316ad
This diff is collapsed.
Click to expand it.
backend.py
View file @
d4f316ad
...
...
@@ -21,8 +21,6 @@ TWITTER_AUTH_KEY = 'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%
routes
=
web
.
RouteTableDef
()
app
=
web
.
Application
()
class
UnexpectedApiError
(
Exception
):
pass
...
...
@@ -496,47 +494,6 @@ def print_session_info(sessions):
text
+=
"
\n
%6
d
%5
d
%9
d
%5
d"
%
(
int
(
session
.
locked
),
session
.
limit
,
session
.
remaining
,
session
.
reset
-
int
(
time
.
time
()))
return
text
# @routes.get("/")
# async def index(request):
# return web.FileResponse(os.path.join("dist", "index.html"))
# @routes.get("/css/{path}")
# async def css(request):
# return web.FileResponse(os.path.join("dist", "css", request.match_info['path']))
# @routes.get("/js/{path}")
# async def js(request):
# return web.FileResponse(os.path.join("dist", "js", request.match_info['path']))
# @routes.get("/img/{path}")
# async def img(request):
# return web.FileResponse(os.path.join("dist", "img", request.match_info['path']))
# @routes.get("/favicon/{path}")
# async def favicon(request):
# return web.FileResponse(os.path.join("dist", "favicon", request.match_info['path']))
# @routes.get("/i18n/{path}")
# async def i18n(request):
# return web.FileResponse(os.path.join("dist", "i18n", request.match_info['path']))
# @routes.get("/favicon.png")
# async def faviconpng(request):
# return web.FileResponse(os.path.join("dist", "favicon.png"))
# @routes.get("/manifest.json")
# async def manifest(request):
# return web.FileResponse(os.path.join("dist", "manifest.json"))
# @routes.get("/index.html")
# async def indexhtml(request):
# return web.FileResponse(os.path.join("dist", "index.html"))
# @routes.get("/worker.js")
# async def static(request):
# return web.FileResponse(os.path.join("dist", "worker.js"))
@
routes
.
get
(
'/.stats'
)
async
def
stats
(
request
):
text
=
"--- GUEST SESSIONS ---
\n\n
Locked Limit Remaining Reset"
...
...
@@ -601,13 +558,13 @@ parser.add_argument('--log', type=str, default=None, help='log file where test r
parser
.
add_argument
(
'--daemon'
,
action
=
'store_true'
,
help
=
'run in background'
)
parser
.
add_argument
(
'--debug'
,
type
=
str
,
default
=
None
,
help
=
'debug log file'
)
parser
.
add_argument
(
'--port'
,
type
=
int
,
default
=
8080
,
help
=
'port which to listen on'
)
parser
.
add_argument
(
'--host'
,
type
=
str
,
default
=
'
0.0.0.0
'
,
help
=
'hostname/ip which to listen on'
)
parser
.
add_argument
(
'--host'
,
type
=
str
,
default
=
'
127.0.0.1
'
,
help
=
'hostname/ip which to listen on'
)
parser
.
add_argument
(
'--mongo-host'
,
type
=
str
,
default
=
None
,
help
=
'hostname or IP of mongoDB service to connect to'
)
parser
.
add_argument
(
'--mongo-port'
,
type
=
int
,
default
=
27017
,
help
=
'port of mongoDB service to connect to'
)
parser
.
add_argument
(
'--mongo-db'
,
type
=
str
,
default
=
'tester'
,
help
=
'name of mongo database to use'
)
parser
.
add_argument
(
'--twitter-auth-key'
,
type
=
str
,
default
=
TWITTER_AUTH_KEY
,
help
=
'auth key for twitter guest session'
)
parser
.
add_argument
(
'--cors-allow'
,
type
=
str
,
default
=
None
,
help
=
'value for Access-Control-Allow-Origin header'
)
args
,
undefined
=
parser
.
parse_known_args
()
args
,
unknown
=
parser
.
parse_known_args
()
TwitterSession
.
twitter_auth_key
=
args
.
twitter_auth_key
...
...
@@ -616,6 +573,7 @@ if (args.cors_allow is None):
else
:
debug
(
'[CORS] Allowing requests from: '
+
args
.
cors_allow
)
accounts
=
[]
if
args
.
account_file
is
None
:
debug
(
'No account file specified.'
)
...
...
@@ -638,7 +596,7 @@ if args.debug is not None:
ensure_dir
(
debug_dir
)
debug_file
=
open
(
args
.
debug
,
"a"
)
def
start
(
*
arg
,
**
kwargs
):
def
run
(
):
global
db
db
=
None
if
args
.
mongo_host
is
not
None
:
...
...
@@ -646,14 +604,12 @@ def start(*arg, **kwargs):
loop
=
asyncio
.
get_event_loop
()
loop
.
run_until_complete
(
login_accounts
(
accounts
,
args
.
cookie_dir
))
loop
.
run_until_complete
(
login_guests
())
app
=
web
.
Application
()
app
.
add_routes
(
routes
)
return
app
web
.
run_app
(
app
,
host
=
args
.
host
,
port
=
args
.
port
)
if
args
.
daemon
:
with
daemon
.
DaemonContext
():
start
()
run
()
else
:
start
()
if
__name__
==
"__main__"
:
web
.
run_app
(
app
,
host
=
args
.
host
,
port
=
args
.
port
)
\ No newline at end of file
run
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment