From 9498dc9d788c222485b8af64860128b4d33bb039 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Mon, 6 Jan 2025 03:01:25 +0100 Subject: Make version_url provided by the server --- config.json | 1 + fullnarp.py | 4 +++- static/fullnarp.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index b976591..d34e97b 100644 --- a/config.json +++ b/config.json @@ -4,6 +4,7 @@ "port": 5023, "websocket-host": "localhost", "websocket-port": "5042", + "fullnarp-path": "https://halfnarp.events.ccc.de/fullnarp/", "database-uri": "postgresql://halfnarp@localhost:5432/halfnarp", "pretalx-url": "https://cfp.example.de/", "pretalx-token": "", diff --git a/fullnarp.py b/fullnarp.py index 3a1262e..24c5dc6 100644 --- a/fullnarp.py +++ b/fullnarp.py @@ -42,7 +42,7 @@ speaker availibilities. It should only be served behind some auth. engine = None SessionLocal = None Base = declarative_base() - +fullnarp_path = "" class TalkPreference(Base): __tablename__ = "talk_preference" @@ -70,6 +70,7 @@ async def notify_clients(): message = { "property": "fullnarp", "current_version": newest_version, + "version_url": fullnarp_path + "versions/fullnarp_" + str(newest_version) + ".json", "data": current_version, } @@ -205,6 +206,7 @@ async def main(): config = json.load(json_file) DATABASE_URL = config.get("database-uri", "sqlite:///test.db") + fullnarp_path = config.get("fullnarp-path") print(f"Connecting to {DATABASE_URL}") engine = create_engine(DATABASE_URL, echo=False) diff --git a/static/fullnarp.js b/static/fullnarp.js index a7aed91..a6cef96 100644 --- a/static/fullnarp.js +++ b/static/fullnarp.js @@ -432,7 +432,7 @@ function getFullnarpData() { } window.lastupdate = data.current_version; current_version_string = ('00000'+data.current_version).slice(-5); - document.querySelector('.version').innerHTML = 'Version: '+data.current_version+''; + document.querySelector('.version').innerHTML = 'Version: '+data.current_version+''; break; default: -- cgit v1.2.3