#!/usr/bin/env python3 """Pull admin templates from the Ubuntu server, then we patch them.""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(r"c:\laragon\www\light-otantik-nux") OUT = ROOT / "deploy" / "nux-custom" / "ui" / "ui" / "admin" OUT.mkdir(parents=True, exist_ok=True) sys.path.insert(0, str(ROOT / "scripts")) from deploy_remote import connect # noqa: E402 REMOTE = { "/var/www/phpnuxbill/ui/ui/admin/footer.tpl": OUT / "footer.tpl", "/var/www/phpnuxbill/ui/ui/admin/header.tpl": OUT / "header.server.tpl", "/var/www/phpnuxbill/ui/ui/admin/dashboard.tpl": OUT / "dashboard.server.tpl", "/var/www/phpnuxbill/system/controllers/community.php": ROOT / "deploy" / "nux-custom" / "system" / "controllers" / "community.server.php", } def main() -> None: client = connect() sftp = client.open_sftp() for remote, local in REMOTE.items(): local.parent.mkdir(parents=True, exist_ok=True) sftp.get(remote, str(local)) print("got", remote, "->", local, "bytes", local.stat().st_size) sftp.close() client.close() if __name__ == "__main__": main()