diff options
-rw-r--r-- | README-bgstack15.md | 51 | ||||
-rw-r--r-- | README.md | 58 | ||||
-rw-r--r-- | config.cfg.example (renamed from config.cfg.tpl) | 0 | ||||
-rw-r--r-- | initdb.py | 2 | ||||
-rw-r--r-- | manage.py | 2 | ||||
-rwxr-xr-x | stackbin.bin | 1 | ||||
-rwxr-xr-x | stackbin.py (renamed from pastebin.py) | 3 | ||||
-rw-r--r-- | stackbin.wsgi.ini | 5 |
8 files changed, 58 insertions, 64 deletions
diff --git a/README-bgstack15.md b/README-bgstack15.md deleted file mode 100644 index 67b143e..0000000 --- a/README-bgstack15.md +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - -- Filename: README-bgstack15.md - -- Startdate: 2022-02-11 - -- - --> -# Overview -This is my proposed solution to my pastebin problem. - -# Features - -* Admin page which can list parents, children, and provide link to delete pastes. -* Editable titles -* "Reply to" pastes to make parent/children relationships -* UUIDs instead of sequential integer ID numbers -* Private pastes (accessible to admin, and to users with the whole link) - -# Instructions - -Generate new db. - - python3 initdb.py - -Run server in development mode. - - FLASK_APP=pastebin.py FLASK_DEBUG=True flask run --host='0.0.0.0' - -Run the server in a full wsgi environment for the cleanup timer to operate. - - ./stackbin.bin - -# Improvements -I still need to work on these tasks: - -## Development - -* Protect the /admin/ page - -## Release - -* Document centos7 dependencies -* Deploy to prod - -# 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. @@ -1,11 +1,53 @@ -### Flask-Pastebin +<!-- + -- Filename: README.md + -- Startdate: 2022-02-11 + --> +# Overview +This is my proposed solution to my pastebin problem. -This is a fork of [mitsuhiko/pastebin](https://github.com/mitsuhiko/flask-pastebin) +# Features -#### How to use +* Admin page which can list parents, children, and provide link to delete pastes. +* Editable titles +* "Reply to" pastes to make parent/children relationships +* UUIDs instead of sequential integer ID numbers +* Private pastes (accessible to admin, and to users with the whole link) - 1. make a virtualenv - 2. `pip install -r requirements.txt` - 3. `cp config.cfg.tpl config.cfg` - 4. `python manage.py initdb` - 5. `python manage.py server` +# Instructions + +Configure the application with `config.cfg` based on `config.cfg.example`. + +Generate new db. + + python3 initdb.py + +Run server in development mode. + + FLASK_APP=stackbin.py FLASK_DEBUG=True flask run --host='0.0.0.0' + +Run the server in a full wsgi environment for the cleanup timer to operate. + + ./stackbin.bin + +# Improvements +I still need to work on these tasks: + +## Development + +* Protect the /admin/ page + +## Release + +* Document centos7 dependencies +* Deploy to prod + +# Alternatives +This is a very diverged fork of [su27/flask-pastebin](https://github.com/su27/flask-pastebin) which itself was a fork of the original [mitsuhiko/pastebin](https://github.com/mitsuhiko/flask-pastebin). The original had a few additional features worth reviewing. + +## 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/config.cfg.tpl b/config.cfg.example index 23fb072..23fb072 100644 --- a/config.cfg.tpl +++ b/config.cfg.example @@ -1,3 +1,3 @@ -from pastebin import db +from stackbin import db no_wsgi = True db.create_all() @@ -1,6 +1,6 @@ from flask_script import Manager, Server from flask_script.commands import Clean -from pastebin import app, db +from stackbin import app, db manager = Manager(app) diff --git a/stackbin.bin b/stackbin.bin index d3b2da3..4fb3241 100755 --- a/stackbin.bin +++ b/stackbin.bin @@ -1,7 +1,6 @@ #!/bin/sh # Reference: fuss.bin from fuss project # Startdate: 2022-02-13 19:25 -# Goal: see if uwsgi reacts to the @timer directives in the pastebin.py file, because flask run doesn't. thisscript="$( readlink -f "${0}" )" COMMAND="" grep -qiE 'ID=.*(rhel|centos|fedora)' /etc/os-release && COMMAND="${COMMAND} uwsgi" || \ diff --git a/pastebin.py b/stackbin.py index d06dc6e..aac3f49 100755 --- a/pastebin.py +++ b/stackbin.py @@ -1,3 +1,6 @@ +# File: stackbin.py +# SPDX-License-Identifier: GPL-3.0 +# Authors: mitsuhiko, su27, bgstack15 from datetime import datetime, timedelta from itsdangerous import Signer from flask import (Flask, request, url_for, redirect, g, render_template, session, abort) diff --git a/stackbin.wsgi.ini b/stackbin.wsgi.ini index cac4511..4b38ea8 100644 --- a/stackbin.wsgi.ini +++ b/stackbin.wsgi.ini @@ -1,11 +1,12 @@ [uwsgi] plugins = logfile http-socket = 0.0.0.0:5000 -wsgi-file = pastebin.py +wsgi-file = stackbin.py callable = app -touch-reload = pastebin.py +touch-reload = stackbin.py touch-reload = config.cfg touch-reload = stackbin.wsgi.ini +# the template files are not necessary, because flask always loads it from disk for each request req-logger = file:log/req.log # to get strftime format fields, you need double percent signs logdate = "%%FT%%T" |