Update app.py

This commit is contained in:
fzorb 2024-09-09 17:30:34 +03:00
parent ddf561a211
commit 9d8628752d

3
app.py
View File

@ -3,6 +3,7 @@ import sqlite3
import os, sys, time, hashlib
from apscheduler.schedulers.background import BackgroundScheduler
import markdown
import shutils
app = Flask(__name__)
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))
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)
@app.route('/file/<slug>')