diff --git a/.gitignore b/.gitignore index 670a936..c18dd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ __pycache__/ -.venv/ diff --git a/Makefile b/Makefile deleted file mode 100644 index 28a244a..0000000 --- a/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - # =====CONFIG===== -PYTHON := python3 -VENV := .venv - - -# =====RECIPES===== -# Create the virtual environment -$(VENV)/bin/activate: setup.py - '$(PYTHON)' -m venv '$(VENV)' - '$(VENV)/bin/pip' install -r requirements.txt - -venv: $(VENV)/bin/activate -.PHONY: venv - -# Remove any temporary files -clean: - @ rm -rf '$(VENV)' -.PHONY: clean diff --git a/app.py b/app.py index 82664c0..9d6a38c 100644 --- a/app.py +++ b/app.py @@ -4,8 +4,8 @@ from pathlib import Path from werkzeug.utils import secure_filename import subprocess -UPLOAD_FOLDER = Path(os.environ['REPO_DIR']) / "pkgs" -API_KEY = os.environ['API_KEY'] +UPLOAD_FOLDER = './data' +API_KEY = 'yeet' ALLOWED_EXTENSIONS = {'pkg.tar.zst', 'pkg.tar.gz'} app = Flask(__name__) @@ -46,7 +46,7 @@ def upload_file(): # Create path for file & check if it already exists filename = secure_filename(file.filename) - path = Path(app.config['UPLOAD_FOLDER']) / filename + path = Path(app.config['UPLOAD_FOLDER']) / 'pkgs' / filename if path.exists(): return {'message': 'File already exists.'}, 400 @@ -57,7 +57,7 @@ def upload_file(): file.save(path) # Run repo-add on the file - res = subprocess.run(["repo-add", path.parent / "repo.db.tar.gz", path]) + res = subprocess.run(["repo-add", path.parent.parent / "repo.db.tar.gz", path]) if res.returncode != 0: path.unlink() @@ -65,3 +65,4 @@ def upload_file(): return {'message': 'Failed to add file to repository.'}, 500 return {'message': 'Success.'}, 200 + diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d6aaf48..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Flask==2.0.2 -gunicorn==20.1.0