mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-08-12 11:01:09 +10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fde1cbe98 | ||
|
|
71a8cfdcc2 |
@@ -42,7 +42,9 @@ body .KDhLFoEqoClhH12bsfrS {
|
|||||||
/* lyrics not available message */
|
/* lyrics not available message */
|
||||||
.C3pBU1DsOUJJOAv89ZFT,
|
.C3pBU1DsOUJJOAv89ZFT,
|
||||||
.T67LFP0PElpfkkLuegQt,
|
.T67LFP0PElpfkkLuegQt,
|
||||||
.e7eFLioNSG5PAi1qVFT4 {
|
.e7eFLioNSG5PAi1qVFT4,
|
||||||
|
.l2060qoyWU4J9ihSxHLE,
|
||||||
|
.hfTlyhd7WCIk9xmP {
|
||||||
color: var(--musixmatch) !important;
|
color: var(--musixmatch) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +52,8 @@ body .KDhLFoEqoClhH12bsfrS {
|
|||||||
.FUYNhisXTCmbzt9IDxnT,
|
.FUYNhisXTCmbzt9IDxnT,
|
||||||
.tr8V5eHsUaIkOYVw7eSG,
|
.tr8V5eHsUaIkOYVw7eSG,
|
||||||
.hW9km7ku6_iggdWDR_Lg,
|
.hW9km7ku6_iggdWDR_Lg,
|
||||||
.lofIAg8Ixko3mfBrbfej {
|
.lofIAg8Ixko3mfBrbfej,
|
||||||
|
.bbJIIopLxggQmv5x {
|
||||||
--lyrics-color-active: var(--current) !important;
|
--lyrics-color-active: var(--current) !important;
|
||||||
--lyrics-color-inactive: var(--next) !important;
|
--lyrics-color-inactive: var(--next) !important;
|
||||||
--lyrics-color-passed: var(--past) !important;
|
--lyrics-color-passed: var(--past) !important;
|
||||||
@@ -69,7 +72,11 @@ body .KDhLFoEqoClhH12bsfrS {
|
|||||||
._LKG3z7SnerR0eigPCoK:hover,
|
._LKG3z7SnerR0eigPCoK:hover,
|
||||||
.NHVfxGs2HwmI_fly2JC4:hover,
|
.NHVfxGs2HwmI_fly2JC4:hover,
|
||||||
.gaHIufRWhoWbiT8S6zuM:hover,
|
.gaHIufRWhoWbiT8S6zuM:hover,
|
||||||
.FQYXZaa0aDIrse54YlYO:hover {
|
.FQYXZaa0aDIrse54YlYO:hover,
|
||||||
|
.PSyA4iign083ZV6vOqPj:hover,
|
||||||
|
.Plu0zvuRv7kOQwsQ02cC:hover,
|
||||||
|
.Mnf9PkrVHsX90BNf:hover,
|
||||||
|
.XiH9KR6bhDwEFykV:hover {
|
||||||
color: var(--hover) !important;
|
color: var(--hover) !important;
|
||||||
/* remove underline */
|
/* remove underline */
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
|
|||||||
@@ -780,6 +780,22 @@
|
|||||||
"fr": "1.2.84",
|
"fr": "1.2.84",
|
||||||
"to": ""
|
"to": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"ad_feedback_in_stream": {
|
||||||
|
"name": "enable_ad_feedback_in_stream",
|
||||||
|
"description": "Enable new ad feedback UX for in-stream ads",
|
||||||
|
"version": {
|
||||||
|
"fr": "1.2.88",
|
||||||
|
"to": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"HarmonyMediaPlaybackReporting": {
|
||||||
|
"name": "enableHarmonyMediaPlaybackReporting",
|
||||||
|
"description": "Enable the reporting of media playback events in Harmony",
|
||||||
|
"version": {
|
||||||
|
"fr": "1.2.88",
|
||||||
|
"to": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EnableExp": {
|
"EnableExp": {
|
||||||
@@ -2645,6 +2661,7 @@
|
|||||||
"replace": "min:250,max:400"
|
"replace": "min:250,max:400"
|
||||||
},
|
},
|
||||||
"filtertags_locale_fix": {
|
"filtertags_locale_fix": {
|
||||||
|
"disable": true,
|
||||||
"version": {
|
"version": {
|
||||||
"fr": "1.2.29",
|
"fr": "1.2.29",
|
||||||
"to": ""
|
"to": ""
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
param
|
param
|
||||||
(
|
(
|
||||||
[Parameter(HelpMessage = 'Latest recommended Spotify version for Windows 10+.')]
|
[Parameter(HelpMessage = 'Latest recommended Spotify version for Windows 10+.')]
|
||||||
[string]$latest_full = "1.2.86.502.g8cd7fb22",
|
[string]$latest_full = "1.2.88.483.g8aa8628e",
|
||||||
|
|
||||||
[Parameter(HelpMessage = 'Latest supported Spotify version for Windows 7-8.1')]
|
[Parameter(HelpMessage = 'Latest supported Spotify version for Windows 7-8.1')]
|
||||||
[string]$last_win7_full = "1.2.5.1006.g22820f93",
|
[string]$last_win7_full = "1.2.5.1006.g22820f93",
|
||||||
@@ -107,9 +107,6 @@ param
|
|||||||
[Parameter(HelpMessage = 'Enable right sidebar coloring to match cover color)')]
|
[Parameter(HelpMessage = 'Enable right sidebar coloring to match cover color)')]
|
||||||
[switch]$rightsidebarcolor,
|
[switch]$rightsidebarcolor,
|
||||||
|
|
||||||
[Parameter(HelpMessage = 'Returns old lyrics')]
|
|
||||||
[switch]$old_lyrics,
|
|
||||||
|
|
||||||
[Parameter(HelpMessage = 'Disable native lyrics')]
|
[Parameter(HelpMessage = 'Disable native lyrics')]
|
||||||
[switch]$lyrics_block,
|
[switch]$lyrics_block,
|
||||||
|
|
||||||
@@ -137,7 +134,11 @@ param
|
|||||||
|
|
||||||
[Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')]
|
[Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')]
|
||||||
[Alias('l')]
|
[Alias('l')]
|
||||||
[string]$language
|
[string]$language,
|
||||||
|
|
||||||
|
# Deprecated parameters
|
||||||
|
[Parameter(HelpMessage = 'Deprecated, old lyrics are enabled by default')]
|
||||||
|
[switch]$old_lyrics
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ignore errors from `Stop-Process`
|
# Ignore errors from `Stop-Process`
|
||||||
@@ -405,6 +406,15 @@ $lang = CallLang -clg $langCode
|
|||||||
Write-Host ($lang).Welcome
|
Write-Host ($lang).Welcome
|
||||||
Write-Host
|
Write-Host
|
||||||
|
|
||||||
|
if ($old_lyrics) {
|
||||||
|
Write-Warning @"
|
||||||
|
-old_lyrics is deprecated
|
||||||
|
Old lyrics are enabled by default
|
||||||
|
Remove this parameter from your command line
|
||||||
|
"@
|
||||||
|
Write-Host
|
||||||
|
}
|
||||||
|
|
||||||
# Check version Windows
|
# Check version Windows
|
||||||
$os = Get-CimInstance -ClassName "Win32_OperatingSystem" -ErrorAction SilentlyContinue
|
$os = Get-CimInstance -ClassName "Win32_OperatingSystem" -ErrorAction SilentlyContinue
|
||||||
if ($os) {
|
if ($os) {
|
||||||
@@ -479,6 +489,7 @@ function Get-SpotifyInstallerArchitecture {
|
|||||||
|
|
||||||
$spotifyDownloadBaseUrl = "https://loadspot.amd64fox1.workers.dev/download"
|
$spotifyDownloadBaseUrl = "https://loadspot.amd64fox1.workers.dev/download"
|
||||||
$spotifyTemporaryDownloadBaseUrl = "https://loadspot.amd64fox1.workers.dev/temporary-download"
|
$spotifyTemporaryDownloadBaseUrl = "https://loadspot.amd64fox1.workers.dev/temporary-download"
|
||||||
|
$spotifyTemporaryDownloadVersion = "1.2.86.502.g8cd7fb22"
|
||||||
$systemArchitecture = Get-SystemArchitecture
|
$systemArchitecture = Get-SystemArchitecture
|
||||||
|
|
||||||
$match_v = "^(?<version>\d+\.\d+\.\d+\.\d+\.g[0-9a-f]{8})(?:-\d+)?$"
|
$match_v = "^(?<version>\d+\.\d+\.\d+\.\d+\.g[0-9a-f]{8})(?:-\d+)?$"
|
||||||
@@ -587,7 +598,8 @@ function Get-PatchesJson {
|
|||||||
throw "File not found: $resolvedPath"
|
throw "File not found: $resolvedPath"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ("Using local patches.json: {0}" -f $resolvedPath)
|
Write-Host ("Using a local file for patches: {0}" -f $resolvedPath)
|
||||||
|
Write-Host
|
||||||
|
|
||||||
$jsonContent = [System.IO.File]::ReadAllText($resolvedPath, [System.Text.Encoding]::UTF8)
|
$jsonContent = [System.IO.File]::ReadAllText($resolvedPath, [System.Text.Encoding]::UTF8)
|
||||||
return $jsonContent | ConvertFrom-Json -ErrorAction Stop
|
return $jsonContent | ConvertFrom-Json -ErrorAction Stop
|
||||||
@@ -1234,8 +1246,7 @@ function downloadSp([string]$DownloadFolder) {
|
|||||||
-LastX86SupportedVersion $last_x86
|
-LastX86SupportedVersion $last_x86
|
||||||
|
|
||||||
$downloadBaseUrl = $spotifyDownloadBaseUrl
|
$downloadBaseUrl = $spotifyDownloadBaseUrl
|
||||||
if ($onlineFull -eq $latest_full -and $arch -eq 'x64') {
|
if ($onlineFull -eq $spotifyTemporaryDownloadVersion -and $arch -eq 'x64') {
|
||||||
# Temporary route for the latest x64 build while Cloudflare rechecks the file
|
|
||||||
$downloadBaseUrl = $spotifyTemporaryDownloadBaseUrl
|
$downloadBaseUrl = $spotifyTemporaryDownloadBaseUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1850,6 +1861,11 @@ function Helper($paramname) {
|
|||||||
|
|
||||||
if ([version]$offline -ge [version]'1.2.41.434' -and $lyrics_block) { Move-Json -n 'Lyrics' -t $Enable -f $Disable }
|
if ([version]$offline -ge [version]'1.2.41.434' -and $lyrics_block) { Move-Json -n 'Lyrics' -t $Enable -f $Disable }
|
||||||
|
|
||||||
|
Remove-Json -j $Enable -p 'RightSidebarLyrics'
|
||||||
|
if ($Custom.PSObject.Properties.Name -contains 'LyricsVariationsInNPV') {
|
||||||
|
$Custom.LyricsVariationsInNPV.value = "CONTROL"
|
||||||
|
}
|
||||||
|
|
||||||
if ([version]$offline -eq [version]'1.2.30.1135') { Move-Json -n 'QueueOnRightPanel' -t $Enable -f $Disable }
|
if ([version]$offline -eq [version]'1.2.30.1135') { Move-Json -n 'QueueOnRightPanel' -t $Enable -f $Disable }
|
||||||
|
|
||||||
if ([version]$offline -le [version]'1.2.50.335') {
|
if ([version]$offline -le [version]'1.2.50.335') {
|
||||||
@@ -1896,11 +1912,6 @@ function Helper($paramname) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!($rightsidebarcolor)) { Remove-Json -j $Enable -p 'RightSidebarColors' }
|
if (!($rightsidebarcolor)) { Remove-Json -j $Enable -p 'RightSidebarColors' }
|
||||||
|
|
||||||
if ($old_lyrics) {
|
|
||||||
Remove-Json -j $Enable -p 'RightSidebarLyrics'
|
|
||||||
$Custom.LyricsVariationsInNPV.value = "CONTROL"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$premium) { Remove-Json -j $Enable -p 'RemoteDownloads', 'Magpie', 'MagpiePrompting', 'MagpieScheduling', 'MagpieCuration' }
|
if (!$premium) { Remove-Json -j $Enable -p 'RemoteDownloads', 'Magpie', 'MagpiePrompting', 'MagpieScheduling', 'MagpieCuration' }
|
||||||
@@ -1910,7 +1921,7 @@ function Helper($paramname) {
|
|||||||
$objects = @(
|
$objects = @(
|
||||||
@{
|
@{
|
||||||
Object = $webjson.others.CustomExp.psobject.properties
|
Object = $webjson.others.CustomExp.psobject.properties
|
||||||
PropertiesToKeep = @('LyricsUpsell')
|
PropertiesToKeep = @('LyricsUpsell', 'LyricsVariationsInNPV')
|
||||||
},
|
},
|
||||||
@{
|
@{
|
||||||
Object = $webjson.others.EnableExp.psobject.properties
|
Object = $webjson.others.EnableExp.psobject.properties
|
||||||
@@ -2099,6 +2110,10 @@ function Helper($paramname) {
|
|||||||
|
|
||||||
$contents | foreach {
|
$contents | foreach {
|
||||||
|
|
||||||
|
if ($json.$PSItem.disable -eq $true) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if ( $json.$PSItem.version.to ) { $to = [version]$json.$PSItem.version.to -ge [version]$offline_patch } else { $to = $true }
|
if ( $json.$PSItem.version.to ) { $to = [version]$json.$PSItem.version.to -ge [version]$offline_patch } else { $to = $true }
|
||||||
if ( $json.$PSItem.version.fr ) { $fr = [version]$json.$PSItem.version.fr -le [version]$offline_patch } else { $fr = $false }
|
if ( $json.$PSItem.version.fr ) { $fr = [version]$json.$PSItem.version.fr -le [version]$offline_patch } else { $fr = $false }
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
set "script_name=DL_Diag.ps1"
|
|
||||||
set "branch_name=dl-diag-scripts"
|
|
||||||
set "script_dir=%~dp0"
|
|
||||||
set "local_script=%script_dir%%script_name%"
|
|
||||||
set "branch_url=https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/%branch_name%/scripts/%script_name%"
|
|
||||||
set "main_url=https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/scripts/%script_name%"
|
|
||||||
set "temp_script=%TEMP%\SpotX-%script_name%"
|
|
||||||
set "ps=%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe"
|
|
||||||
|
|
||||||
if exist "%local_script%" (
|
|
||||||
%ps% -NoProfile -ExecutionPolicy Bypass -File "%local_script%"
|
|
||||||
) else (
|
|
||||||
%ps% -NoProfile -ExecutionPolicy Bypass ^
|
|
||||||
-Command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $out='%temp_script%'; $urls=@('%branch_url%','%main_url%'); $downloaded=$false; foreach ($url in $urls) { try { Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $out -ErrorAction Stop; $downloaded=$true; break } catch {} }; if (-not $downloaded) { throw 'Failed to download diagnostic script' }; & $out"
|
|
||||||
)
|
|
||||||
|
|
||||||
pause
|
|
||||||
endlocal
|
|
||||||
exit /b
|
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
$rawScriptUrl = 'https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/run.ps1'
|
|
||||||
$mirrorScriptUrl = 'https://spotx-official.github.io/SpotX/run.ps1'
|
|
||||||
$downloadHost = 'loadspot.amd64fox1.workers.dev'
|
|
||||||
$defaultLatestFull = '1.2.86.502.g8cd7fb22'
|
|
||||||
$stableFull = '1.2.13.661.ga588f749'
|
|
||||||
|
|
||||||
$reportLines = New-Object 'System.Collections.Generic.List[string]'
|
|
||||||
$sensitivePatterns = New-Object 'System.Collections.Generic.List[object]'
|
|
||||||
|
|
||||||
function Add-SensitivePattern {
|
|
||||||
param(
|
|
||||||
[string]$Pattern,
|
|
||||||
[string]$Replacement = '[redacted]'
|
|
||||||
)
|
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($Pattern)) {
|
|
||||||
$script:sensitivePatterns.Add([PSCustomObject]@{
|
|
||||||
Pattern = $Pattern
|
|
||||||
Replacement = $Replacement
|
|
||||||
}) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Protect-DiagnosticText {
|
|
||||||
param(
|
|
||||||
[AllowNull()]
|
|
||||||
[string]$Text
|
|
||||||
)
|
|
||||||
|
|
||||||
if ($null -eq $Text) {
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = [string]$Text
|
|
||||||
|
|
||||||
foreach ($item in $script:sensitivePatterns) {
|
|
||||||
$value = [regex]::Replace($value, $item.Pattern, $item.Replacement)
|
|
||||||
}
|
|
||||||
|
|
||||||
$value
|
|
||||||
}
|
|
||||||
|
|
||||||
function Add-ReportLine {
|
|
||||||
param(
|
|
||||||
[AllowEmptyString()]
|
|
||||||
[string]$Line = ''
|
|
||||||
)
|
|
||||||
|
|
||||||
[void]$script:reportLines.Add((Protect-DiagnosticText -Text $Line))
|
|
||||||
}
|
|
||||||
|
|
||||||
function Add-ReportSection {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Title
|
|
||||||
)
|
|
||||||
|
|
||||||
if ($script:reportLines.Count -gt 0) {
|
|
||||||
Add-ReportLine
|
|
||||||
}
|
|
||||||
|
|
||||||
Add-ReportLine ("== {0} ==" -f $Title)
|
|
||||||
}
|
|
||||||
|
|
||||||
function Add-CommandOutput {
|
|
||||||
param(
|
|
||||||
[string[]]$Lines
|
|
||||||
)
|
|
||||||
|
|
||||||
foreach ($line in $Lines) {
|
|
||||||
Add-ReportLine ([string]$line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-WebRequestCompat {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Uri
|
|
||||||
)
|
|
||||||
|
|
||||||
$params = @{
|
|
||||||
Uri = $Uri
|
|
||||||
ErrorAction = 'Stop'
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 6) {
|
|
||||||
$params.UseBasicParsing = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-WebRequest @params
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-WebClientStep {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Title,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Uri
|
|
||||||
)
|
|
||||||
|
|
||||||
Invoke-PowerShellStep -Title $Title -Action {
|
|
||||||
$wc = New-Object System.Net.WebClient
|
|
||||||
$stream = $null
|
|
||||||
|
|
||||||
try {
|
|
||||||
$stream = $wc.OpenRead($Uri)
|
|
||||||
$buffer = New-Object byte[] 1
|
|
||||||
[void]$stream.Read($buffer, 0, 1)
|
|
||||||
|
|
||||||
$lines = New-Object 'System.Collections.Generic.List[string]'
|
|
||||||
$lines.Add('WEBCLIENT_OK') | Out-Null
|
|
||||||
$lines.Add(("Url: {0}" -f $Uri)) | Out-Null
|
|
||||||
|
|
||||||
if ($wc.ResponseHeaders) {
|
|
||||||
foreach ($headerName in $wc.ResponseHeaders.AllKeys) {
|
|
||||||
$lines.Add(("{0}: {1}" -f $headerName, $wc.ResponseHeaders[$headerName])) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$lines
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if ($stream) {
|
|
||||||
$stream.Dispose()
|
|
||||||
}
|
|
||||||
|
|
||||||
$wc.Dispose()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Copy-TextToClipboard {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Text
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (Get-Command Set-Clipboard -ErrorAction SilentlyContinue) {
|
|
||||||
Set-Clipboard -Value $Text -ErrorAction Stop
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Get-Command clip.exe -ErrorAction SilentlyContinue) {
|
|
||||||
$Text | clip.exe
|
|
||||||
return ($LASTEXITCODE -eq 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-DiagnosticArchitecture {
|
|
||||||
$arch = $env:PROCESSOR_ARCHITEW6432
|
|
||||||
if ([string]::IsNullOrWhiteSpace($arch)) {
|
|
||||||
$arch = $env:PROCESSOR_ARCHITECTURE
|
|
||||||
}
|
|
||||||
|
|
||||||
switch -Regex ($arch) {
|
|
||||||
'ARM64' { return 'arm64' }
|
|
||||||
'64' { return 'x64' }
|
|
||||||
default { return 'x86' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($env:COMPUTERNAME)) {
|
|
||||||
Add-SensitivePattern -Pattern ([regex]::Escape($env:COMPUTERNAME)) -Replacement '[redacted-host]'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($env:USERNAME)) {
|
|
||||||
Add-SensitivePattern -Pattern ([regex]::Escape($env:USERNAME)) -Replacement '[redacted-user]'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($env:USERPROFILE)) {
|
|
||||||
Add-SensitivePattern -Pattern ([regex]::Escape($env:USERPROFILE)) -Replacement '[redacted-profile]'
|
|
||||||
}
|
|
||||||
|
|
||||||
Add-SensitivePattern -Pattern '(?<![\d.])(?:\d{1,3}\.){3}\d{1,3}(?![\d.])' -Replacement '[redacted-ipv4]'
|
|
||||||
Add-SensitivePattern -Pattern '(?i)(?<![0-9a-f:])((?:[0-9a-f]{1,4}:){7}[0-9a-f]{1,4}|(?:[0-9a-f]{1,4}:){1,7}:|(?:[0-9a-f]{1,4}:){1,6}:[0-9a-f]{1,4}|(?:[0-9a-f]{1,4}:){1,5}(?::[0-9a-f]{1,4}){1,2}|(?:[0-9a-f]{1,4}:){1,4}(?::[0-9a-f]{1,4}){1,3}|(?:[0-9a-f]{1,4}:){1,3}(?::[0-9a-f]{1,4}){1,4}|(?:[0-9a-f]{1,4}:){1,2}(?::[0-9a-f]{1,4}){1,5}|[0-9a-f]{1,4}:(?:(?::[0-9a-f]{1,4}){1,6})|:(?:(?::[0-9a-f]{1,4}){1,7}|:))(?![0-9a-f:])' -Replacement '[redacted-ipv6]'
|
|
||||||
|
|
||||||
function Format-ExceptionDetails {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[System.Exception]$Exception
|
|
||||||
)
|
|
||||||
|
|
||||||
$details = New-Object 'System.Collections.Generic.List[string]'
|
|
||||||
$current = $Exception
|
|
||||||
|
|
||||||
while ($null -ne $current) {
|
|
||||||
[void]$details.Add($current.Message)
|
|
||||||
$current = $current.InnerException
|
|
||||||
}
|
|
||||||
|
|
||||||
$details
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-CurlStep {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Title,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string[]]$Arguments
|
|
||||||
)
|
|
||||||
|
|
||||||
Add-ReportSection -Title $Title
|
|
||||||
|
|
||||||
if (-not (Get-Command curl.exe -ErrorAction SilentlyContinue)) {
|
|
||||||
Add-ReportLine 'curl.exe not found'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$output = & curl.exe '-sS' @Arguments 2>&1
|
|
||||||
Add-CommandOutput -Lines ($output | ForEach-Object { [string]$_ })
|
|
||||||
Add-ReportLine ("ExitCode: {0}" -f $LASTEXITCODE)
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Add-CommandOutput -Lines (Format-ExceptionDetails -Exception $_.Exception)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-PowerShellStep {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Title,
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[scriptblock]$Action
|
|
||||||
)
|
|
||||||
|
|
||||||
Add-ReportSection -Title $Title
|
|
||||||
|
|
||||||
try {
|
|
||||||
$result = & $Action
|
|
||||||
|
|
||||||
if ($null -eq $result) {
|
|
||||||
Add-ReportLine
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result -is [System.Array]) {
|
|
||||||
Add-CommandOutput -Lines ($result | ForEach-Object { [string]$_ })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Add-ReportLine ([string]$result)
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Add-CommandOutput -Lines (Format-ExceptionDetails -Exception $_.Exception)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$architecture = Get-DiagnosticArchitecture
|
|
||||||
$latestFull = $defaultLatestFull
|
|
||||||
$bootstrapResults = New-Object 'System.Collections.Generic.List[object]'
|
|
||||||
|
|
||||||
foreach ($source in @(
|
|
||||||
[PSCustomObject]@{ Name = 'raw'; Url = $rawScriptUrl },
|
|
||||||
[PSCustomObject]@{ Name = 'mirror'; Url = $mirrorScriptUrl }
|
|
||||||
)) {
|
|
||||||
try {
|
|
||||||
$response = Invoke-WebRequestCompat -Uri $source.Url
|
|
||||||
$content = [string]$response.Content
|
|
||||||
|
|
||||||
if ($latestFull -eq $defaultLatestFull) {
|
|
||||||
$match = [regex]::Match($content, '\[string\]\$latest_full\s*=\s*"([^"]+)"')
|
|
||||||
if ($match.Success) {
|
|
||||||
$latestFull = $match.Groups[1].Value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$bootstrapResults.Add([PSCustomObject]@{
|
|
||||||
Name = $source.Name
|
|
||||||
Url = $source.Url
|
|
||||||
Success = $true
|
|
||||||
StatusCode = [int]$response.StatusCode
|
|
||||||
Length = $content.Length
|
|
||||||
}) | Out-Null
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
$bootstrapResults.Add([PSCustomObject]@{
|
|
||||||
Name = $source.Name
|
|
||||||
Url = $source.Url
|
|
||||||
Success = $false
|
|
||||||
StatusCode = $null
|
|
||||||
Length = $null
|
|
||||||
Error = $_.Exception.Message
|
|
||||||
}) | Out-Null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$tempUrl = if ($architecture -eq 'x64') {
|
|
||||||
'https://{0}/temporary-download/spotify_installer-{1}-x64.exe' -f $downloadHost, $latestFull
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$null
|
|
||||||
}
|
|
||||||
|
|
||||||
$directUrl = 'https://{0}/download/spotify_installer-{1}-{2}.exe' -f $downloadHost, $stableFull, $architecture
|
|
||||||
|
|
||||||
Add-ReportSection -Title 'Environment'
|
|
||||||
Add-ReportLine ("Date: {0}" -f (Get-Date).ToString('yyyy-MM-dd HH:mm:ss zzz'))
|
|
||||||
Add-ReportLine ("PowerShell: {0}" -f $PSVersionTable.PSVersion)
|
|
||||||
Add-ReportLine ("Architecture: {0}" -f $architecture)
|
|
||||||
Add-ReportLine ("LatestFull: {0}" -f $latestFull)
|
|
||||||
Add-ReportLine ("StableFull: {0}" -f $stableFull)
|
|
||||||
Add-ReportLine ("TempUrl: {0}" -f $(if ($tempUrl) { $tempUrl } else { 'skipped for non-x64 system' }))
|
|
||||||
Add-ReportLine ("DirectUrl: {0}" -f $directUrl)
|
|
||||||
|
|
||||||
Add-ReportSection -Title 'Bootstrap check'
|
|
||||||
foreach ($item in $bootstrapResults) {
|
|
||||||
Add-ReportLine ("Source: {0}" -f $item.Name)
|
|
||||||
Add-ReportLine ("Url: {0}" -f $item.Url)
|
|
||||||
Add-ReportLine ("Success: {0}" -f $item.Success)
|
|
||||||
|
|
||||||
if ($item.Success) {
|
|
||||||
Add-ReportLine ("StatusCode: {0}" -f $item.StatusCode)
|
|
||||||
Add-ReportLine ("ContentLength: {0}" -f $item.Length)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Add-ReportLine ("Error: {0}" -f $item.Error)
|
|
||||||
}
|
|
||||||
|
|
||||||
Add-ReportLine
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-CurlStep -Title 'curl version' -Arguments @('-V')
|
|
||||||
|
|
||||||
Invoke-PowerShellStep -Title 'DNS' -Action {
|
|
||||||
Resolve-DnsName $downloadHost | Format-Table -AutoSize | Out-String -Width 4096
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tempUrl) {
|
|
||||||
Invoke-CurlStep -Title 'HEAD temp' -Arguments @('-I', '-L', '-k', '--ssl-no-revoke', $tempUrl)
|
|
||||||
Invoke-CurlStep -Title '1MB temp' -Arguments @('-L', '-k', '--ssl-no-revoke', '--fail-with-body', '--connect-timeout', '15', '-r', '0-1048575', '-o', 'NUL', '-D', '-', '-w', "`nHTTP_STATUS:%{http_code}`n", $tempUrl)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Add-ReportSection -Title 'HEAD temp'
|
|
||||||
Add-ReportLine 'Skipped because temporary route is only used for x64 latest build'
|
|
||||||
|
|
||||||
Add-ReportSection -Title '1MB temp'
|
|
||||||
Add-ReportLine 'Skipped because temporary route is only used for x64 latest build'
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-CurlStep -Title 'HEAD direct stable' -Arguments @('-I', '-L', '-k', '--ssl-no-revoke', $directUrl)
|
|
||||||
Invoke-CurlStep -Title '1MB direct stable' -Arguments @('-L', '-k', '--ssl-no-revoke', '--fail-with-body', '--connect-timeout', '15', '-r', '0-1048575', '-o', 'NUL', '-D', '-', '-w', "`nHTTP_STATUS:%{http_code}`n", $directUrl)
|
|
||||||
|
|
||||||
if ($tempUrl) {
|
|
||||||
Invoke-WebClientStep -Title 'WebClient temp' -Uri $tempUrl
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Add-ReportSection -Title 'WebClient temp'
|
|
||||||
Add-ReportLine 'Skipped because temporary route is only used for x64 latest build'
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-WebClientStep -Title 'WebClient direct stable' -Uri $directUrl
|
|
||||||
|
|
||||||
$finalOutputLines = New-Object 'System.Collections.Generic.List[string]'
|
|
||||||
$finalOutputLines.Add('----- BEGIN DIAGNOSTICS -----') | Out-Null
|
|
||||||
|
|
||||||
foreach ($line in $reportLines) {
|
|
||||||
$finalOutputLines.Add($line) | Out-Null
|
|
||||||
}
|
|
||||||
|
|
||||||
$finalOutputLines.Add('----- END DIAGNOSTICS -----') | Out-Null
|
|
||||||
$finalOutputText = [string]::Join([Environment]::NewLine, $finalOutputLines)
|
|
||||||
$clipboardCopied = Copy-TextToClipboard -Text $finalOutputText
|
|
||||||
|
|
||||||
Write-Host
|
|
||||||
Write-Host '----- BEGIN DIAGNOSTICS -----' -ForegroundColor Cyan
|
|
||||||
|
|
||||||
foreach ($line in $reportLines) {
|
|
||||||
Write-Output $line
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host '----- END DIAGNOSTICS -----' -ForegroundColor Cyan
|
|
||||||
|
|
||||||
if ($clipboardCopied) {
|
|
||||||
Write-Host
|
|
||||||
Write-Host 'Diagnostics copied to clipboard' -ForegroundColor Green
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host
|
|
||||||
Write-Host 'Clipboard copy failed, copy the text above manually' -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user