From 16f56cba7a9c43f83a90dca6bafa7152df1aa4dc Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sat, 24 Jun 2023 16:43:21 +0200 Subject: [PATCH] change: remove native oidc & before_first_request --- server.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/server.py b/server.py index a776acb..633e062 100755 --- a/server.py +++ b/server.py @@ -5,23 +5,15 @@ import argparse import sys import PIL.Image import werkzeug.utils -import flask_oidc import json app = flask.Flask("Picture factory app", static_folder=None) - -## OIDC CONFIG SETUP ## -if os.path.isfile("oidc.json"): - with open("oidc.json") as f: - app.config |= json.load(f) - if not os.path.isfile(app.config["OIDC_CLIENT_SECRETS"]): - raise ValueError("client_secrets.json file is missing in project root") -else: - raise ValueError("OIDC required by environment but not oidc.json file found") - -oidc = flask_oidc.OpenIDConnect(app) PICTURE_DIR = "pictures/" +app.config['MAX_CONTENT_PATH'] = 32+1000*1000 +app.config['UPLOAD_FOLDER'] = PICTURE_DIR +app.config['UPLOAD_ENABLED'] = os.path.isfile("./upload.enable") + def generatePicture(pathToOrig, scaleX, scaleY, encoding, crop): '''Generate an pictures with the requested scales and encoding if it doesn't already exist''' @@ -149,7 +141,6 @@ def list(): return flask.render_template("index.html", paths=retStringArr) @app.route("/upload", methods = ['GET', 'POST']) -@oidc.require_login def upload(): if not app.config['UPLOAD_ENABLED']: return ("Upload Disabled", 403) @@ -169,13 +160,6 @@ def upload(): else: return flask.render_template("upload.html") -@app.before_first_request -def init(): - app.config['MAX_CONTENT_PATH'] = 32+1000*1000 - app.config['UPLOAD_FOLDER'] = PICTURE_DIR - app.config['UPLOAD_ENABLED'] = os.path.isfile("./upload.enable") - - if __name__ == "__main__": parser = argparse.ArgumentParser(description='Picture Factory',