1- # Requires -RunAsAdministrator
1+ # Requires -RunAsAdministrator
22#
3- # File Browser Installer Script
3+ # File Browser Installer Script
44#
55# GitHub: https://github.com/filebrowser/filebrowser
66# Issues: https://github.com/filebrowser/filebrowser/issues
99#
1010# iwr -useb https://raw.githubusercontent.com/filebrowser/get/master/get.ps1 | iex
1111#
12- # You should run it as administrator so it can add filemanager to
12+ # You should run it as administrator so it can add filemanager to
1313# the PATH.
1414#
1515function Install-FileManager {
@@ -24,14 +24,21 @@ function Install-FileManager {
2424 }
2525
2626 $file = " windows-$arch -filebrowser.zip"
27- $url = " https://github.com/filebrowser/filebrowser/releases/download/$tag /$file "
27+
28+ # Support env.RELEASE_MIRROR such as `https://gh.api.99988866.xyz/https://github.com`
29+ $release_base = " https://github.com"
30+ if ($env: RELEASE_MIRROR ) {
31+ $release_base = $env: RELEASE_MIRROR
32+ }
33+ $url = " $release_base /filebrowser/filebrowser/releases/download/$tag /$file "
34+
2835 $temp = New-TemporaryFile
2936 $folder = " ${env: ProgramFiles} \filebrowser"
3037
3138 Write-Host " Downloading" $url
32- $WebClient = New-Object System.Net.WebClient
33- $WebClient.DownloadFile ( $url , $temp )
34-
39+ $WebClient = New-Object System.Net.WebClient
40+ $WebClient.DownloadFile ( $url , $temp )
41+
3542 Write-Host " Extracting $temp .zip"
3643 Move-Item $temp " $temp .zip"
3744 Expand-Archive " $temp .zip" - DestinationPath $temp
@@ -51,13 +58,13 @@ function Install-FileManager {
5158 Remove-Item - Force - Recurse " $temp "
5259
5360 Write-Host " Adding filemanager to the PATH"
54- if ((Get-Command " pandoc.exe" - ErrorAction SilentlyContinue) -eq $null ) {
61+ if ((Get-Command " pandoc.exe" - ErrorAction SilentlyContinue) -eq $null ) {
5562 $path = (Get-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PATH).Path
5663 $path = $path + " ;$folder "
5764 Set-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PATH - Value " $path "
5865 }
5966
60- Write-Host " filemanager successfully installed!" - ForegroundColor Green
67+ Write-Host " filemanager successfully installed!" - ForegroundColor Green
6168}
6269
6370Install-FileManager
0 commit comments