Update app.py
This commit is contained in:
parent
ddf561a211
commit
9d8628752d
3
app.py
3
app.py
@ -3,6 +3,7 @@ import sqlite3
|
|||||||
import os, sys, time, hashlib
|
import os, sys, time, hashlib
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
import markdown
|
import markdown
|
||||||
|
import shutils
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
db = sqlite3.connect('wastetape.db', check_same_thread=False)
|
db = sqlite3.connect('wastetape.db', check_same_thread=False)
|
||||||
@ -93,7 +94,7 @@ def upload():
|
|||||||
|
|
||||||
cs.execute('INSERT INTO files (slug, originalName, md5, date, deletion, ip) VALUES (?, ?, ?, ?, ?, ?)', (slug, originalName, hash, int(time.time()), expiry, request.remote_addr))
|
cs.execute('INSERT INTO files (slug, originalName, md5, date, deletion, ip) VALUES (?, ?, ?, ?, ?, ?)', (slug, originalName, hash, int(time.time()), expiry, request.remote_addr))
|
||||||
db.commit()
|
db.commit()
|
||||||
os.rename(os.path.join('tmp', filename), os.path.join('static/files', slug + '.' + filename.split('.')[-1]))
|
shutil.move(os.path.join('tmp', filename), os.path.join('static/files', slug + '.' + filename.split('.')[-1]))
|
||||||
return redirect("/file/" + slug)
|
return redirect("/file/" + slug)
|
||||||
|
|
||||||
@app.route('/file/<slug>')
|
@app.route('/file/<slug>')
|
||||||
|
Loading…
Reference in New Issue
Block a user