mirror of
https://github.com/aquatix/alfagok.git
synced 2025-12-06 22:15:11 +01:00
Game version as cache buster for CSS and game JS
This commit is contained in:
@@ -11,6 +11,9 @@ from pydantic import DirectoryPath, FilePath
|
|||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
|
||||||
|
VERSION = '0.3.0'
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
"""Configuration needed for alfagok to find its word list, using environment variables."""
|
"""Configuration needed for alfagok to find its word list, using environment variables."""
|
||||||
|
|
||||||
@@ -74,7 +77,7 @@ def is_valid_dictionary_word(word: str) -> bool:
|
|||||||
async def index(request: Request):
|
async def index(request: Request):
|
||||||
"""Generate the main HTML page of the game."""
|
"""Generate the main HTML page of the game."""
|
||||||
language = 'nl'
|
language = 'nl'
|
||||||
return templates.TemplateResponse(request=request, name='index.html', context={'language': language})
|
return templates.TemplateResponse(request=request, name='index.html', context={'language': language, 'version': VERSION})
|
||||||
|
|
||||||
|
|
||||||
@app.get('/api/game')
|
@app.get('/api/game')
|
||||||
@@ -107,7 +110,7 @@ def handle_guess(word: Union[str, None] = None):
|
|||||||
|
|
||||||
@app.get('/api/answer/{item_id}')
|
@app.get('/api/answer/{item_id}')
|
||||||
def read_item(item_id: int):
|
def read_item(item_id: int):
|
||||||
"""Get the word for the current game."""
|
"""Get the word for the game with ID `item_id`."""
|
||||||
current_game_id = get_game_id()
|
current_game_id = get_game_id()
|
||||||
if item_id > current_game_id:
|
if item_id > current_game_id:
|
||||||
raise HTTPException(status_code=403, detail='No peaking!')
|
raise HTTPException(status_code=403, detail='No peaking!')
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="Raad het woord van de dag. Elke gok geeft een hint over waar het woord zich in het alfabet bevindt. Iedereen speelt hetzelfde woord.">
|
<meta name="description" content="Raad het woord van de dag. Elke gok geeft een hint over waar het woord zich in het alfabet bevindt. Iedereen speelt hetzelfde woord.">
|
||||||
<link rel="stylesheet" href="/static/game.css">
|
<link rel="stylesheet" href="/static/game.css?v={{ version }}">
|
||||||
<link id="favicon" rel="icon" type="image/x-icon" href="static/images/favicon.ico">
|
<link id="favicon" rel="icon" type="image/x-icon" href="/static/images/favicon.ico">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="static/images/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="/static/images/apple-touch-icon.png">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="static/images/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/images/favicon-32x32.png">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="static/images/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="/static/images/favicon-16x16.png">
|
||||||
<link rel="manifest" href="static/images/site.webmanifest">
|
<link rel="manifest" href="/static/images/site.webmanifest">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js"></script>
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
||||||
<script src="/static/game.js"></script>
|
<script src="/static/game.js?v={{ version }}"></script>
|
||||||
{#
|
{#
|
||||||
<button x-data @click="$store.darkMode.toggle()">Toggle Dark Mode</button>
|
<button x-data @click="$store.darkMode.toggle()">Toggle Dark Mode</button>
|
||||||
<div x-data :class="$store.darkMode.on && 'bg-black'">...</div>
|
<div x-data :class="$store.darkMode.on && 'bg-black'">...</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user