{
    "version": "130.0.5847.108",
    "description": "Opera GX is a special version of the Opera browser built specifically for gamers.",
    "homepage": "https://www.opera.com/gx",
    "license": {
        "identifier": "Freeware",
        "url": "https://www.opera.com/eula/computers"
    },
    "architecture": {
        "64bit": {
            "url": "https://get.opera.com/pub/opera_gx/130.0.5847.108/win/Opera_GX_130.0.5847.108_Setup_x64.exe",
            "hash": "12cfcc8279ddbc085688e9d823bd2dc75910c4d7543d9fe0778bb3da9064c296"
        },
        "32bit": {
            "url": "https://get.opera.com/pub/opera_gx/130.0.5847.108/win/Opera_GX_130.0.5847.108_Setup.exe",
            "hash": "e06d6d4043253848d67938c0536631f5d1c65ccc6c1a2cc982323653079d021a"
        }
    },
    "installer": {
        "script": [
            "$version, 'autoupdate' | ForEach-Object { ensure \"$dir\\$_\" | Out-Null }",
            "Expand-7zipArchive -Path \"$dir\\$fname\" -Switches '-x!*_list -xr!unins*' -Removal",
            "Move-Item -Path \"$dir\\opera_autoupdate*\" -Destination \"$dir\\autoupdate\" -Force",
            "$exclude_list = @('Assets', $version, 'autoupdate', 'Resources.pri', 'opera.visualelementsmanifest.xml')",
            "Move-Item -Path \"$dir\\*\" -Destination \"$dir\\$version\" -Exclude $exclude_list -Force -ErrorAction SilentlyContinue",
            "Copy-Item -Path \"$dir\\$version\\opera.exe\" -Destination $dir -Force",
            "$cfg = @{ 'autoupdate' = $false; 'enable_stats' = $false; 'single_profile' = $true } | ConvertTo-Json -Depth 5 -Compress",
            "Set-Content -Path \"$dir\\installer_prefs.json\" -Value $cfg -NoNewline -Encoding utf8"
        ]
    },
    "shortcuts": [
        [
            "opera.exe",
            "Opera GX"
        ]
    ],
    "persist": "profile",
    "checkver": {
        "script": [
            "$path_regex = '^(?!\\.)[\\d.]+/$'",
            "$version_sort = { [version]$_.href.TrimEnd('/') }",
            "$releases_url = 'https://get.opera.com/pub/opera_gx/'",
            "$releases_page = Invoke-WebRequest -Uri $releases_url -UseBasicParsing -ErrorAction Stop",
            "$path_segments = $releases_page.links | Where-Object { $_.href -match $path_regex } |",
            "        Sort-Object -Property $version_sort -Descending | ForEach-Object -MemberName href",
            "foreach ($path_segment in $path_segments.TrimEnd('/')) {",
            "    $release_url = 'https://get.opera.com/pub/opera_gx/{0}/win/' -f $path_segment",
            "    $download_page = Invoke-WebRequest -Uri $release_url -UseBasicParsing -ErrorAction Stop",
            "    $installer_name = $download_page.Links | Where-Object { $_.href -match '(?<=Setup\\w+)\\.exe$' } |",
            "            Select-Object -ExpandProperty href -First 1",
            "    if ($null -ne $installer_name) { Write-Output $installer_name; break }",
            "}"
        ],
        "regex": "Opera_GX_([\\d.]+)_Setup"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://get.opera.com/pub/opera_gx/$version/win/Opera_GX_$version_Setup_x64.exe"
            },
            "32bit": {
                "url": "https://get.opera.com/pub/opera_gx/$version/win/Opera_GX_$version_Setup.exe"
            }
        },
        "hash": {
            "url": "$url.sha256sum"
        }
    }
}
