#!/usr/bin/env python3
"""Serverda: python3 restore_app.py  — buzilgan app.py ni tiklaydi."""
import base64
from pathlib import Path

HERE = Path(__file__).resolve().parent
b64_path = HERE / "app.b64"
out_path = HERE / "app.py"

if not b64_path.is_file():
    raise SystemExit(f"Yo'q: {b64_path}  (WinSCP bilan yuklang)")

out_path.write_bytes(base64.b64decode(b64_path.read_text()))
print("OK:", out_path)
print("Birinchi qator:", out_path.read_text(encoding="utf-8").splitlines()[0])
