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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions SpotifyLyricsStatus.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion dist/DiscordLyrics-Installer.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified dist/DiscordLyrics-Installer.exe
Binary file not shown.
25 changes: 14 additions & 11 deletions dist/DiscordLyrics-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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) {
Expand Down
Binary file modified dist/DiscordLyrics-release.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions dist/SpotifyLyricsStatus.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand All @@ -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;
Expand Down
Binary file modified dist/vencord-spotifyLyricsStatus.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/vencord/spotifyLyricsStatus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion scripts/DiscordLyrics-Installer.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions scripts/DiscordLyrics-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion vencord-userplugin/spotifyLyricsStatus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading