Fix custom template rendering and ensure customize page uses default layout
Add use_default parameter to wrap_page/respond so the customize page always renders with the default template (preventing a broken custom template from locking out the editor). Also fix the stored custom template: add <!DOCTYPE html> to prevent quirks mode and remove newlines inside CSS cursor data URIs that caused CSS parse errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8741c2fffb
commit
b17988fc95
3 changed files with 10 additions and 6 deletions
|
|
@ -6,11 +6,11 @@ from templates import esc, snippet, wrap_page, DEFAULT_TEMPLATE
|
|||
from rns_client import fetch_remote_sites
|
||||
|
||||
|
||||
def _respond(body_html, status=200):
|
||||
def _respond(body_html, status=200, use_default=False):
|
||||
return {
|
||||
"status": status,
|
||||
"content_type": "text/html; charset=utf-8",
|
||||
"body": wrap_page(body_html),
|
||||
"body": wrap_page(body_html, use_default=use_default),
|
||||
"headers": {},
|
||||
}
|
||||
|
||||
|
|
@ -386,7 +386,8 @@ def handle_style_form(msg="", query=None):
|
|||
f"<p>Drag this link to your bookmarks bar. Click it on any page to index it instantly.</p>"
|
||||
f'<p><a href="javascript:void(fetch(\'http://localhost:8080/bookmark?url=\'+encodeURIComponent(location.href)).then(r=>r.text()).then(t=>alert(t)).catch(()=>alert(\'tinyweb not running\')))">+ save to {esc(name)}</a></p>'
|
||||
f"<p>{msg}</p>"
|
||||
f'<a href="/">back</a>'
|
||||
f'<a href="/">back</a>',
|
||||
use_default=True,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue