flathub / io.github.celluloid_player.Celluloid

https://flathub.org/apps/details/io.github.celluloid_player.Celluloid
3 stars 12 forks source link

Indirect file access causes issues with some scripts #28

Open teohhanhui opened 3 years ago

teohhanhui commented 3 years ago

The default setup using --file-forwarding is very broken. Many scripts can't work properly like that, e.g. https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua

Even the auto-loading of external subtitle files (sub-auto) is broken.

TingPing commented 3 years ago

I'm keeping this package sandboxed. Media playback is security sensitive.

Users can customize their installation to be less sandboxed if they wish.

teohhanhui commented 3 years ago

Is it possible to at least expose everything in the current directory?

--filesystem="$PWD":ro

Actually, a more configurable --file-forwarding, being able to forward the entire directory tree at the requested path would be great.

TingPing commented 3 years ago

Is it possible to at least expose everything in the current directory?

It requires absolute paths at startup, but sure.

Actually, a more configurable --file-forwarding, being able to forward the entire directory tree at the requested path would be great.

Yes that would be ideal.

teohhanhui commented 3 years ago

I've tried everything but still can't get this to work. Apparently gio open does not use the Exec in the .desktop file, so I'm unable to override the command.

https://developer.gnome.org/DBusApplicationLaunching/

Relevant output of dbus-monitor: ``` method call time=1623769103.634039 sender=:1.407 -> destination=org.freedesktop.DBus serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='org.gtk.vfs.Daemon'" method return time=1623769103.634092 sender=org.freedesktop.DBus -> destination=:1.407 serial=3 reply_serial=2 method call time=1623769103.634107 sender=:1.407 -> destination=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=StartServiceByName string "org.gtk.vfs.Daemon" uint32 0 method return time=1623769103.634122 sender=org.freedesktop.DBus -> destination=:1.407 serial=4 reply_serial=3 uint32 2 method call time=1623769103.634748 sender=:1.407 -> destination=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner string "org.gtk.vfs.Daemon" method return time=1623769103.634762 sender=org.freedesktop.DBus -> destination=:1.407 serial=5 reply_serial=4 string ":1.12" method call time=1623769103.635621 sender=:1.407 -> destination=:1.12 serial=5 path=/org/gtk/vfs/mounttracker; interface=org.gtk.vfs.MountTracker; member=ListMountableInfo method return time=1623769103.636589 sender=:1.12 -> destination=:1.407 serial=242 reply_serial=5 array [ struct { string "trash" string "trash" array [ ] int32 0 boolean false } struct { string "sftp" string "sftp" array [ string "ssh" ] int32 22 boolean true } struct { string "recent" string "recent" array [ ] int32 0 boolean false } struct { string "nfs" string "nfs" array [ ] int32 0 boolean false } struct { string "network" string "network" array [ ] int32 0 boolean false } struct { string "mtp" string "mtp" array [ ] int32 0 boolean false } struct { string "localtest" string "localtest" array [ ] int32 0 boolean false } struct { string "http" string "http" array [ ] int32 0 boolean false } struct { string "gphoto2" string "gphoto2" array [ ] int32 0 boolean false } struct { string "google-drive" string "google-drive" array [ ] int32 0 boolean false } struct { string "ftps" string "ftps" array [ ] int32 21 boolean true } struct { string "ftpis" string "ftpis" array [ ] int32 990 boolean true } struct { string "ftp" string "ftp" array [ ] int32 21 boolean true } struct { string "dns-sd" string "dns-sd" array [ ] int32 0 boolean false } struct { string "davs" string "davs" array [ ] int32 0 boolean false } struct { string "dav" string "dav" array [ ] int32 0 boolean false } struct { string "davs+sd" string "davs+sd" array [ ] int32 0 boolean false } struct { string "dav+sd" string "dav+sd" array [ ] int32 0 boolean false } struct { string "computer" string "computer" array [ ] int32 0 boolean false } struct { string "cdda" string "cdda" array [ ] int32 0 boolean false } struct { string "burn" string "burn" array [ ] int32 0 boolean false } struct { string "archive" string "archive" array [ ] int32 0 boolean false } struct { string "afp-volume" string "afp" array [ ] int32 548 boolean true } struct { string "afp-server" string "afp" array [ ] int32 548 boolean true } struct { string "admin" string "admin" array [ ] int32 0 boolean false } ] method call time=1623769103.638003 sender=:1.407 -> destination=org.freedesktop.DBus serial=6 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='org.gtk.vfs.Daemon'" method return time=1623769103.638034 sender=org.freedesktop.DBus -> destination=:1.407 serial=6 reply_serial=6 method call time=1623769103.640255 sender=:1.407 -> destination=org.freedesktop.DBus serial=7 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='org.freedesktop.portal.Documents'" method return time=1623769103.640291 sender=org.freedesktop.DBus -> destination=:1.407 serial=7 reply_serial=7 method call time=1623769103.640301 sender=:1.407 -> destination=org.freedesktop.DBus serial=8 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=StartServiceByName string "org.freedesktop.portal.Documents" uint32 0 method return time=1623769103.640310 sender=org.freedesktop.DBus -> destination=:1.407 serial=8 reply_serial=8 uint32 2 method call time=1623769103.640916 sender=:1.407 -> destination=org.freedesktop.DBus serial=9 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner string "org.freedesktop.portal.Documents" method return time=1623769103.640941 sender=org.freedesktop.DBus -> destination=:1.407 serial=9 reply_serial=9 string ":1.56" method call time=1623769103.641594 sender=:1.407 -> destination=:1.56 serial=10 path=/org/freedesktop/portal/documents; interface=org.freedesktop.portal.Documents; member=GetMountPoint method return time=1623769103.642135 sender=:1.56 -> destination=:1.407 serial=114 reply_serial=10 array of bytes "/run/user/1000/doc" + \0 method call time=1623769103.643402 sender=:1.407 -> destination=:1.56 serial=11 path=/org/freedesktop/portal/documents; interface=org.freedesktop.portal.Documents; member=AddFull array [ file descriptor inode: 6584 type: file ] uint32 4 string "io.github.celluloid_player.Celluloid" array [ string "read" string "write" ] method call time=1623769103.644233 sender=:1.56 -> destination=org.freedesktop.DBus serial=115 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetConnectionUnixProcessID string ":1.407" method return time=1623769103.644243 sender=org.freedesktop.DBus -> destination=:1.56 serial=91 reply_serial=115 uint32 11294 method return time=1623769103.674671 sender=:1.56 -> destination=:1.407 serial=116 reply_serial=11 array [ string "6e4bc51c" ] array [ dict entry( string "mountpoint" variant array of bytes "/run/user/1000/doc" + \0 ) ] method call time=1623769103.675392 sender=:1.407 -> destination=org.freedesktop.DBus serial=12 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='org.freedesktop.portal.Documents'" method return time=1623769103.675462 sender=org.freedesktop.DBus -> destination=:1.407 serial=10 reply_serial=12 method call time=1623769103.676660 sender=:1.407 -> destination=io.github.celluloid_player.Celluloid serial=13 path=/io/github/celluloid_player/Celluloid; interface=org.freedesktop.Application; member=Open array [ string "file:/run/user/1000/doc/6e4bc51c/%5BSubsPlease%5D%2086%20-%20Eighty%20Six%20-%2001%20(720p)%20%5BB63E54FC%5D.mkv" ] array [ ] ```

