Don't Skip

pull/232/head
KnifMelti 2022-11-05 20:52:51 +01:00
parent 711ba26db5
commit 7039fa97a2
2 changed files with 4 additions and 5 deletions

View File

@ -91,10 +91,9 @@ Get Black/White List from Path (URL/UNC/Local) (download/copy to Winget-AutoUpda
**-ModsPath** **-ModsPath**
Get Mods from Path (URL/UNC/Local) (download/copy to `mods` in Winget-AutoUpdate installation location if external mods is newer). Get Mods from Path (URL/UNC/Local) (download/copy to `mods` in Winget-AutoUpdate installation location if external mods is newer).
For URL: This requires a site directory with `Options +Indexes` in `.htaccess` and no index page overriding the listing of files. For URL: This requires a site directory with `Options +Indexes` in `.htaccess` and no index page overriding the listing of files.
Or an index page with href listings of all the Mods to be downloaded (with a first link to skip, emulating a directory list): Or an index page with href listings of all the Mods to be downloaded:
``` ```
<ul> <ul>
<li><a href="/wau/"> Parent Directory</a></li>
<li><a href="Adobe.Acrobat.Reader.32-bit-install.ps1"> Adobe.Acrobat.Reader.32-bit-install.ps1</a></li> <li><a href="Adobe.Acrobat.Reader.32-bit-install.ps1"> Adobe.Acrobat.Reader.32-bit-install.ps1</a></li>
<li><a href="Notepad++.Notepad++-install.ps1"> Notepad++.Notepad++-install.ps1</a></li> <li><a href="Notepad++.Notepad++-install.ps1"> Notepad++.Notepad++-install.ps1</a></li>
<li><a href="Notepad++.Notepad++-uninstall.ps1"> Notepad++.Notepad++-uninstall.ps1</a></li> <li><a href="Notepad++.Notepad++-uninstall.ps1"> Notepad++.Notepad++-uninstall.ps1</a></li>

View File

@ -23,8 +23,8 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
return $False return $False
} }
# Get the list of links, skip the first one ("../") if listing is allowed # Collect the external list of href links
$ModLinks = $WebResponse.Links | Select-Object -ExpandProperty href -Skip 1 $ModLinks = $WebResponse.Links | Select-Object -ExpandProperty href
#Delete Local Mods that doesn't exist Externally #Delete Local Mods that doesn't exist Externally
foreach ($Mod in $InternalModsNames) { foreach ($Mod in $InternalModsNames) {
If ($Mod -notin $ModLinks) { If ($Mod -notin $ModLinks) {
@ -34,7 +34,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
} }
#Loop through all links #Loop through all links
$WebResponse.Links | Select-Object -ExpandProperty href -Skip 1 | ForEach-Object { $WebResponse.Links | Select-Object -ExpandProperty href | ForEach-Object {
#Check for .ps1 in listing/HREF:s in an index page pointing to .ps1 #Check for .ps1 in listing/HREF:s in an index page pointing to .ps1
if ($_ -like "*.ps1") { if ($_ -like "*.ps1") {
try { try {