{
    "version": "1.4.10.1",
    "description": "Video calls and chat software",
    "homepage": "https://imo.im/",
    "depends": "extras/uniextract2",
    "license": {
        "identifier": "Freeware",
        "url": "https://imo.im/policies/terms_of_service.html"
    },
    "url": "https://static-web.imoim.net/as/indigo-static/winapp/1.4.10.1/ImoSetup_1.4.10.1_Release.exe#/dl.exe",
    "hash": "7f88e7cf3aae44edb117b918bde72b0c3c9f3e9dc0ab75ca396fdd1756b35fc9",
    "pre_install": [
        "New-Item \"$dir\\extract\" -ItemType Directory | Out-Null",
        "Invoke-ExternalCommand uniextract -ArgumentList @(\"$dir\\dl.exe\", \"$dir\\extract\", '/silent') | Out-Null",
        "Expand-MsiArchive \"$dir\\extract\\AttachedContainer\\ImoInstaller.msi\" \"$dir\\extract\" | Out-Null",
        "Move-Item \"$dir\\extract\\imo\\*\\*\" \"$dir\\\"",
        "Remove-Item \"$dir\\dl.exe\", \"$dir\\extract\" -Force -Recurse"
    ],
    "pre_uninstall": "Stop-Process -Name 'ImoDesktopApp' -ErrorAction SilentlyContinue | Out-Null",
    "shortcuts": [
        [
            "ImoDesktopApp.exe",
            "imo Messenger"
        ]
    ],
    "persist": [
        "data",
        "Logs"
    ],
    "checkver": {
        "script": [
            "$url = 'https://apiact.imoim.net/imoweb-infrastructure-client/apk/version-list'",
            "$body = @{type = '2'; sub_type = '1'; limit = 1000} | ConvertTo-Json",
            "$response = Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json'",
            "$latestVersion = $response.data.list | Sort-Object -Property {[int64]$_.pub_time} -Descending | Select-Object -First 1",
            "Write-Output $latestVersion.name"
        ],
        "regex": "imo windows ([\\d.]+)"
    },
    "autoupdate": {
        "url": "https://static-web.imoim.net/as/indigo-static/winapp/$version/ImoSetup_$version_Release.exe#/dl.exe"
    }
}
