Skip to content

Commit

Permalink
Spotify 1.1.31 and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiuth committed Feb 16, 2024
1 parent fbf9232 commit 5eec30e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v1.1
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
cache: 'npm'
cache-dependency-path: Sprinkles/package-lock.json

Expand All @@ -35,7 +35,6 @@ jobs:
npm install
npm run build
Copy-Item dist/*.* ../build/Release/
cd ../
- name: Create Zip
Expand All @@ -46,8 +45,9 @@ jobs:
} else {
$ver = $Env:GITHUB_SHA.Substring(0, 8) + "-pre";
}
(Get-Content "./Scripts/Install.ps1").Replace("__BUILD_VERSION__", $ver) | Set-Content "./Scripts/Install.ps1"
7z a "-xr!*.lib" "-xr!*.exp" "-xr!*.pdb" build/Soggfy-$ver.zip ./build/Release ./Scripts/*
Copy-Item ./Sprinkles/dist/*.* ./build/Release/
7z a "-xr!*.lib" "-xr!*.exp" "-xr!*.pdb" build/Soggfy-$ver.zip ./build/Release/ ./Scripts/*
- name: Upload Binaries
uses: softprops/action-gh-release@v1
Expand All @@ -58,7 +58,7 @@ jobs:
files: 'build/*.zip'

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: ${{ github.ref_type != 'tag' }}
with:
path: build/*.zip
9 changes: 7 additions & 2 deletions Injector/Injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ HANDLE FindSpotifyProcess()
HANDLE LaunchSpotifyProcess(bool enableRemoteDebug)
{
fs::path exePath = fs::absolute("Spotify/Spotify.exe");
fs::path workDir = exePath.parent_path();
if (!fs::exists(exePath)) {
throw std::exception("Spotify installation not found. Run Install.ps1 and try again.");
PWSTR appData;
SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &appData);
exePath = fs::path(appData) / "Spotify/Spotify.exe";
}
if (!fs::exists(exePath)) {
throw std::exception("Spotify installation not found.");
}
fs::path workDir = exePath.parent_path();
std::cout << "Launching Spotify...\n";

PROCESS_INFORMATION proc = {};
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ If you are having issues with the install script, try following the steps below
3. Copy `SoggfyUIC.js` to `%appdata%/Spotify/SoggfyUIC.js`
4. Download and extract [FFmpeg binaries](https://github.com/AnimMouse/ffmpeg-autobuild/releases) to `%localappdata%/Soggfy/ffmpeg/ffmpeg.exe` (or add them to `%PATH%`).

Alternatively, Soggfy can be injected into a running Spotify process by running `Injector.exe`.
Alternatively, `Injector.exe` can be used to launch _or_ inject Soggfy into an already running Spotify instance. A portable and self-contained install can be made by copying Spotify binaries from `%appdata%/Spotify/` to `Soggfy/Spotify/`.

# Credits
- [XSpotify](https://web.archive.org/web/20200303145624/https://github.com/meik97/XSpotify) and spotifykeydumper - Inspiration for this project
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $base = $PSScriptRoot
$temp = "$base\temp";
$SpotifyDir = "$env:APPDATA\Spotify"

$SpotifyInstallerUrl = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-1.2.26.1187.g36b715a1-269.exe"
$SpotifyInstallerUrl = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-1.2.31.1205.g4d59ad7c-1561.exe"
$SpotifyVersion = $SpotifyInstallerUrl -replace '.+installer-(.+)\.g.+', '$1'
$SpotifyVersionWithCommit = $SpotifyInstallerUrl -replace '.+installer-(.+\.g.+)\.exe', '$1'

Expand Down
14 changes: 9 additions & 5 deletions SpotifyOggDumper/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HMODULE _selfModule;
std::shared_ptr<StateManager> _stateMgr;

struct PlayerState {
uint8_t unknown1[0x3E0];
uint8_t unknown1[0x3E8];
uint8_t playback_id[16];

std::string getPlaybackId() const {
Expand Down Expand Up @@ -148,10 +148,14 @@ void Exit()

DWORD WINAPI Init(LPVOID param)
{
auto dataDir = Utils::GetLocalAppDataFolder() / "Soggfy";
auto moduleDir = GetModulePath(_selfModule).parent_path();

if (!fs::exists(dataDir)) {
fs::path moduleDir = GetModulePath(_selfModule).parent_path();
fs::path dataDir = Utils::GetLocalAppDataFolder() / "Soggfy";

// Portable config heuristic: config.json placed next to DLL or injected launch with no persistent config
if (fs::exists(moduleDir / "config.json") || (!fs::exists(moduleDir / "Spotify.exe") && !fs::exists(dataDir / "config.json"))) {
dataDir = moduleDir;
}
else if (!fs::exists(dataDir)) {
fs::create_directories(dataDir);
}

Expand Down
8 changes: 7 additions & 1 deletion Sprinkles/src/ui/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ export default class UI {
style.innerHTML = MergedStyles;
document.head.appendChild(style);

this.addTopbarButtons();
let topbarDiv = this.addTopbarButtons();

let bodyObs = new MutationObserver(() => {
let menuList = document.querySelector("#context-menu ul");
if (menuList !== null && !menuList["_sgf_handled"]) {
this.onContextMenuOpened(menuList);
}
// Lyrics page will delete topbar header
if (!topbarDiv.isConnected) {
let fwdButton = document.querySelector("[data-testid='top-bar-forward-button'], .main-topBar-forward");
let topbarContainer = fwdButton.parentElement;
topbarContainer.append(topbarDiv);
}
});
//playlist context menus are delayed, so we need to observe subtrees too
bodyObs.observe(document.body, { childList: true, subtree: true });
Expand Down

0 comments on commit 5eec30e

Please sign in to comment.