diff options
| author | tslil <tslil@posteo.de> | 2026-06-19 21:06:18 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-06-19 21:06:23 +0100 |
| commit | 69d56b37f5ed1aa6c1a5fd064f7d869bd07876b0 (patch) | |
| tree | fbdfe86a54b3af01970a7a15c3c8d4187b0d6d5e | |
| parent | a69c511753c2cdfa755dca776db706dccc4c3513 (diff) | |
note.py: ngnix needs to `proxy_set_header X-Script-Name /WHATEVER;` then read in script
| -rwxr-xr-x | note.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -8,6 +8,10 @@ import bottle from bottle import request, run +def get_prefix() -> str: + return request.environ.get("HTTP_X_SCRIPT_NAME", "") + + def latest_file(directory: Path) -> Path | None: files = [p for p in directory.glob("*.md") if re.match(r"^\d{14}\.md$", p.name)] return max(files, key=lambda p: p.stat().st_mtime) if files else None @@ -63,7 +67,7 @@ def main(): def save_route(): text = request.forms.get("text", "") save(args.directory, text) - return bottle.redirect("/") + return bottle.redirect(get_prefix() + "/") run(host=args.host, port=args.port) |
