diff options
author | B. Stack <bgstack15@gmail.com> | 2022-02-11 18:54:56 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-02-11 18:54:56 -0500 |
commit | 6641c28ab2109277ed9e15559d3ecdc10cc5b807 (patch) | |
tree | 6b98ea7417647f5e8574df7a9b2b7d69813d5651 | |
parent | fixed deps which means flask 1 (diff) | |
download | stackbin-6641c28ab2109277ed9e15559d3ecdc10cc5b807.tar.gz stackbin-6641c28ab2109277ed9e15559d3ecdc10cc5b807.tar.bz2 stackbin-6641c28ab2109277ed9e15559d3ecdc10cc5b807.zip |
Fix dep problem so flask>=2.0.0 now!
By just writing a new initdb command so we don't need manage.py
anymore.
-rw-r--r-- | README-bgstack15.md | 21 | ||||
-rw-r--r-- | initdb.py | 2 | ||||
-rw-r--r-- | pastebin.py | 2 | ||||
-rw-r--r-- | requirements.txt | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/README-bgstack15.md b/README-bgstack15.md index 398d629..34137f5 100644 --- a/README-bgstack15.md +++ b/README-bgstack15.md @@ -1,6 +1,27 @@ +# Instructions + +Generate new db. + + python3 initdb.py + +Run server. + + FLASK_APP=pastebin.py FLASK_DEBUG=True flask run --host='0.0.0.0' + +# Improvements +I still need to practice these: + +* Support editing the title? +* Fix the private bins problem: they always return 403 +* Support deleting somehow: from an admin panel, or a link on the page? +* use UUIDs for link instead of sequential integers? + # Alternatives ## Unresearched https://github.com/yasoob/logit-bin https://github.com/AWilliams17/PasteMate https://github.com/bsamadi/flask-pastebin + +## Attempted +https://github.com/Tygs/0bin sounds cool but it uses a stack I'm unfamiliar with and it had some issues and I didn't want to bother with it. diff --git a/initdb.py b/initdb.py new file mode 100644 index 0000000..b56872f --- /dev/null +++ b/initdb.py @@ -0,0 +1,2 @@ +from pastebin import db +db.create_all() diff --git a/pastebin.py b/pastebin.py index c2ed89d..9807b01 100644 --- a/pastebin.py +++ b/pastebin.py @@ -75,7 +75,7 @@ def show_paste(paste_id): try: sign = request.args.get('s', '') assert str(paste.id) == \ - Signer(app.secret_key, salt='jackson').unsign(sign) + Signer(app.secret_key, salt='jackson').unsign(sign).decode("utf-8") except: abort(403) return render_template('show_paste.html', paste=paste) diff --git a/requirements.txt b/requirements.txt index b1b3d3f..ed75ab4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Flask<2.0.0 +Flask Flask-SQLAlchemy Flask-Script PyMySQL |