from __future__ import annotations
import json
from .html_utils import SafeHtml, attr, escape, join_html, trusted
def _top_nav(label: str | None = None, links: SafeHtml | None = None) -> SafeHtml:
account_html = ""
if label:
account_html = f''
if links is None:
links = trusted('DocsAPI')
theme_toggle = """
"""
return trusted(
f"""
Skip to content
"""
)
def _copy_row(label: str, value: str, sensitivity: str | None = None) -> SafeHtml:
safe_label = escape(label)
safe_value = escape(value)
badge = ""
is_secret = bool(sensitivity and sensitivity.lower() == "secret")
if sensitivity:
safe_sensitivity = escape(sensitivity)
badge_class = "text-bg-warning" if is_secret else "text-bg-secondary"
badge = f'{safe_sensitivity}'
value_field = (
f''
if is_secret
else f'{safe_value}'
)
reveal_button = (
f''
if is_secret
else ""
)
return trusted(
f"""
FRITZ!Box fills in the IP placeholders automatically. Scripts can use curl. If no IP is sent, KarlDNS uses the request IP.
{safe_commands}
{_copy_button("Copy curl", commands)}