A phone, and how much of this could not be used on one
The sidebar was a 280px panel laid over the page below the phone breakpoint, opened from first paint, with the only control that closed it underneath it -- and that control existed on /chat and on none of the seven other pages carrying a sidebar, Settings included. It starts closed at that width now, slides, dims the page behind it, and closes by tapping beside it, by Escape, or by its own button, which is inside the drawer where it can be reached. Everything a finger has to hit was 36px, or 28 for renaming a chat, every action on a message and every panel's close button. Raising --control-h under a coarse pointer is the only fix that reaches all forty of them, which is what that token is for. The row and message actions were also hover-only, so on a phone they did not exist at all. Installing: the splash and the browser chrome follow the instance's theme rather than always being Moria's near-black; there are screenshots, so the install offer is a dialog rather than a one-line bar; a new release no longer takes over a page somebody is reading; the notification badge is a silhouette rather than a grey square; and a browser rotating its own subscription no longer ends notifications for good. Every request now says it is happening -- nothing did before, so anything slower than a few milliseconds looked like a click that had not registered. A chat can be archived. The column has been filtered on in four places since folders arrived and written by nothing, which is what made it look built. chat.css may contain media queries. The ban protected the composer toolbar from being "fixed" with a breakpoint; that guarantee is asserted directly now, and the old test would have passed a version of the file that wrapped the toolbar without one. scripts/shoot.py is the instrument all of this was found with: it renders a page through TestClient into a real headless browser at a real size and refuses to run if an asset URL was left pointing at testserver. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from fastapi import APIRouter, Form, HTTPException, Request, Response, status
|
||||
@@ -103,6 +104,25 @@ async def connections_page(request: Request, db: Db, user: AdminUser, message: s
|
||||
)
|
||||
|
||||
|
||||
# Header names are a narrow set on purpose: a newline would let one field write
|
||||
# a second header, and a colon in a name splits it. Anything outside it is
|
||||
# dropped rather than repaired -- a header nobody can see the effect of is worse
|
||||
# than one that is visibly missing.
|
||||
_HEADER_NAME = re.compile(r"^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,64}$")
|
||||
|
||||
|
||||
def _parse_headers(raw: str) -> dict[str, str]:
|
||||
"""`Name: value` per line, into the dict the client sends verbatim."""
|
||||
headers: dict[str, str] = {}
|
||||
for line in (raw or "").splitlines()[:20]:
|
||||
name, _, value = line.partition(":")
|
||||
name = name.strip()
|
||||
value = value.strip()[:500]
|
||||
if name and value and _HEADER_NAME.match(name):
|
||||
headers[name] = value
|
||||
return headers
|
||||
|
||||
|
||||
@router.post("/connections")
|
||||
async def create_connection(
|
||||
db: Db,
|
||||
@@ -145,6 +165,7 @@ async def update_connection(
|
||||
enabled: bool = Form(False),
|
||||
unload_url: str = Form(""),
|
||||
unload_method: str = Form("POST"),
|
||||
extra_headers: str = Form(""),
|
||||
) -> Response:
|
||||
connection = _connection(db, connection_id)
|
||||
connection.name = name.strip()[:120] or connection.name
|
||||
@@ -157,6 +178,13 @@ async def update_connection(
|
||||
method = unload_method.strip().upper()
|
||||
connection.unload_method = method if method in ("GET", "POST") else "POST"
|
||||
|
||||
# `extra_headers_json` has been sent with every request to this endpoint
|
||||
# since it was added and written by no form in the application, so its one
|
||||
# documented use -- OpenRouter wants an `HTTP-Referer` and an `X-Title` --
|
||||
# was unreachable. One `Name: value` per line, because a JSON textarea asks
|
||||
# somebody to get braces right in a settings screen.
|
||||
connection.extra_headers_json = _parse_headers(extra_headers)
|
||||
|
||||
submitted = api_key.strip()
|
||||
if submitted and submitted != UNCHANGED_SENTINEL:
|
||||
connection.api_key_encrypted = encrypt(submitted)
|
||||
|
||||
Reference in New Issue
Block a user