From 2334bbccf9b5cde30abbf98929517fcfd9dc530c Mon Sep 17 00:00:00 2001 From: benjamyn Date: Sun, 9 Dec 2018 01:14:04 +1100 Subject: [PATCH] Added in templates for adding/reading pastes --- paste.py | 10 +++++----- templates/post.html | 27 +++++++++++++++++++++++++++ templates/read.html | 26 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 templates/post.html create mode 100644 templates/read.html diff --git a/paste.py b/paste.py index c128aa8..7152054 100644 --- a/paste.py +++ b/paste.py @@ -1,6 +1,6 @@ -#!/usr/bin/python3 +#!/usr/bin/python3.6 -from flask import Flask, request +from flask import Flask, request, render_template import random, string from pathlib import Path from pprint import pprint @@ -52,7 +52,7 @@ doesDirExist() # https://paste.benjamyn.love/CBynvvjwDK app = Flask(__name__) -app.config['DEBUG'] = True +app.config['DEBUG'] = False @app.route('/', methods=['POST', 'GET']) def index(): @@ -60,7 +60,7 @@ def index(): if allowListing == True: return "FileList" else: - return "Nothing to see here ;)" + return render_template("post.html") elif request.method == "POST": data = request.get_data().decode() if "Submit+Query" in data: @@ -82,7 +82,7 @@ def getPaste(path): if pasten.is_file(): with pasten.open() as f: data = f.read() print(data) - return data + return render_template("read.html", data=data) else: return "No paste found" diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..ab34647 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,27 @@ + + + + PasteBen + + + + + + + + +
+

PasteBen

+
+
+ + + +
+
+
+ + + + + \ No newline at end of file diff --git a/templates/read.html b/templates/read.html new file mode 100644 index 0000000..cb9dda7 --- /dev/null +++ b/templates/read.html @@ -0,0 +1,26 @@ + + + + PasteBen + + + + + + + + +
+

PasteBen

+
+
+ +
+
+
+ + + + + + \ No newline at end of file