~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/hydraulophone

An unofficial YouTube Music app for iPhone, iPad, and Mac.

0
0
main
28 lines · 831 B Raw History
#!/usr/bin/env python3
"""Read the attributed public JNN client key vendored for simulator and device builds."""

from __future__ import annotations

from pathlib import Path
import re
import sys


KEY_FILE = Path(__file__).resolve().parent.parent / "Config/PublicJNNKey.txt"


def fail(message: str) -> None:
    print(f"Unable to configure the public JNN key: {message}", file=sys.stderr)
    raise SystemExit(2)


try:
    lines = KEY_FILE.read_text(encoding="utf-8").splitlines()
except OSError:
    fail(f"the attributed key file is missing: {KEY_FILE}")

values = [line.strip() for line in lines if line.strip() and not line.lstrip().startswith("#")]
if len(values) != 1 or not re.fullmatch(r"[A-Za-z0-9_-]{39}", values[0]):
    fail(f"the attributed key file has an invalid format: {KEY_FILE}")

sys.stdout.write(values[0])