INNER CODE UNIT · Python
_patch_scaffold_index_html
fluxerapp/flutter_client · tool/run_widget_preview_patched.py:53
def _patch_scaffold_index_html(scaffold_dir: str) -> None:
index_path = os.path.join(scaffold_dir, "web", "index.html")
if not os.path.isfile(index_path):
return
with open(index_path, encoding="utf-8") as handle:
content = handle.read()
if _PATCH_MARKER in content:
return
if _BOOTSTRAP_LINE not in content:
print(
f"[run_widget_preview_patched] Expected bootstrap script not found in {index_path}; "
"skipping patch.",
file=sys.stderr,
)
return
patched = content.replace(
_BOOTSTRAP_LINE,
_BOOTSTRAP_LINE + "\n" + _PASSKEYS_SCRIPT + "\n",