diff --git a/.gitignore b/.gitignore
index 4802c2b..74223d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
venv/
.DS_Store
-txt/
\ No newline at end of file
+txt/
+__pycache__
\ No newline at end of file
diff --git a/list.html b/list.html
new file mode 100644
index 0000000..97ef0fe
--- /dev/null
+++ b/list.html
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+ Souptxt
+
+
+
+ Souptxt
+ Writings for the thesis
+
+
+
+
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 2e570eb..36a6ff6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,10 @@
click==8.1.3
+colorama==0.4.6
Flask==2.2.2
importlib-metadata==5.1.0
itsdangerous==2.1.2
Jinja2==3.1.2
+Markdown==3.4.1
MarkupSafe==2.1.1
python-dotenv==0.21.0
python-frontmatter==1.0.0
diff --git a/souptxt.py b/souptxt.py
index f585b20..3899d8a 100644
--- a/souptxt.py
+++ b/souptxt.py
@@ -1,5 +1,5 @@
import os
-from flask import Flask, render_template, url_for, send_from_directory
+from flask import Flask, render_template, url_for, send_from_directory, request, redirect
import frontmatter
import markdown
from prefix import PrefixMiddleware
@@ -7,6 +7,7 @@ from dotenv import load_dotenv
from time import strftime, localtime
import random
import glob
+import subprocess
@@ -45,6 +46,11 @@ def txt_list():
return writings
+def render_list():
+ subprocess.run(['update.sh'], shell=True)
+ with open('list.html', 'w+') as f:
+ f.write(render_template('home.html', writings=txt_list()))
+
# ---
# Create Flask App
@@ -53,14 +59,13 @@ def txt_list():
app = Flask(__name__)
app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix=prefix)
-
# ---
# Routes
# ---
@app.route('/')
def home():
- return render_template('home.html', writings=txt_list())
+ return send_from_directory(app.root_path,'list.html')
@app.route('/txt/')
def txt(slug):
@@ -73,8 +78,17 @@ def txt(slug):
except FileNotFoundError:
return 'File not found!'
+@app.route('/api/update', methods=['GET', 'POST'])
+def update():
+ render_list()
+ if request.method == 'POST':
+ render_list()
+ return redirect(url_for('home'))
+
+
+
# ---
# Run the app
# ---
-app.run(port=port, debug=debug)
+app.run(port=port, debug=debug)
\ No newline at end of file
diff --git a/update.sh b/update.sh
index e69de29..9f6acad 100644
--- a/update.sh
+++ b/update.sh
@@ -0,0 +1,4 @@
+rm -rf txt
+git clone https://git.xpub.nl/kamo/txt.git txt
+cd txt
+git checkout main
\ No newline at end of file