<commit_before>import-module au

$releases = 'https://www.zotero.org/download'

function global:au_SearchReplace {
   @{
        ".\tools\chocolateyInstall.ps1" = @{
            "(?i)(^\s*url\s*=\s*)('.*')"          = "`$1'$($Latest.URL32)'"
            "(?i)(^\s*checksum\s*=\s*)('.*')"     = "`$1'$($Latest.Checksum32)'"
            "(?i)(^\s*packageName\s*=\s*)('.*')"  = "`$1'$($Latest.PackageName)'"
            "(?i)(^\s*fileType\s*=\s*)('.*')"     = "`$1'$($Latest.FileType)'"
        }
    }
}

function global:au_GetLatest {
    $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

    $re    = '\.exe$'
    $url   = $download_page.links | ? href -match $re | select -First 1 -expand href
    $version  = $url -split '/' | select -Last 1 -Skip 1
    @{
        Version      = $version
        URL32        = $url
    }
}

update -ChecksumFor 32<commit_msg>(zotero-standalone) Fixed update script<commit_after>import-module au

$releases = 'https://www.zotero.org/download/client/dl?channel=release&platform=win32'

function global:au_SearchReplace {
   @{
        ".\tools\chocolateyInstall.ps1" = @{
            "(?i)(^\s*url\s*=\s*)('.*')"          = "`$1'$($Latest.URL32)'"
            "(?i)(^\s*checksum\s*=\s*)('.*')"     = "`$1'$($Latest.Checksum32)'"
            "(?i)(^\s*packageName\s*=\s*)('.*')"  = "`$1'$($Latest.PackageName)'"
            "(?i)(^\s*fileType\s*=\s*)('.*')"     = "`$1'$($Latest.FileType)'"
        }
    }
}

function global:au_GetLatest {
    $url = GetRedirectedUrl -url $releases

    $version  = $url -split '/' | select -Last 1 -Skip 1
    @{
        Version      = $version
        URL32        = $url
    }
}

function GetRedirectedUrl() {
  param([string]$url)

  $req = [System.Net.WebRequest]::Create($url)
  $resp = $req.GetResponse()
  if ($resp.ResponseUri.OriginalString -eq $url) { $res = $url }
  else {
    $res = $resp.ResponseUri.OriginalString
  }

  $resp.Dispose() | Out-Null
  return $res
}

update -ChecksumFor 32
{'fraction_non_alphanumeric': 0.228643216080402, 'fraction_numerical': 0.016582914572864323, 'mean_word_length': 2.4686411149825784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '960010', 'n_tokens_mistral': 785, 'n_tokens_neox': 744, 'n_words': 107}