A mirror of my website's source code.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 dev-server.py

View raw Download
text/x-script.python • 854 B
Python script, ASCII text executable
        
            
1
from build import main as BuildStaticSite, PostList
2
from flask import Flask, redirect
3
4
app = Flask(__name__)
5
6
@app.route("/")
7
def Index():
8
return """<a href="/build">Rebuild site</a>"""
9
10
@app.route("/blog-list")
11
def Writer():
12
BlogListHTML = "<br/>".join(("<a href=\"/edit/%s\">%s</a>" % (post["origin"], post["title"]) for post in PostList))
13
return """<a href="/new-post">+</a><hr/>%(listing)s""" % { "listing": BlogListHTML }
14
15
@app.route("/edit/<post>")
16
def Editor(post: str):
17
BlogListDict = { PostObj["origin"]: PostObj for PostObj in PostList }
18
if post not in BlogListDict:
19
return redirect("/")
20
return """"""
21
22
@app.route("/new-post")
23
def NewPost():
24
return """"""
25
26
@app.route("/build")
27
def Builder():
28
BuildStaticSite()
29
return redirect("/")
30
31
if __name__ == "__main__":
32
app.run("0.0.0.0", 9000, debug=True)