diff --git a/README.md b/README.md index 20aec47..adf77fe 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ A very simple python script that aims to replace the most basic functionalities This wouldn't be necessary if ShareX had just been developed as a cross-platform project, but I digress. Needless to say, this is being developed for and tested on Linux. If you're on Windows, just use ShareX.\ Only (s)ftp uploads for now, but I might add simple curl commands (like used by 0x0) later on. +I should add that the focus will be on a self-hosted server. If you don't care about that, just `curl` 0x0.st or something. #### What works: - Taking area screenshots - Uploading screenshots to (s)ftp diff --git a/pyshare-receiver.py b/pyshare-receiver.py new file mode 100644 index 0000000..8f56418 --- /dev/null +++ b/pyshare-receiver.py @@ -0,0 +1,19 @@ +# this file can be run on a server to act as the endpoint of the script. +# I mainly want to test whether this is faster than sftp + +from flask import Flask, request +from werkzeug.utils import secure_filename + +app = Flask(__name__) + +@app.route('/', methods=['POST']) +def receive_file() -> tuple: + if 'file' in request.files: + file = request.files.get('file') + filename = secure_filename(file.filename) + file.save(filename) + return filename, 201 + return 'you\'re doing this wrong', 418 + +if __name__ == "__main__": + app.run(ssl_context='adhoc')