Use HTTP_url_scheme according to new config useSSL

This commit is contained in:
ABelliqueux 2022-11-13 12:15:40 +01:00
parent c697953028
commit 015ebffc61
2 changed files with 11 additions and 2 deletions

12
app.py
View File

@ -30,6 +30,7 @@ upload_folder = os.path.expanduser(app.config['DEFAULT']['media_folder_local'])
media_exts = app.config['DEFAULT']['media_exts'] media_exts = app.config['DEFAULT']['media_exts']
HTTP_secret = str(app.config['DEFAULT']['auth']) HTTP_secret = str(app.config['DEFAULT']['auth'])
debug = app.config['DEFAULT']['debug'] debug = app.config['DEFAULT']['debug']
useSSL = app.config['DEFAULT']['useSSL']
rssi_signal = 0 rssi_signal = 0
# HTTP upload settings # HTTP upload settings
@ -43,6 +44,13 @@ users = {
"": generate_password_hash(HTTP_secret), "": generate_password_hash(HTTP_secret),
} }
HTTP_url_scheme = "http"
if useSSL:
HTTP_url_scheme += "s"
if debug:
print(HTTP_url_scheme)
@auth.verify_password @auth.verify_password
def verify_password(username, password): def verify_password(username, password):
''' '''
@ -198,5 +206,5 @@ def upload_file(over_write=1):
if __name__ == '__main__': if __name__ == '__main__':
# Turn ACT and POW leds off on start # Turn ACT and POW leds off on start
# ~ led_init() # ~ led_init()
# app.run() # ~ app.run()
serve(app, host='127.0.0.1', port=5000, url_scheme='https') serve(app, host='127.0.0.1', port=5000, url_scheme=HTTP_url_scheme)

View File

@ -1,5 +1,6 @@
[DEFAULT] [DEFAULT]
debug = 1 debug = 1
useSSL = true
auth = "secret" auth = "secret"
media_folder_local = "~/Videos" media_folder_local = "~/Videos"
media_exts = ["mp4", "avi", "mkv"] media_exts = ["mp4", "avi", "mkv"]