diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2025-01-06 03:01:25 +0100 | 
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2025-01-06 03:01:25 +0100 | 
| commit | 9498dc9d788c222485b8af64860128b4d33bb039 (patch) | |
| tree | 8a3a0e5ee07464a6cd6e2ff70b98f2f00d8e54c4 | |
| parent | fd1137c3b5d49c1e98194bcceebdbaaa064bc531 (diff) | |
Make version_url provided by the server
| -rw-r--r-- | config.json | 1 | ||||
| -rw-r--r-- | fullnarp.py | 4 | ||||
| -rw-r--r-- | 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 @@ | |||
| 4 | "port": 5023, | 4 | "port": 5023, | 
| 5 | "websocket-host": "localhost", | 5 | "websocket-host": "localhost", | 
| 6 | "websocket-port": "5042", | 6 | "websocket-port": "5042", | 
| 7 | "fullnarp-path": "https://halfnarp.events.ccc.de/fullnarp/", | ||
| 7 | "database-uri": "postgresql://halfnarp@localhost:5432/halfnarp", | 8 | "database-uri": "postgresql://halfnarp@localhost:5432/halfnarp", | 
| 8 | "pretalx-url": "https://cfp.example.de/", | 9 | "pretalx-url": "https://cfp.example.de/", | 
| 9 | "pretalx-token": "<YOUR API KEY HERE>", | 10 | "pretalx-token": "<YOUR API KEY HERE>", | 
| 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. | |||
| 42 | engine = None | 42 | engine = None | 
| 43 | SessionLocal = None | 43 | SessionLocal = None | 
| 44 | Base = declarative_base() | 44 | Base = declarative_base() | 
| 45 | 45 | fullnarp_path = "" | |
| 46 | 46 | ||
| 47 | class TalkPreference(Base): | 47 | class TalkPreference(Base): | 
| 48 | __tablename__ = "talk_preference" | 48 | __tablename__ = "talk_preference" | 
| @@ -70,6 +70,7 @@ async def notify_clients(): | |||
| 70 | message = { | 70 | message = { | 
| 71 | "property": "fullnarp", | 71 | "property": "fullnarp", | 
| 72 | "current_version": newest_version, | 72 | "current_version": newest_version, | 
| 73 | "version_url": fullnarp_path + "versions/fullnarp_" + str(newest_version) + ".json", | ||
| 73 | "data": current_version, | 74 | "data": current_version, | 
| 74 | } | 75 | } | 
| 75 | 76 | ||
| @@ -205,6 +206,7 @@ async def main(): | |||
| 205 | config = json.load(json_file) | 206 | config = json.load(json_file) | 
| 206 | 207 | ||
| 207 | DATABASE_URL = config.get("database-uri", "sqlite:///test.db") | 208 | DATABASE_URL = config.get("database-uri", "sqlite:///test.db") | 
| 209 | fullnarp_path = config.get("fullnarp-path") | ||
| 208 | 210 | ||
| 209 | print(f"Connecting to {DATABASE_URL}") | 211 | print(f"Connecting to {DATABASE_URL}") | 
| 210 | engine = create_engine(DATABASE_URL, echo=False) | 212 | 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() { | |||
| 432 | } | 432 | } | 
| 433 | window.lastupdate = data.current_version; | 433 | window.lastupdate = data.current_version; | 
| 434 | current_version_string = ('00000'+data.current_version).slice(-5); | 434 | current_version_string = ('00000'+data.current_version).slice(-5); | 
| 435 | document.querySelector('.version').innerHTML = '<a href="https://content.events.ccc.de/fullnarp/versions/fullnarp_'+current_version_string+'.json">Version: '+data.current_version+'</a>'; | 435 | document.querySelector('.version').innerHTML = '<a href="' + data.version_url + '">Version: '+data.current_version+'</a>'; | 
| 436 | break; | 436 | break; | 
| 437 | 437 | ||
| 438 | default: | 438 | default: | 
