From 53555aad6a5985209f148a224d803053c8041348 Mon Sep 17 00:00:00 2001 From: Janis Date: Mon, 31 Oct 2022 13:40:29 +0100 Subject: [PATCH] v0.1.1 --- config.js | 1 + meta.json | 2 +- update.ps1 | 11 ++++++++++- update_force.bat | 2 ++ update_force.ps1 | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 update_force.bat create mode 100644 update_force.ps1 diff --git a/config.js b/config.js index 0ffc93a..80db53b 100644 --- a/config.js +++ b/config.js @@ -1,3 +1,4 @@ const CONFIG = { apiKey: "", + twitchOAuth: "", }; diff --git a/meta.json b/meta.json index 07c6dd8..c430334 100644 --- a/meta.json +++ b/meta.json @@ -1,3 +1,3 @@ { - "version": "v0.1.0" + "version": "v0.1.1" } diff --git a/update.ps1 b/update.ps1 index a06e527..59387c6 100644 --- a/update.ps1 +++ b/update.ps1 @@ -32,7 +32,16 @@ if ($newestVersionString -ne "") { else { Write-Output "Updating to newer version..." - Remove-Item * -Recurse -Force -Confirm + if (Test-Path "./config.js") { + if (Test-Path "./config-old.js") { + Remove-Item config-old.js + } + Copy-Item "./config.js" -Destination "./config-old.js" + Write-Output "config.js has been copied" + } + + + Remove-Item * -Recurse -Force -Exclude config-old.js mkdir ./temp attrib +h ./temp diff --git a/update_force.bat b/update_force.bat new file mode 100644 index 0000000..43c5bde --- /dev/null +++ b/update_force.bat @@ -0,0 +1,2 @@ +powershell ./update_force.ps1 +pause \ No newline at end of file diff --git a/update_force.ps1 b/update_force.ps1 new file mode 100644 index 0000000..729f10d --- /dev/null +++ b/update_force.ps1 @@ -0,0 +1,39 @@ +Write-Output "Starting update..." + +$newestVersionString = "" +$req = Invoke-WebRequest https://github.com/DerTyp876/obs-twitch-camera-frame/releases/latest + +foreach ($tag in $req.ParsedHtml.body.getElementsByTagName('h1')) { + if ($tag.innerText[0] -eq "v") { + $newestVersionString = $tag.innerText + } +} + +Write-Output "Updating to newer version..." + +if (Test-Path "./config.js") { + if (Test-Path "./config-old.js") { + Remove-Item config-old.js + } + Copy-Item "./config.js" -Destination "./config-old.js" + Write-Output "config.js has been copied" +} + + +Remove-Item * -Recurse -Force -Exclude config-old.js + +mkdir ./temp +attrib +h ./temp +Write-Output "Downloading newer version..." +Invoke-WebRequest -Uri "https://github.com/DerTyp876/obs-twitch-camera-frame/archive/refs/tags/$newestVersionString.zip" -OutFile "./temp/$newestVersionString.zip" +Write-Output "Extracting archive..." +Expand-Archive -Path "./temp/$newestVersionString.zip" -DestinationPath "./temp/" + +Get-ChildItem -Path "./temp/obs-twitch-camera-frame-$($newestVersionString -replace 'v')" -Recurse | Move-Item -Destination "./" + +Remove-Item "./temp" -Recurse -Force -Confirm + +Write-Output "You are now up to date again!" + +Write-Output "You need to add your API-Key again to the config.js!" +pause \ No newline at end of file