From 877dbf1c3c5c14254e23a7151fb7a86f819b915a Mon Sep 17 00:00:00 2001 From: spitkov Date: Sun, 8 Sep 2024 14:12:10 +0200 Subject: [PATCH] bunch of bugfix --- app.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 1499952..9391510 100644 --- a/app.py +++ b/app.py @@ -48,10 +48,10 @@ def download_file(vanity): @app.route('/upload/pastebin', methods=['POST']) def upload_pastebin(): content = request.form['content'] - vanity = shortuuid.uuid()[:6] + vanity = shortuuid.uuid()[:6] created_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S') data_store[vanity] = {'type': 'pastebin', 'content': content, 'created_at': created_at} - + html_content = render_template('content.html', content=content, created_at=created_at) html_file_path = os.path.join('templates', f'{vanity}.html') @@ -77,7 +77,7 @@ def upload_file(): filepath = os.path.join(app.config['UPLOAD_FOLDER'], f'{vanity}_{filename}') file.save(filepath) data_store[vanity] = {'type': 'file', 'filename': filename} - + file_info = { 'name': filename, @@ -103,7 +103,7 @@ def shorten_url(): html_file_path = os.path.join('templates', f'{vanity}.html') with open(html_file_path, 'w') as f: f.write(html_content) - + return jsonify({'vanity': vanity}) @app.route('/', methods=['GET']) @@ -121,11 +121,11 @@ def redirect_vanity(vanity): 'url': url_for('download_file', vanity=vanity) } @app.route('//raw', methods=['GET']) -def rawvanity: +def rawvanity(vanity): + target = data_store.get(vanity) if target: if target['type'] == 'pastebin': return render_template(f'{vanity}raw.html') - if __name__ == '__main__': - app.run(debug=True) + app.run(debug=True,port=7123) \ No newline at end of file