Fixed some bugs in the update script
This commit is contained in:
parent
d7c6c36118
commit
c4a7c1e5ed
5 changed files with 36 additions and 8 deletions
|
|
@ -4,10 +4,13 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.7.1] - 2021-04-01
|
||||||
|
### Added
|
||||||
|
- Add Update.ps1 to automatically download the latest version from Github for Windows users.
|
||||||
|
|
||||||
## [1.7.0] - 2021-04-01
|
## [1.7.0] - 2021-04-01
|
||||||
### Added
|
### Added
|
||||||
- Add automatic retry functionality for downloads. It will retry downloading a file after an error 3 times.
|
- Add automatic retry functionality for downloads. It will retry downloading a file after an error 3 times.
|
||||||
- Add Update.ps1 to automatically download the latest version from Github for Windows users.
|
|
||||||
### Changed
|
### Changed
|
||||||
- Fixed an issue downloads sometimes getting added multiple times.
|
- Fixed an issue downloads sometimes getting added multiple times.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<a class="navbar-item"> Profile </a>
|
<a class="navbar-item"> Profile </a>
|
||||||
<a class="navbar-item" (click)="logout()"> Logout </a>
|
<a class="navbar-item" (click)="logout()"> Logout </a>
|
||||||
<hr class="navbar-divider" />
|
<hr class="navbar-divider" />
|
||||||
<div class="navbar-item">Version 1.7.0</div>
|
<div class="navbar-item">Version 1.7.1</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rdt-client",
|
"name": "rdt-client",
|
||||||
"version": "1.7.0",
|
"version": "1.7.1",
|
||||||
"description": "This is a web interface to manage your torrents on Real-Debrid.",
|
"description": "This is a web interface to manage your torrents on Real-Debrid.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
|
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
|
||||||
<Version>1.7.0</Version>
|
<Version>1.7.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,51 @@
|
||||||
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
|
$currentDirectory = $PSScriptRoot
|
||||||
|
|
||||||
|
Write-Host "Starting update script in $currentDirectory"
|
||||||
|
|
||||||
|
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
|
||||||
{
|
{
|
||||||
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
|
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
|
||||||
Start-Process powershell -Verb runAs -ArgumentList $arguments
|
Start-Process powershell -Verb runAs -ArgumentList $arguments
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Stopping ReadDebridClient..."
|
||||||
|
|
||||||
Stop-Service RealDebridClient
|
Stop-Service RealDebridClient
|
||||||
|
|
||||||
|
Write-Host "Stopped ReadDebridClient"
|
||||||
|
|
||||||
$releasesUri = "https://api.github.com/repos/rogerfar/rdt-client/releases/latest"
|
$releasesUri = "https://api.github.com/repos/rogerfar/rdt-client/releases/latest"
|
||||||
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like "*.zip").browser_download_url
|
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like "*.zip").browser_download_url
|
||||||
|
|
||||||
|
Write-Host "Downloading $downloadUri"
|
||||||
|
|
||||||
$pathZip = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $(Split-Path -Path $downloadUri -Leaf)
|
$pathZip = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $(Split-Path -Path $downloadUri -Leaf)
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $downloadUri -Out $pathZip
|
Invoke-WebRequest -Uri $downloadUri -Out $pathZip
|
||||||
|
|
||||||
$tempExtract = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $((New-Guid).Guid)
|
$tempExtract = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $((New-Guid).Guid)
|
||||||
|
|
||||||
|
Write-Host "Extracting to $tempExtract"
|
||||||
|
|
||||||
Expand-Archive -Path $pathZip -DestinationPath $tempExtract -Force
|
Expand-Archive -Path $pathZip -DestinationPath $tempExtract -Force
|
||||||
Copy-Item -Path ".\appsettings.json" -Destination $tempExtract -Force
|
|
||||||
Move-Item -Path "$tempExtract\*" -Destination $pathExtract -Force
|
Write-Host "Backing up appsettings.json"
|
||||||
|
|
||||||
|
Copy-Item -Path "$currentDirectory\appsettings.json" -Destination $tempExtract -Force
|
||||||
|
|
||||||
|
Write-Host "Moving new files"
|
||||||
|
|
||||||
|
Move-Item -Path "$tempExtract\*" -Destination $currentDirectory -Force
|
||||||
|
|
||||||
|
Write-Host "Removing temp files"
|
||||||
|
|
||||||
Remove-Item -Path $tempExtract -Force -Recurse -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempExtract -Force -Recurse -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
Remove-Item $pathZip -Force
|
Remove-Item $pathZip -Force
|
||||||
|
|
||||||
Start-Service RealDebridClient
|
Write-Host "Starting ReadDebridClient..."
|
||||||
|
|
||||||
|
Start-Service RealDebridClient
|
||||||
|
|
||||||
|
Write-Host "Started ReadDebridClient"
|
||||||
Loading…
Reference in a new issue