From 35bdf37e8cf571361013dd2bd52048a9a59c229f Mon Sep 17 00:00:00 2001 From: sgrtye Date: Wed, 2 Oct 2024 04:10:43 +0100 Subject: [PATCH] add /urls --- novel/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/novel/main.py b/novel/main.py index f562cf0..505ed3b 100644 --- a/novel/main.py +++ b/novel/main.py @@ -144,6 +144,16 @@ def do_GET(self): } response = json.dumps(filtered_titles) self.wfile.write(response.encode("utf-8")) + elif self.path == "/urls": + self.send_response(200) + self.send_header("Content-type", "application/json") + self.end_headers() + + book_urls = { + name: BOOK_URL.replace("BOOK_ID", id) for id, name in books.items() + } + response = json.dumps(book_urls) + self.wfile.write(response.encode("utf-8")) elif self.path == "/health": if time.time() - last_updated_time > loop_time: self.send_response(500)