import requests
import re


def api_wowlight_version_check(version: str) -> bool:
    """
    Checks incoming wow-lite wallet version, returns False when the version is too old and needs to be upgraded.
    :param version:
    :return: bool
    """
    url = "https://raw.githubusercontent.com/wownero/wow-lite-wallet/master/src/renderer/components/Landing/LandingPage.vue"
    try:
        resp = requests.get(url, headers={"User-Agent": "Mozilla 5.0"})
        resp.raise_for_status()
        content = resp.content.decode()
    except:
        return True  # default to true

    # parse latest version
    current = next(re.finditer(r"wowlite\?version=(\d+.\d+.\d+)", content), None)
    if not current:
        return False

    return version == current.group(1)