Adds the full Next.js app (app/, components/, lib/, scripts/, assets/, docs/, Dockerfile, compose, configs) to version control. Security: - CIPC BizPortal customer-code logins (Login 1 + Login 3) now read CIPC_LOGIN1_CODE / CIPC_LOGIN1_PASSWORD / CIPC_LOGIN3_CODE / CIPC_LOGIN3_PASSWORD from .env.local instead of source. - BizPortal personal login in apply-bizportal route reads BIZPORTAL_ID_NO / BIZPORTAL_PASSWORD. - Added .env.example as the committed template. .gitignore excludes .env*, node_modules, .next, logs, sqlite, Playwright storage_state.json (live CIPC cookies), scratch dirs, client PDFs and debug screenshots.
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Connect to the SARS login Chromium via CDP and screenshot the page.
|
|
|
|
Usage: .venv\Scripts\python screenshot_dashboard.py <cdp_port> <output_path>
|
|
|
|
Reads the URL, waits for it to settle, then takes a full-page PNG.
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
|
|
def main() -> int:
|
|
if len(sys.argv) != 3:
|
|
print(f"Usage: {sys.argv[0]} <cdp_port> <output_path>", file=sys.stderr)
|
|
return 2
|
|
port = int(sys.argv[1])
|
|
out = Path(sys.argv[2]).resolve()
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.connect_over_cdp(f"http://127.0.0.1:{port}")
|
|
ctx = browser.contexts[0]
|
|
page = ctx.pages[0]
|
|
print(f"Connected. URL: {page.url}")
|
|
# Wait a beat for any in-flight navigation to settle.
|
|
try:
|
|
page.wait_for_load_state("domcontentloaded", timeout=5_000)
|
|
except Exception:
|
|
pass
|
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
page.screenshot(path=str(out), full_page=True)
|
|
print(f"Saved: {out}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|