diff --git a/CHANGELOG.md b/CHANGELOG.md index e5dc756..3f1c7f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.0.6 + +- 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. + ## 1.0.5 - Fixed the Windows installer so pnpm warnings no longer get treated as a failed build. diff --git a/SpotifyLyricsStatus.plugin.js b/SpotifyLyricsStatus.plugin.js index 88a0f21..4f6b2ba 100644 --- a/SpotifyLyricsStatus.plugin.js +++ b/SpotifyLyricsStatus.plugin.js @@ -2,7 +2,7 @@ * @name DiscordLyrics * @author mally * @description Sets your Discord custom status to the current synced lyric from Spotify, or a pause status when playback stops. - * @version 1.0.5 + * @version 1.0.6 * @source https://lrclib.net */ @@ -14,7 +14,7 @@ const { execFile, spawn } = require("child_process"); module.exports = class DiscordLyrics { constructor() { this.name = "DiscordLyrics"; - this.version = "1.0.5"; + this.version = "1.0.6"; this.repo = "MallyDev2/DiscordLyrics"; this.latestReleaseApi = `https://api.github.com/repos/${this.repo}/releases/latest`; this.interval = null; diff --git a/dist/DiscordLyrics-Installer.cmd b/dist/DiscordLyrics-Installer.cmd index 855d083..46b5a3d 100644 --- a/dist/DiscordLyrics-Installer.cmd +++ b/dist/DiscordLyrics-Installer.cmd @@ -13,7 +13,8 @@ if exist "%LOCAL_APP%" ( exit /b 0 ) -if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%" >nul 2>nul +if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%" >nul 2>nul +mkdir "%TEMP_DIR%" >nul 2>nul powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -Command "try { Invoke-WebRequest -UseBasicParsing -Uri '%BASE_URL%/DiscordLyrics-Installer.exe' -OutFile '%TEMP_APP%'; Invoke-WebRequest -UseBasicParsing -Uri '%BASE_URL%/DiscordLyrics-Installer.ps1' -OutFile '%TEMP_ENGINE%' } catch { exit 1 }" if errorlevel 1 exit /b 1 diff --git a/dist/DiscordLyrics-Installer.exe b/dist/DiscordLyrics-Installer.exe index a81f4e6..544a238 100644 Binary files a/dist/DiscordLyrics-Installer.exe and b/dist/DiscordLyrics-Installer.exe differ diff --git a/dist/DiscordLyrics-Installer.ps1 b/dist/DiscordLyrics-Installer.ps1 index 589ccb9..44788b9 100644 --- a/dist/DiscordLyrics-Installer.ps1 +++ b/dist/DiscordLyrics-Installer.ps1 @@ -210,9 +210,10 @@ function Reset-WorkDir { } function Ensure-Pnpm { - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm is ready" - return + return $PnpmCommand } Write-Warn "pnpm was not found" @@ -221,18 +222,20 @@ function Ensure-Pnpm { Write-Step "Installing pnpm with Corepack" Invoke-CheckedCommand corepack enable Invoke-CheckedCommand corepack prepare pnpm@latest --activate - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm installed" - return + return $PnpmCommand } } if (Get-Command npm -ErrorAction SilentlyContinue) { Write-Step "Installing pnpm with npm" Invoke-CheckedCommand npm install -g pnpm - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm installed" - return + return $PnpmCommand } } @@ -658,7 +661,7 @@ function Select-SourcePath { function Install-SourceClient { param([string]$ClientName) - Ensure-Pnpm + $PnpmCommand = Ensure-Pnpm $ClientRoot = Select-SourcePath -ClientName $ClientName $PluginZip = Join-Path $PackageDir "Vencord\vencord-spotifyLyricsStatus.zip" @@ -703,12 +706,12 @@ function Install-SourceClient { Write-Step "Building client" if (!(Test-Path (Join-Path $ClientRoot "node_modules"))) { Write-Step "Installing client dependencies" - Invoke-CheckedCommand pnpm install --frozen-lockfile + Invoke-CheckedCommand $PnpmCommand install --frozen-lockfile } else { Write-Ok "Client dependencies already installed" } - Invoke-CheckedCommand pnpm build + Invoke-CheckedCommand $PnpmCommand build if (Test-Path (Join-Path $ClientRoot "dist")) { $ActiveDist = Join-Path $ClientDataDir "dist" @@ -726,9 +729,9 @@ function Install-SourceClient { Repair-DiscordAsar Write-Step "Reinstalling client into Discord" if ($ClientName -eq "Vencord") { - Invoke-CheckedCommand pnpm inject -- -branch stable + Invoke-CheckedCommand $PnpmCommand inject -- -branch stable } else { - Invoke-CheckedCommand pnpm inject + Invoke-CheckedCommand $PnpmCommand inject } Write-Ok "Client was rebuilt and injected" } elseif ($NoInject -and $CanInject) { diff --git a/dist/DiscordLyrics-release.zip b/dist/DiscordLyrics-release.zip index cfcd166..82fae51 100644 Binary files a/dist/DiscordLyrics-release.zip and b/dist/DiscordLyrics-release.zip differ diff --git a/dist/SpotifyLyricsStatus.plugin.js b/dist/SpotifyLyricsStatus.plugin.js index 88a0f21..4f6b2ba 100644 --- a/dist/SpotifyLyricsStatus.plugin.js +++ b/dist/SpotifyLyricsStatus.plugin.js @@ -2,7 +2,7 @@ * @name DiscordLyrics * @author mally * @description Sets your Discord custom status to the current synced lyric from Spotify, or a pause status when playback stops. - * @version 1.0.5 + * @version 1.0.6 * @source https://lrclib.net */ @@ -14,7 +14,7 @@ const { execFile, spawn } = require("child_process"); module.exports = class DiscordLyrics { constructor() { this.name = "DiscordLyrics"; - this.version = "1.0.5"; + this.version = "1.0.6"; this.repo = "MallyDev2/DiscordLyrics"; this.latestReleaseApi = `https://api.github.com/repos/${this.repo}/releases/latest`; this.interval = null; diff --git a/dist/vencord-spotifyLyricsStatus.zip b/dist/vencord-spotifyLyricsStatus.zip index ef71488..73faa6a 100644 Binary files a/dist/vencord-spotifyLyricsStatus.zip and b/dist/vencord-spotifyLyricsStatus.zip differ diff --git a/dist/vencord/spotifyLyricsStatus/index.ts b/dist/vencord/spotifyLyricsStatus/index.ts index 3cbe9de..ecad157 100644 --- a/dist/vencord/spotifyLyricsStatus/index.ts +++ b/dist/vencord/spotifyLyricsStatus/index.ts @@ -32,7 +32,7 @@ const DEFAULT_SETTINGS = { rpcShowAlbumArt: true } as const; -const RELEASE_VERSION = "1.0.5"; +const RELEASE_VERSION = "1.0.6"; const REPO = "MallyDev2/DiscordLyrics"; const LATEST_RELEASE_API = `https://api.github.com/repos/${REPO}/releases/latest`; const LAST_UPDATE_CHECK_KEY = "DiscordLyrics.lastUpdateCheck"; diff --git a/package-lock.json b/package-lock.json index 5b4ab6d..a9bf3b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mallydev2/discordlyrics", - "version": "1.0.5", + "version": "1.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mallydev2/discordlyrics", - "version": "1.0.5", + "version": "1.0.6", "license": "GPL-3.0-or-later", "devDependencies": {} } diff --git a/package.json b/package.json index 9637868..228beaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mallydev2/discordlyrics", - "version": "1.0.5", + "version": "1.0.6", "description": "Spotify lyrics status for BetterDiscord and Vencord.", "private": false, "author": "MallyDev2", diff --git a/scripts/DiscordLyrics-Installer.cmd b/scripts/DiscordLyrics-Installer.cmd index 855d083..46b5a3d 100644 --- a/scripts/DiscordLyrics-Installer.cmd +++ b/scripts/DiscordLyrics-Installer.cmd @@ -13,7 +13,8 @@ if exist "%LOCAL_APP%" ( exit /b 0 ) -if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%" >nul 2>nul +if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%" >nul 2>nul +mkdir "%TEMP_DIR%" >nul 2>nul powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -Command "try { Invoke-WebRequest -UseBasicParsing -Uri '%BASE_URL%/DiscordLyrics-Installer.exe' -OutFile '%TEMP_APP%'; Invoke-WebRequest -UseBasicParsing -Uri '%BASE_URL%/DiscordLyrics-Installer.ps1' -OutFile '%TEMP_ENGINE%' } catch { exit 1 }" if errorlevel 1 exit /b 1 diff --git a/scripts/DiscordLyrics-Installer.ps1 b/scripts/DiscordLyrics-Installer.ps1 index 589ccb9..44788b9 100644 --- a/scripts/DiscordLyrics-Installer.ps1 +++ b/scripts/DiscordLyrics-Installer.ps1 @@ -210,9 +210,10 @@ function Reset-WorkDir { } function Ensure-Pnpm { - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm is ready" - return + return $PnpmCommand } Write-Warn "pnpm was not found" @@ -221,18 +222,20 @@ function Ensure-Pnpm { Write-Step "Installing pnpm with Corepack" Invoke-CheckedCommand corepack enable Invoke-CheckedCommand corepack prepare pnpm@latest --activate - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm installed" - return + return $PnpmCommand } } if (Get-Command npm -ErrorAction SilentlyContinue) { Write-Step "Installing pnpm with npm" Invoke-CheckedCommand npm install -g pnpm - if (Get-Command pnpm -ErrorAction SilentlyContinue) { + $PnpmCommand = Resolve-NativeCommand -Command "pnpm" + if ($PnpmCommand -and $PnpmCommand -notmatch '\.ps1$' -and (Test-Path -LiteralPath $PnpmCommand -PathType Leaf)) { Write-Ok "pnpm installed" - return + return $PnpmCommand } } @@ -658,7 +661,7 @@ function Select-SourcePath { function Install-SourceClient { param([string]$ClientName) - Ensure-Pnpm + $PnpmCommand = Ensure-Pnpm $ClientRoot = Select-SourcePath -ClientName $ClientName $PluginZip = Join-Path $PackageDir "Vencord\vencord-spotifyLyricsStatus.zip" @@ -703,12 +706,12 @@ function Install-SourceClient { Write-Step "Building client" if (!(Test-Path (Join-Path $ClientRoot "node_modules"))) { Write-Step "Installing client dependencies" - Invoke-CheckedCommand pnpm install --frozen-lockfile + Invoke-CheckedCommand $PnpmCommand install --frozen-lockfile } else { Write-Ok "Client dependencies already installed" } - Invoke-CheckedCommand pnpm build + Invoke-CheckedCommand $PnpmCommand build if (Test-Path (Join-Path $ClientRoot "dist")) { $ActiveDist = Join-Path $ClientDataDir "dist" @@ -726,9 +729,9 @@ function Install-SourceClient { Repair-DiscordAsar Write-Step "Reinstalling client into Discord" if ($ClientName -eq "Vencord") { - Invoke-CheckedCommand pnpm inject -- -branch stable + Invoke-CheckedCommand $PnpmCommand inject -- -branch stable } else { - Invoke-CheckedCommand pnpm inject + Invoke-CheckedCommand $PnpmCommand inject } Write-Ok "Client was rebuilt and injected" } elseif ($NoInject -and $CanInject) { diff --git a/vencord-userplugin/spotifyLyricsStatus/index.ts b/vencord-userplugin/spotifyLyricsStatus/index.ts index 3cbe9de..ecad157 100644 --- a/vencord-userplugin/spotifyLyricsStatus/index.ts +++ b/vencord-userplugin/spotifyLyricsStatus/index.ts @@ -32,7 +32,7 @@ const DEFAULT_SETTINGS = { rpcShowAlbumArt: true } as const; -const RELEASE_VERSION = "1.0.5"; +const RELEASE_VERSION = "1.0.6"; const REPO = "MallyDev2/DiscordLyrics"; const LATEST_RELEASE_API = `https://api.github.com/repos/${REPO}/releases/latest`; const LAST_UPDATE_CHECK_KEY = "DiscordLyrics.lastUpdateCheck";