nukeop / nuclear

Streaming music player that finds free music for you
https://nuclearplayer.com
GNU Affero General Public License v3.0
12.26k stars 1.07k forks source link

A JavaScript error occurred in the main process #1669

Closed Lucki closed 3 months ago

Lucki commented 3 months ago

Platform: Flatpak

Nuclear version: 0.6.37

Description of the issue:

I get the following windows as popups when starting, pausing or stopping a track. After clicking OK on all three of them the action happens and the program continues as normal.

Popups ![Bildschirmfoto vom 2024-08-15 18-45-24](https://github.com/user-attachments/assets/2b4f358a-c030-447b-9ded-0e55a7dc6342) ![Bildschirmfoto vom 2024-08-15 18-45-29](https://github.com/user-attachments/assets/0fc248d0-0fc2-4259-954f-2bddb85b3bc4) ![Bildschirmfoto vom 2024-08-15 18-45-32](https://github.com/user-attachments/assets/c067830e-1d6b-4dcf-ab4e-d751896e9661)
nukeop commented 3 months ago

I'm running in circles - this was an issue 2 years ago: https://github.com/nukeop/nuclear/issues/1081

And it's related to the name registered in MPRIS.

Here's a summary: the name was changed due to: https://github.com/nukeop/nuclear/issues/1666 from nuclear to org.js.nuclear.Nuclear. But also, I changed it the other way around 2 years ago, and only remembered this now. According to flatpak policies, it needs the latter name: https://docs.flatpak.org/en/latest/sandbox-permissions.html#d-bus-access

DBus access is filtered by default. The default policy for the session bus only allows the application to own its own namespace named by $FLATPAK_ID, subnames of it and org.mpris.MediaPlayer2.$FLATPAK_ID for MPRIS. Furthermore, it is only allowed to talk to names matching those patterns, the bus itself org.freedesktop.DBus and portal APIs of the form org.freedesktop.portal.*.

So I'm not sure which name I should use, if neither works.

nukeop commented 3 months ago

But org.js.nuclear.Nuclear is non-compliant with the bus name policy: https://specifications.freedesktop.org/mpris-spec/latest/#Bus-Name-Policy.

Each media player must request a unique bus name which begins with org.mpris.MediaPlayer2. For example:

org.mpris.MediaPlayer2.audacious org.mpris.MediaPlayer2.vlc org.mpris.MediaPlayer2.bmp org.mpris.MediaPlayer2.xmms2

So these two policies are mutually exclusive.

nukeop commented 3 months ago

I looked at other music players, and they request access to bus names compliant with freedesktop: https://github.com/flathub/org.clementine_player.Clementine/blob/master/org.clementine_player.Clementine.yaml

I will try doing the same.

Lucki commented 3 months ago

Today it works already, there wasn't any program update, it's still at 0.6.37. The only difference I can see is that Flatseal now displays org.mpris.MediaPlayer2.nuclear as owned. The currently playing music thing isn't showing in the notification area though.

nukeop commented 3 months ago

I updated the build command. Apparently you can add flatpak arguments without incrementing the version. So I guess this can be closed now.

Lucki commented 3 months ago

Strangely, I now get this dialog again after I restarted the program. Flatseal still shows the mpris thing available. Very weird!

bt4ibwem8 commented 3 months ago

I get this error as well, but in my case it seems to be Windows 7 issue. When i enable "report win11 version" in Properties of .exe file, then it runs fine (except Visualizer tab is broken).

nukeop commented 3 months ago

Impossible that this would be the same error on Windows. Can you post a screenshot or copy the entire text here?

bt4ibwem8 commented 3 months ago

image

nukeop commented 3 months ago

It's very probable that it's caused by Windows 7 no longer being supported by the version of Node that Nuclear is using. Somebody on Discord had the same problem. Why are you still using windows 7 anyway?

bt4ibwem8 commented 3 months ago

I have nodejs 22.6.0 installed, or Nuclear is using own node, not system-wide? I still use win7 because it is very stable, fast, no telemetry and still updated with security patches (the same kernel as Windows Server 2008 r2). I will switch to Linux when that day comes, just not yet because everything works great (with some minor issues)...