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
c4de8213
Commit
c4de8213
authored
Jan 21, 2020
by
Raphael Beer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change: --unsafe-cors switch to --cors-allow value; CORS disabled when omitted
parent
478cdd32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
backend.py
backend.py
+7
-8
No files found.
backend.py
View file @
c4de8213
...
...
@@ -512,8 +512,8 @@ async def api(request):
test_index
+=
1
result
=
await
session
.
test
(
screen_name
)
log
(
json
.
dumps
(
result
)
+
'
\n
'
)
if
(
args
.
unsafe_cors
):
return
web
.
json_response
(
result
,
headers
=
{
"Access-Control-Allow-Origin"
:
"*"
})
if
(
args
.
cors_allow
is
not
None
):
return
web
.
json_response
(
result
,
headers
=
{
"Access-Control-Allow-Origin"
:
args
.
cors_allow
})
else
:
return
web
.
json_response
(
result
)
...
...
@@ -551,16 +551,15 @@ 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
'
)
parser
.
add_argument
(
'--
cors-allow'
,
type
=
str
,
default
=
None
,
help
=
'value for Access-Control-Allow-Origin header
'
)
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
(
"!! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !! !!"
)
if
(
args
.
cors_allow
is
None
):
debug
(
'[CORS] Running without CORS headers'
)
else
:
debug
(
'[CORS] Allowing requests from: '
+
args
.
cors_allow
)
ensure_dir
(
args
.
cookie_dir
)
...
...
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