fix: RSS page now is available on /now.rss again
All checks were successful
Check Code Quality / RuffCheck (push) Successful in 1m11s
Build Docker / BuildImage (push) Successful in 1m19s

This commit is contained in:
2026-01-28 21:56:06 +07:00
parent 779f895ef8
commit 83436352e7
2 changed files with 6 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ from bs4 import BeautifulSoup
import re import re
# Create blueprint # Create blueprint
app = Blueprint("now", __name__, url_prefix="/now") app = Blueprint("now", __name__, url_prefix="/")
@lru_cache(maxsize=16) @lru_cache(maxsize=16)
@@ -136,14 +136,14 @@ def render_curl(date=None):
) )
@app.route("/", strict_slashes=False) @app.route("/now", strict_slashes=False)
def index(): def index():
if isCLI(request): if isCLI(request):
return render_curl() return render_curl()
return render_latest(handshake_scripts=getHandshakeScript(request.host)) return render_latest(handshake_scripts=getHandshakeScript(request.host))
@app.route("/<path:path>") @app.route("/now/<path:path>")
def path(path): def path(path):
if isCLI(request): if isCLI(request):
return render_curl(path) return render_curl(path)
@@ -151,6 +151,7 @@ def path(path):
return render(path, handshake_scripts=getHandshakeScript(request.host)) return render(path, handshake_scripts=getHandshakeScript(request.host))
@app.route("/now/old", strict_slashes=False)
@app.route("/old", strict_slashes=False) @app.route("/old", strict_slashes=False)
def old(): def old():
now_dates = list_dates()[1:] now_dates = list_dates()[1:]
@@ -187,11 +188,12 @@ def old():
@app.route("/rss.xml") @app.route("/rss.xml")
def rss(): def rss():
host = "https://" + request.host host = "https://" + request.host
path = request.path
if ":" in request.host: if ":" in request.host:
host = "http://" + request.host host = "http://" + request.host
# Generate RSS feed # Generate RSS feed
now_pages = list_page_files() now_pages = list_page_files()
rss = f'<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Nathan.Woodburn/</title><link>{host}</link><description>See what I\'ve been up to</description><language>en-us</language><lastBuildDate>{datetime.datetime.now(tz=datetime.timezone.utc).strftime("%a, %d %b %Y %H:%M:%S %z")}</lastBuildDate><atom:link href="{host}/now.rss" rel="self" type="application/rss+xml" />' rss = f'<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Nathan.Woodburn/</title><link>{host}</link><description>See what I\'ve been up to</description><language>en-us</language><lastBuildDate>{datetime.datetime.now(tz=datetime.timezone.utc).strftime("%a, %d %b %Y %H:%M:%S %z")}</lastBuildDate><atom:link href="{host}{path}" rel="self" type="application/rss+xml" />'
for page in now_pages: for page in now_pages:
link = page.strip(".html") link = page.strip(".html")
date = datetime.datetime.strptime(link, "%y_%m_%d") date = datetime.datetime.strptime(link, "%y_%m_%d")

View File

@@ -65,7 +65,6 @@ RATE_LIMIT_WINDOW = 3600 # 1 hour in seconds
RESTRICTED_ROUTES = ["ascii"] RESTRICTED_ROUTES = ["ascii"]
REDIRECT_ROUTES = { REDIRECT_ROUTES = {
"contact": "/#contact", "contact": "/#contact",
"old": "/now/old",
"/meet": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr", "/meet": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr",
"/meeting": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr", "/meeting": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr",
"/appointment": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr", "/appointment": "https://cloud.woodburn.au/apps/calendar/appointment/PamrmmspWJZr",