Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Forced source-client installs to use the native pnpm command path during install, build, and inject.
- Cleared the temporary installer download folder before fetching a fresh installer.
- Fixed pnpm warnings being treated as installer failures on Windows PowerShell.
- Fixed the installer UI download path so it avoids stale loose temp scripts.

## 1.0.5

Expand Down
8 changes: 7 additions & 1 deletion dist/DiscordLyrics-Installer-UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal static class Program
[STAThread]
private static void Main(string[] args)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new InstallerForm(args));
Expand Down Expand Up @@ -431,7 +432,12 @@ private string GetInstallerPath()
if (File.Exists(local))
return local;

var temp = Path.Combine(Path.GetTempPath(), "DiscordLyrics-Installer.ps1");
var cacheDir = Path.Combine(Path.GetTempPath(), "DiscordLyricsInstaller");
Directory.CreateDirectory(cacheDir);
var temp = Path.Combine(cacheDir, "DiscordLyrics-Installer.ps1");
if (File.Exists(temp))
File.Delete(temp);

using (var client = new WebClient())
client.DownloadFile("https://github.com/" + Repo + "/releases/latest/download/DiscordLyrics-Installer.ps1", temp);

Expand Down
Binary file modified dist/DiscordLyrics-Installer.exe
Binary file not shown.
25 changes: 19 additions & 6 deletions dist/DiscordLyrics-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,26 @@ function Invoke-CheckedCommand {
)

$ResolvedCommand = Resolve-NativeCommand -Command $Command
$CommandLine = Join-CommandLine -Command $ResolvedCommand -Arguments $Arguments
$Output = & cmd.exe /d /s /c $CommandLine 2>&1
$ExitCode = $LASTEXITCODE

$Text = ($Output | ForEach-Object { "$_" }) -join [Environment]::NewLine
$StartInfo = [System.Diagnostics.ProcessStartInfo]::new()
$StartInfo.FileName = $ResolvedCommand
$StartInfo.Arguments = ($Arguments | ForEach-Object { ConvertTo-CommandArgument $_ }) -join " "
$StartInfo.UseShellExecute = $false
$StartInfo.RedirectStandardOutput = $true
$StartInfo.RedirectStandardError = $true
$StartInfo.CreateNoWindow = $true

$Process = [System.Diagnostics.Process]::new()
$Process.StartInfo = $StartInfo
[void]$Process.Start()
$StdOut = $Process.StandardOutput.ReadToEnd()
$StdErr = $Process.StandardError.ReadToEnd()
$Process.WaitForExit()
$ExitCode = $Process.ExitCode
$Process.Dispose()

$Text = (@($StdOut, $StdErr) | Where-Object { $_ }) -join [Environment]::NewLine
if ($Text) {
Write-Host $Text
Write-Host ($Text.TrimEnd())
}

if ($ExitCode -ne 0) {
Expand Down
Binary file modified dist/DiscordLyrics-release.zip
Binary file not shown.
8 changes: 7 additions & 1 deletion scripts/DiscordLyrics-Installer-UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal static class Program
[STAThread]
private static void Main(string[] args)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new InstallerForm(args));
Expand Down Expand Up @@ -431,7 +432,12 @@ private string GetInstallerPath()
if (File.Exists(local))
return local;

var temp = Path.Combine(Path.GetTempPath(), "DiscordLyrics-Installer.ps1");
var cacheDir = Path.Combine(Path.GetTempPath(), "DiscordLyricsInstaller");
Directory.CreateDirectory(cacheDir);
var temp = Path.Combine(cacheDir, "DiscordLyrics-Installer.ps1");
if (File.Exists(temp))
File.Delete(temp);

using (var client = new WebClient())
client.DownloadFile("https://github.com/" + Repo + "/releases/latest/download/DiscordLyrics-Installer.ps1", temp);

Expand Down
25 changes: 19 additions & 6 deletions scripts/DiscordLyrics-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,26 @@ function Invoke-CheckedCommand {
)

$ResolvedCommand = Resolve-NativeCommand -Command $Command
$CommandLine = Join-CommandLine -Command $ResolvedCommand -Arguments $Arguments
$Output = & cmd.exe /d /s /c $CommandLine 2>&1
$ExitCode = $LASTEXITCODE

$Text = ($Output | ForEach-Object { "$_" }) -join [Environment]::NewLine
$StartInfo = [System.Diagnostics.ProcessStartInfo]::new()
$StartInfo.FileName = $ResolvedCommand
$StartInfo.Arguments = ($Arguments | ForEach-Object { ConvertTo-CommandArgument $_ }) -join " "
$StartInfo.UseShellExecute = $false
$StartInfo.RedirectStandardOutput = $true
$StartInfo.RedirectStandardError = $true
$StartInfo.CreateNoWindow = $true

$Process = [System.Diagnostics.Process]::new()
$Process.StartInfo = $StartInfo
[void]$Process.Start()
$StdOut = $Process.StandardOutput.ReadToEnd()
$StdErr = $Process.StandardError.ReadToEnd()
$Process.WaitForExit()
$ExitCode = $Process.ExitCode
$Process.Dispose()

$Text = (@($StdOut, $StdErr) | Where-Object { $_ }) -join [Environment]::NewLine
if ($Text) {
Write-Host $Text
Write-Host ($Text.TrimEnd())
}

if ($ExitCode -ne 0) {
Expand Down
Loading