diff --git a/README.md b/README.md index ae3d0bf..898d523 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ livenessProbe: | GET_REQUIRE_AUTH | "False" | Whether to require authentication for get requests | | DISABLE_RESIZE | "False" | Disable resizing images | | DISABLE_URL_UPLOAD | "False" | Disable uploading using urls | +| DISABLE_UPLOAD_FORM | "False" | Disable upload form | | UPLOAD_ROUTE | "/" | The route for uploading images | | IMAGES_ROOT | "" | The root for images get requests | diff --git a/app/app.py b/app/app.py index 94a10a3..e65d7a4 100644 --- a/app/app.py +++ b/app/app.py @@ -151,6 +151,8 @@ def resize(img, width, height): @app.route("/", methods=["GET"]) def root(): + if settings.DISABLE_UPLOAD_FORM: + return jsonify(error="Not found"), 404 return f"""
diff --git a/app/settings.py b/app/settings.py index 13d6d33..0680156 100644 --- a/app/settings.py +++ b/app/settings.py @@ -21,6 +21,7 @@ GET_REQUIRE_AUTH = False DISABLE_RESIZE = False DISABLE_URL_UPLOAD = False +DISABLE_UPLOAD_FORM = False UPLOAD_ROUTE = "/" IMAGES_ROOT = "" diff --git a/example.env b/example.env index b5960fc..73fcc76 100644 --- a/example.env +++ b/example.env @@ -19,6 +19,7 @@ UPLOAD_REQUIRE_AUTH=False GET_REQUIRE_AUTH=False DISABLE_RESIZE=False DISABLE_URL_UPLOADS=False +DISABLE_UPLOAD_FORM=False UPLOAD_ROUTE="/" IMAGES_ROOT="" VALID_SIZES=[]