INNER CODE UNIT · Python

validate_app_config

ImranR98/apps.obtainium.imranr.dev · scripts/generate_from_url.py:46

def validate_app_config(app_config):
    """Check that the payload contains the required keys and a valid package id."""
    if not isinstance(app_config, dict):
        print(Fore.RED + "Invalid payload: expected a JSON object.")
        return False
    missing = [key for key in CONFIG_KEYS if not isinstance(app_config.get(key), str) or not app_config[key].strip()]
    if missing:
        print(Fore.RED + f"Invalid payload: missing or empty keys: {', '.join(missing)}.")
        return False
    if not ID_RE.match(app_config["id"]):
        print(Fore.RED + f"Invalid package id: {app_config['id']}")
        return False
    return True


def has_complex_settings(app_config):
    """Check whether a config needs to go in the complex folder."""
    settings = app_config.get("additionalSettings")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…