WKMusic
Displays your current Spotify track on the in-game HUD
模組介紹 作者原文
WKMusic
A BepInEx mod for White Knuckle that displays your current Spotify track on the in-game HUD.
Requirements
- Windows
- A Spotify Developer app with the redirect URI set to:
- Spotify Premium (required by Spotify for playback state access)
Installation
- Download the latest release and drop WKMusic.dll into:
BepInEx/plugins/
- Launch the game. A browser window will open automatically asking for your Spotify Client ID and Client Secret.
- Enter your credentials, click Connect Spotify, and authorize in the Spotify page that follows.
- Done. The HUD appears in the top-right corner of the screen.
Credentials and tokens are saved locally - you won't be asked again on subsequent launches.
Getting Spotify credentials
- Go to developer.spotify.com/dashboard and click Create app.
- Fill in the form:
- App name - anything you like, e.g. WKMusic
- App description - can be left blank or any short text
- Redirect URI - add exactly this:
- Which API/SDKs are you planning to use? - check Web API, leave everything else unchecked
- Click Save, then open the app's Settings page.
- Copy your Client ID and Client Secret - you'll paste them into the setup page on first launch.
Configuration
The config file is generated at BepInEx/config/WKMusic.cfg after the first launch.
| Key | Default | Description |
|---|---|---|
| PlayerScale | 0.8 | Overall HUD scale (0.5 – 3.0) |
| CoverSize | 64 | Album art size in pixels (20 – 300) |
| CoverOpacity | 0.6 | Album art opacity (0 = invisible, 1 = fully opaque) |
| WorkerUrl | (built-in) | Cloudflare Worker URL - change only if you self-host |
How authorization works
The mod uses the Spotify Authorization Code flow. Your Client Secret is never sent from your machine in plain text - token exchange happens through a Cloudflare Worker that acts as a secure proxy.
[Game] opens browser -> accounts.spotify.com
[Browser] user authorizes -> returns code to Worker callback
[Worker] exchanges code for tokens using Client Secret
[Game] receives tokens, stores them in Windows Credential Manager
[Game] polls Spotify API directly every 300 ms
Self-hosting the Worker
This is completely optional. The mod ships with a built-in public Worker - you don't need to do any of this. Self-hosting is only useful if you want full control over the OAuth proxy (e.g. for privacy reasons or if the public Worker goes down).
The Worker source is in the worker/ directory. Deploy with Wrangler:
cd worker
npm install -g wrangler
wrangler login
wrangler secret put SPOTIFY_CLIENT_SECRET
wrangler deploy
After deploying, set WorkerUrl in BepInEx/config/WKMusic.cfg to your Worker's URL and update the Redirect URI in your Spotify app to match.
License
MIT
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: