diff --git a/iwm_browser/main.py b/iwm_browser/main.py index 8208ed2..c0fbd96 100644 --- a/iwm_browser/main.py +++ b/iwm_browser/main.py @@ -3,6 +3,9 @@ from fastapi.staticfiles import StaticFiles from fastapi.middleware.gzip import GZipMiddleware from fastapi.responses import HTMLResponse, PlainTextResponse from fastapi import FastAPI, Form, Response +from typing import Optional +import urllib.parse +import starlette import jinja2 import uvicorn import httpx @@ -25,7 +28,11 @@ template_env = jinja2.Environment( error_template = template_env.get_template("error.html") + +template_env.globals["builtins"] = __builtins__ template_env.globals["convert_times"] = utils.convert_times +template_env.globals["json_dumps"] = json.dumps +template_env.globals["urlencode"] = urllib.parse.urlencode template_env.globals["combineCSS"] = utils.combineCSS template_env.globals["isSelected"] = utils.isSelected template_env.globals["generate_thumbnail_url"] = utils.generate_thumbnail_url @@ -68,6 +75,7 @@ async def root(): @app.get("/search", response_class=HTMLResponse) async def search( + request: starlette.requests.Request, q: Union[str, None] = None, p: int = 0, sort: str = "average_rating", @@ -80,7 +88,7 @@ async def search( p = 0 # Passed to the template - QueryValues = {"q": q, "p": p, "sort": sort, "dir": dir, "date": date} + QueryValues = {"q": q, "p": p, "sort": sort, "dir": dir, "date": date, **request.query_params} searchResults = None if q is not None: diff --git a/iwm_browser/static/search/searchResults.css b/iwm_browser/static/search/searchResults.css index bb41a61..10c6b72 100644 --- a/iwm_browser/static/search/searchResults.css +++ b/iwm_browser/static/search/searchResults.css @@ -4,6 +4,17 @@ align-content: start; } +.fullResponse { + font-size: small; + overflow: scroll; + max-width: 20rem; +} + +.fullResponse table, .fullResponse table td { + border: 1px solid gray; + border-collapse: collapse; +} + .searchResultCard { display: grid; margin: 4px; @@ -117,6 +128,18 @@ outline: 1px dashed pink; */ } +@keyframes pulse { + from { + border: 2px solid initial; + color: inherit; + } + + to { + border: 2px solid lime; + color: lime + } +} + .levelCode { margin-top: 0.5em; } @@ -131,6 +154,19 @@ border: 1px solid #505050; } +.levelCode input:focus { + outline: none; + background-color: #00FFFF10; +} + +.levelCode:active, .levelCode input:active { + animation: pulse 0.5s 1 ease-out; +} + +.illegal { + color: red; +} + /* .levelDifficulty { display: flex; diff --git a/iwm_browser/templates/search.html b/iwm_browser/templates/search.html index eded593..0754477 100644 --- a/iwm_browser/templates/search.html +++ b/iwm_browser/templates/search.html @@ -1,7 +1,8 @@
-Key | Value | + + {% for value in map %} +
{{value}} | {{map[value]}} | +