If I do e.g.

flatpak run io.github.celluloid_player.Celluloid '/run/media/teohhanhui/Transcend TS2TSJ25H3B/Anime/86/[SubsPlease] 86 - Eighty Six - 01 (720p) [B63E54FC].mkv'

or

gio launch ~/.local/share/applications/io.github.celluloid_player.Celluloid.desktop '/run/media/teohhanhui/Transcend TS2TSJ25H3B/Anime/86/[SubsPlease] 86 - Eighty Six - 01 (720p) [B63E54FC].mkv'

it works, as those bypass the DBus activation.

teohhanhui commented 3 years ago

Commenting out

DBusActivatable=true

in the .desktop file works around the problem... But there really should be more user control over DBus actions. (If I understand correctly, this automatic use of xdg-document-portal is default behaviour of GTK+?)

TingPing commented 3 years ago

flatpak override --user --filesystem=host io.github.celluloid_player.Celluloid would bypass the problem.

teohhanhui commented 3 years ago

flatpak override --user --filesystem=host io.github.celluloid_player.Celluloid would bypass the problem.

I'm already using a similar override:

flatpak override --user --filesystem=host:ro io.github.celluloid_player.Celluloid

It does not work for DBus-activated GActions... Somehow xdg-desktop-portal / GTK+ decides to hijack it anyway.

Please refer to the dbus-monitor output in https://github.com/flathub/io.github.celluloid_player.Celluloid/issues/28#issuecomment-861587856