GooseMod / OpenAsar

Open-source alternative of Discord desktop's app.asar

Home Page:https://openasar.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Powershell wildcards in the Windows installer + Echoes

FlooferLand opened this issue · comments

I've encountered some issues installing this mod, requiring me to manually install it.
The default installer can fail silently, and it assumes the EXACT Discord version you're using even tho OpenAsar installs to both older and newer Discord versions.

Having the installer tell you what it's doing would be very useful too; Especially since you'll know at which point it failed.

I've provided some code below for a potential new installer.
PowerShell is in no way my strong suit as I'm mostly a Rust/Python dev, so there is a singular error:

  • At the Invoke-WebRequest line, it for some reason complains that the file (where the asar is supposed to be downloaded to) does not exist, even tho it itself is supposed to put that file there.

I can't be bothered to solve it rn since it's pretty late and I barely know any PowerShell to begin with.
But hopefully someone slightly more experienced than me can come in.

@echo off

echo Attempting to kill Discord
C:\Windows\System32\TASKKILL.exe /f /im Discord.exe
C:\Windows\System32\TASKKILL.exe /f /im Discord.exe
C:\Windows\System32\TASKKILL.exe /f /im Discord.exe

echo Waiting for Discord to close..
C:\Windows\System32\TIMEOUT.exe /t 5 /nobreak

echo Backing up your Asar
powershell -Command "Rename-Item -NewName app.asar.backup -Path \"$(Get-ChildItem \"$($env:LOCALAPPDATA)\Discord\app-1.*\resources\app.asar\")\"

echo Downloading OpenAsar..
rem --- THIS COMMAND THROWS AN ERROR! \/
powershell -Command "Invoke-WebRequest https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar -OutFile \"$env:LOCALAPPDATA\Discord\app-1.*\resources\app.asar\""

echo Launching Discord..
start "" "%localappdata%\Discord\Update.exe" --processStart Discord.exe
goto 2>nul & del "%~f0"

Hopefully someone writes something with this info, now that the issue has been brought to the ya'lls attention.
This might be an issue on the Linux installer, too, but I don't know where it's stored so i can't check myself.

Oh. Apparently, the command:

powershell -Command "Invoke-WebRequest https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar -OutFile \"$env:LOCALAPPDATA\Discord\app-1.*\resources\app.asar\""

Should be:

powershell -Command "Invoke-WebRequest https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar -OutFile \"$env:LOCALAPPDATA\Discord\app-1.*\resources\_app.asar\""

That works somehow. (On my Discord Canary)

Edit: Apparently, the file that should be downloaded is named _app.asar, not app.asar. Trying to save as app.asar will fail due to another folder named the same.
image

Discussed before but not doing for backwards compat and instability :)