mirror of https://github.com/sc0tfree/updog.git
Add --cors parameter for CORS header
This commit is contained in:
parent
28a1ac1612
commit
a39700039d
|
@ -1,5 +1,6 @@
|
|||
colorama
|
||||
flask
|
||||
flask_httpauth
|
||||
flask_cors
|
||||
werkzeug
|
||||
pyopenssl
|
|
@ -4,6 +4,7 @@ import argparse
|
|||
|
||||
from flask import Flask, render_template, send_file, redirect, request, send_from_directory, url_for, abort
|
||||
from flask_httpauth import HTTPBasicAuth
|
||||
from flask_cors import CORS
|
||||
from werkzeug.utils import secure_filename
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
from werkzeug.serving import run_simple
|
||||
|
@ -34,6 +35,7 @@ def parse_arguments():
|
|||
parser.add_argument('--password', type=str, default='', help='Use a password to access the page. (No username)')
|
||||
parser.add_argument('--ssl', action='store_true', help='Use an encrypted connection')
|
||||
parser.add_argument('--version', action='version', version='%(prog)s v'+VERSION)
|
||||
parser.add_argument('--cors', action='store_true', help='Enable CORS')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -49,6 +51,9 @@ def main():
|
|||
app = Flask(__name__)
|
||||
auth = HTTPBasicAuth()
|
||||
|
||||
if args.cors:
|
||||
CORS(app)
|
||||
|
||||
global base_directory
|
||||
base_directory = args.directory
|
||||
|
||||
|
|
Loading…
Reference in New Issue