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
6dff9a3f
Commit
6dff9a3f
authored
Jan 20, 2020
by
Raphael Beer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add: CORS * in development; use --unsafe-cors to enable
parent
14ab4b54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
backend.py
backend.py
+12
-1
No files found.
backend.py
View file @
6dff9a3f
...
...
@@ -512,7 +512,10 @@ async def api(request):
test_index
+=
1
result
=
await
session
.
test
(
screen_name
)
log
(
json
.
dumps
(
result
)
+
'
\n
'
)
return
web
.
json_response
(
result
)
if
(
args
.
unsafe_cors
):
return
web
.
json_response
(
result
,
headers
=
{
"Access-Control-Allow-Origin"
:
"*"
})
else
:
return
web
.
json_response
(
result
)
async
def
login_accounts
(
accounts
,
cookie_dir
=
None
):
if
cookie_dir
is
not
None
and
not
os
.
path
.
isdir
(
cookie_dir
):
...
...
@@ -548,9 +551,17 @@ parser.add_argument('--mongo-host', type=str, default='localhost', help='hostnam
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
=
None
,
help
=
'auth key for twitter guest session'
,
required
=
True
)
parser
.
add_argument
(
'--unsafe-cors'
,
action
=
'store_true'
,
help
=
'Enable UNSAFE *-CORS on /screenName route'
)
args
=
parser
.
parse_args
()
TwitterSession
.
twitter_auth_key
=
args
.
twitter_auth_key
if
(
args
.
unsafe_cors
):
debug
(
"!! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !!"
)
debug
(
"!! ALLOWING UNSAFE CORS REQUESTS FROM *"
)
debug
(
"!! Do not do this in production!"
)
debug
(
"!! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !!"
)
ensure_dir
(
args
.
cookie_dir
)
with
open
(
args
.
account_file
,
"r"
)
as
f
:
...
...
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