jeffvli / feishin

A modern self-hosted music player.
https://feishin.vercel.app
GNU General Public License v3.0
1.99k stars 78 forks source link

MPV playback does not work with multiple users #622

Open ChiliEater opened 1 month ago

ChiliEater commented 1 month ago

Expected Behavior

If I start two instances of Feishin with MPV playback enabled, I should be able to use both instances without issue.

Current Behavior

The first instance of Feishin creates an MPV socket at /tmp/node-mpv.sock using the current user's permission:

srw------- 1 chili chili 0 Mai 20 21:46 /tmp/node-mpv.sock=

Subsequent instances of Feishin from different users (for example pepper) are unable to start playback using MPV since they do not own the socket and are unable to re-create or access it.

Furthermore, Feishin does not clean up after itself when closing and the socket lingers until /tmp is cleared.

Steps to Reproduce

  1. Launch Feishin as user chili (example)
  2. Start playback
  3. Close Feishin
  4. Log in as user pepper (example)
  5. Launch Feishin
  6. Start playback
  7. Playback does not start

Possible Solution

In src/main/features/core/player/index.ts:92 the extra constant is created which is the appended to the socket name. This could be re-used to add some unique identifier to the name, i.e. username, random string, etc.

Context

No response

Application version

0.7.2

Operating System and version

Arch Linux, feishin-bin package from AUR

Server and Version

Navidrome 0.51.1

Node Version (if developing locally)

No response