diff --git a/assets/icon.ico b/assets/icon.ico new file mode 100644 index 00000000..03cece96 Binary files /dev/null and b/assets/icon.ico differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 00000000..93d05c6c Binary files /dev/null and b/assets/icon.png differ diff --git a/deploy/win32/spotube/clear-installation.ps1 b/deploy/win32/spotube/clear-installation.ps1 new file mode 100644 index 00000000..c1164a64 --- /dev/null +++ b/deploy/win32/spotube/clear-installation.ps1 @@ -0,0 +1,39 @@ +# Don't edit this file without understanding, this can lead to major damage to the system +# Use uninstall.bat to remove Spotube +Add-Type -AssemblyName System.IO.Compression.FileSystem +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +if(Test-Path "$ScriptDir\qode.exe"){ + $WannaRemove = Read-Host -Prompt "Are you sure to uninstall?[y]Yes/[n]No" + $WannaRemove = $WannaRemove.Trim().ToLower() + if($WannaRemove -eq "y"){ + echo "Removing all the contents" + Get-ChildItem $ScriptDir -Recurse | Remove-Item + + $DeleteData = Read-Host -Prompt "Do you want to delete all data & caches?[y]Yes/[n]No" + $DeleteData = $DeleteData.Trim().ToLower() + if ($DeleteData -eq "y") { + echo "Deleting data & caches" + Remove-Item -Path "$Home\.config\spotube" -Recurse + Remove-Item -Path "$Home\.cache\spotube" -Recurse + echo "Deleted caches & data" + } + elseif($DeleteData -eq "n") { + echo "Ok, keeping those" + } + else{ + throw "Wrong Option, use either 'y' or 'n', aborting..." + } + + echo "Uninstall complete, just delete the Spotube folder now" + echo "Will miss you💕!" + } + elseif($WannaRemove -eq "n"){ + echo "Thank god you didn't, quitting..." + } + else{ + throw "Wrong Option, use either 'y' or 'n', aborting..." + } +} +else{ + throw "Script isn't being executed desired location, aborting for abuse" +} \ No newline at end of file diff --git a/deploy/win32/spotube/install.bat b/deploy/win32/spotube/install.bat new file mode 100644 index 00000000..352e64be --- /dev/null +++ b/deploy/win32/spotube/install.bat @@ -0,0 +1,3 @@ +@echo off + +Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList '-ExecutionPolicy Bypass -File %~dp0make-install.ps1' -Verb RunAs}" \ No newline at end of file diff --git a/deploy/win32/spotube/make-install.ps1 b/deploy/win32/spotube/make-install.ps1 new file mode 100644 index 00000000..87f86c6b --- /dev/null +++ b/deploy/win32/spotube/make-install.ps1 @@ -0,0 +1,79 @@ +# Don't edit this file, this can cause serious damage +# Use install.bat to install Spotube +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$shortcut_paths = @( + "$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Spotube.lnk", + "$HOME\Desktop\Spotube.lnk" + ) +# for creating shortcuts +function CreateShortcut { + $Target = "$ScriptDir\qode.exe" + $WshShell = New-Object -comObject WScript.Shell + + echo "Creating shortcuts" + foreach($shortcut in $shortcut_paths){ + echo $shortcut + $StartShortcut = $WshShell.CreateShortcut($shortcut) + $StartShortcut.TargetPath = $Target + $StartShortcut.WorkingDirectory = $ScriptDir + $StartShortcut.IconLocation = "$ScriptDir\dist\icon.ico" + $StartShortcut.Save() + } +} + +$Spotube_Dir = "$Env:Programfiles\Spotube" +# extracts & installs spotube +function InstallSpotube { + param([bool]$PromptLocation) + $Spotube_Location="" + # checking if reinstalling + if($PromptLocation){ + $Spotube_Location = Read-Host -Prompt "Give an absolute path (e.g C:\My Folder\) to install Spotube or leave it empty to install in {$Spotube_Dir}: " + } + # now creating/installing spotube + if(!$Spotube_Location.Trim()){ + New-Item -Path $Env:Programfiles -Name "Spotube" -ItemType "directory" + [System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", $Spotube_Dir) + } + else{ + New-Item -Path Spotube_Location -Name "Spotube" -ItemType "directory" + [System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", "$Spotube_Location\Spotube") + } + $WannaCreateShortcut = Read-Host -Prompt "Do you want to create shortcuts?[y]Yes/[n]No" + $WannaCreateShortcut = $WannaCreateShortcut.Trim().ToLower() + if($WannaCreateShortcut -eq "y"){ + CreateShortcut + } + elseif($WannaCreateShortcut -eq "n"){ + echo "Ok, skipping this part" + } + else{ + throw "Wrong Option, use either 'y' or 'n', aborting..." + } + +} + +if(!(Test-Path $Spotube_Dir)){ + InstallSpotube -PromptLocation $True +} +# reinstallation procedure +else{ + echo "Spotube already exists in $Env:Programfiles\Spotube" + $WannaReplace = Read-Host -Prompt "Do you want to reinstall?[y]Yes/[n]No" + $WannaReplace = $WannaReplace.Trim().ToLower() + if($WannaReplace -eq "y"){ + echo "Removing Old Spotube" + Remove-Item -Path "$Spotube_Dir" -Recurse + echo "Installing New Spotube" + InstallSpotube + } + elseif($WannaReplace -eq "n"){ + echo "Keeping the older installation, quitting..." + } + else{ + throw "Wrong Option, use either 'y' or 'n', aborting..." + } + +} diff --git a/deploy/win32/spotube/platforms/.gitkeep b/deploy/win32/spotube/platforms/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/deploy/win32/spotube/qode.json b/deploy/win32/spotube/qode.json new file mode 100644 index 00000000..52367eb3 --- /dev/null +++ b/deploy/win32/spotube/qode.json @@ -0,0 +1,3 @@ +{ + "distPath": ".\\dist" +} diff --git a/deploy/win32/spotube/styles/.gitkeep b/deploy/win32/spotube/styles/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/deploy/win32/spotube/uninstall.bat b/deploy/win32/spotube/uninstall.bat new file mode 100644 index 00000000..e3ed61b1 --- /dev/null +++ b/deploy/win32/spotube/uninstall.bat @@ -0,0 +1,3 @@ +@echo off + +powershell.exe -ExecutionPolicy Unrestricted -Command ". '%~dp0clear-installation.ps1'" \ No newline at end of file