Skip to content

Commit 4054195

Browse files
committed
Fallback server for SDK zip archives
1 parent 247c414 commit 4054195

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

misc/ScriptHook.ps1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,24 @@ if (Test-Path -PathType Container $SHOOK_DIR) {
4646
}
4747
}
4848

49+
try {
50+
$HEADERS = @{
51+
"Referer" = ($DOMAIN + $LINK);
52+
"User-Agent" = "RL/1.0"
53+
}
54+
55+
$RESP = Invoke-WebRequest -URI ($DOMAIN + $LINK)
56+
} catch {
57+
Write-Warning "Failed to download SDK from the AB's site, falling back to own server..."
58+
$HEADERS = @{
59+
"User-Agent" = "RL/1.0"
60+
}
4961

50-
$HEADERS = @{
51-
"Referer" = ($DOMAIN + $LINK);
52-
"User-Agent" = "RL/1.0"
62+
$DOMAIN = "https://igvx.ru"
63+
$RESP = Invoke-WebRequest -URI ($DOMAIN + "/shsdk/")
5364
}
5465

55-
Foreach($elem in (Invoke-WebRequest -URI ($DOMAIN + $LINK)).Links.Href) {
66+
Foreach($elem in ($RESP).Links.Href) {
5667
if ($elem.IndexOf("ScriptHook$($VARIANT)_SDK") -ige 0) {
5768
$outFile = "$SCR_DIR/temp.zip";
5869
Invoke-WebRequest -Uri ($DOMAIN + $elem) -OutFile $outFile -Headers $HEADERS

0 commit comments

Comments
 (0)