Workflow-App/Workflow/scripts/_dump_doc_text.py
sjcoetzeesj-coder 11d0178ab1 feat: commit Workflow app source; move CIPC credentials to env
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.
2026-10-18 15:21:45 +02:00

36 lines
No EOL
1.4 KiB
Python

import io, urllib.parse, urllib.request
from pathlib import Path
from pypdf import PdfReader
JEI = Path(r"C:\Users\SJ\.minimax-agent\projects\JEI")
env = {}
for line in (JEI / ".env.local").read_text(encoding="utf-8").splitlines():
line = line.strip()
if line and not line.startswith("#") and "=" in line:
k, v = line.split("=", 1)
env[k.strip()] = v.strip().strip('"').strip("'")
PB = env.get("NEXT_PUBLIC_PB_URL") or env["PB_URL"]
TOK = env["PB_TOKEN"]
TARGETS = [
("STORED resolution.signed_letter", "pbc_266170881", "e0dbxprazb70rqx", "corrected_v2_avwpnq7o93.pdf"),
("STORED resignation.letter", "ysterbaard_director_resignations", "8cfie18uhgy0n0o",
"resignation_letter_the_ultimate_fuel_company_1jk8t34nf3.pdf"),
("STORED resignation.signature", "ysterbaard_director_resignations", "8cfie18uhgy0n0o",
"tbde1evt2m6_8mz8kutpki.pdf"),
]
for label, col, rid, fname in TARGETS:
url = f"{PB}/api/files/{col}/{rid}/{urllib.parse.quote(fname)}"
req = urllib.request.Request(url, headers={"Authorization": TOK})
with urllib.request.urlopen(req, timeout=120) as r:
b = r.read()
reader = PdfReader(io.BytesIO(b))
print("=" * 78)
print(f"{label} ({fname}) pages={len(reader.pages)}")
print("=" * 78)
for i, p in enumerate(reader.pages):
t = p.extract_text() or ""
print(f"--- page {i+1} ---")
print(t.strip())
print()