Skip to content

Commit

Permalink
Merge pull request #2405 from TheCakeIsNaOH/vscode-insiders
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm authored Jan 19, 2024
2 parents 34cd7c2 + 89a59ce commit 4567a08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
3 changes: 0 additions & 3 deletions automatic/vscode-insiders.install/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ function Get-MergeTasks {
$packageArgs = @{
packageName = "$env:ChocolateyPackageName"
fileType = 'exe'
url = 'https://az764295.vo.msecnd.net/insider/02d3b49d8035a9b30db3b0ae706796af9b1a4260/VSCodeSetup-ia32-1.81.0-insider.exe'
url64bit = 'https://az764295.vo.msecnd.net/insider/02d3b49d8035a9b30db3b0ae706796af9b1a4260/VSCodeSetup-x64-1.81.0-insider.exe'

softwareName = 'Microsoft Visual Studio Code Insiders'

checksum = 'cba008c12f5e66b97542bcb43d95c52b3a8057e142a06d7afff727302c774f26f637677e595e7ba5b8dd0f41f779eb5d69228a1b712c003ae7512e2df3498e65'
checksumType = 'sha512'
checksum64 = '173026bd10cb004ee2cbd14e3a5808bb5aeff14da7513b95480a8c2b75e47f9de517a34f624c4d5a3e4f070d99501a7598ab7f0ecae9a277f815686d52df7096'
checksumType64 = 'sha512'

Expand Down
26 changes: 8 additions & 18 deletions automatic/vscode-insiders.install/update.ps1
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
import-module au
import-module "$PSScriptRoot\..\..\extensions\chocolatey-core.extension\extensions\chocolatey-core.psm1"

$releases32 = 'https://update.code.visualstudio.com/api/update/win32/insider/VERSION'
$releases64 = 'https://update.code.visualstudio.com/api/update/win32-x64/insider/VERSION'
$releases64 = 'https://update.code.visualstudio.com/api/update/win32-x64/insider/0000000000000000000000000000000000000000'

if ($MyInvocation.InvocationName -ne '.') {
function global:au_BeforeUpdate {
$Latest.Checksum32 = Get-RemoteChecksum $Latest.URL32 -Algorithm $Latest.ChecksumType
$Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $Latest.ChecksumType
$Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $Latest.ChecksumType64
}
}

function global:au_SearchReplace {
@{
'tools\chocolateyInstall.ps1' = @{
"(?i)(^\s*url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'"
"(?i)(^\s*url64bit\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'"
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
"(?i)(^\s*checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'"
"(?i)(^\s*checksumType(64)?\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType)'"
"(?i)(^\s*checksumType64\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType64)'"
}
}
}

function global:au_GetLatest {
$json32 = Invoke-WebRequest -UseBasicParsing -Uri $releases32 | ConvertFrom-Json
$json64 = Invoke-WebRequest -UseBasicParsing -Uri $releases64 | ConvertFrom-Json

if ($json32.productVersion -ne $json64.productVersion) {
throw "Different versions for 32-Bit and 64-Bit detected."
}

# Strip `-insider`
$version = $($($json32.productVersion).split('-insider')[0])
$version = $($($json64.productVersion).split('-insider')[0])
# Get date from timestamp
$date = $(Get-Date -Format "yyyyMMdd" $(Get-Date 01.01.1970).AddMilliseconds($json32.timestamp))
$date = $(Get-Date -Format "yyyyMMdd" $(Get-Date 01.01.1970).AddMilliseconds($json64.timestamp))

@{
Version = "$version.$date"
URL32 = $json32.Url
URL64 = $json64.Url
ChecksumType = 'sha512'
Version = "$version.$date"
URL64 = $json64.Url
ChecksumType64 = 'sha512'
}
}

Expand Down

0 comments on commit 4567a08

Please sign in to comment.