Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.54k stars 43 forks source link

KDE Context menu extension does not work with containerized (podman) syncthing #213

Closed 31j closed 6 months ago

31j commented 8 months ago

Relevant components

Environment and versions

Bug description When using syncthing docker image in a rootless podman container, the KIO integration does not correctly detect if a folder is being synchronized by syncthing. I presume this is likely because the directory structure the container sees and reports in its configuration file is not reflective of the actual directory structure of the host.

e.g. my Zotero attachments are stored in /var/home/user/SyncedDirs/Zotero/ on the host system, but this is mapped to /SyncedDirs/Zotero/ in the podman container.

Example Podman Run Conditions

podman run -d \
  --name=syncthing \
  --hostname=Laptop \
  --label io.containers.autoupdate=registry \
  --userns keep-id \
  -p 127.0.0.1:8384:8384 \
  -p 22000:22000/tcp \
  -p 22000:22000/udp \
  -p 21027:21027/udp \
  -v ~/.config/syncthing:/var/syncthing/config:Z \
  -v ~/SyncedDirs/:/SyncedDirs:Z \
  -v ~/Music:/Music:Z \
  docker.io/syncthing/syncthing:latest

Steps to reproduce

  1. Install syncthing as a podman container, the above example config would map the config directory to the actual normal config location, and would permit the container to access ~/Music and ~/SyncedDirs
  2. Install the syncthingtray yum repo for Fedora 39
  3. Layer syncthingfileitemaction and syncthingplasmoid packages with rpm-ostree install
  4. Reboot into new OS image
  5. Open Dolphin, navigate to a synced dir, context menu does not detect a dir is synchronized

Expected behavior Ideally the plugin would detect the dir is synchronized, could it perhaps fallback to detecting an .stfolder within a directory or manually adding synced dirs.

Additional context Of course, the plasmoid also depicts the dirs as they are mapped in the podman container, although I feel this behaviour is correct as it is how it is reported in the web-gui as well.

I don't expect this issue to be fixed as the proportion of users using a podman / docker setup on a desktop OS rather than a server are probably quite small and even then only ~10k users of the docker hub & linuxserver dot io containers are shown in the official analytics. Regardless, I still thought it was best to report the issue. I might test this more (if I have the time) in a VM without the --userns keep-id option, and perhaps with docker as well.

31j commented 8 months ago

Additional Context pt2. The run parameters of the podman container are stored within a systemd unit file in ~/.config/systemd/container-syncthing.service. Would it be hypothetically possible for syncthingtray & the KIO plugin to determine the folders from there rather than the config.xml file in ~/.config/syncthing. Syncthingtray already can detect that unit file (it does need to be manually added), but I feel like adding the code to parse it for podman, docker etc folder mappings is not really worth your time / out of the scope of the project.

Martchus commented 8 months ago

You could use the environment variable LIB_SYNCTHING_CONNECTOR_SYNCTHING_CONFIG_DIR to change the lookup path for the config (as documented in the README). In case of the connect menu you need to set the variable when launching Dolphin or other KDE applications using KIO.

Note that this is not a bug but a feature request.

Martchus commented 8 months ago

If that's not sufficient you could indeed try to implement a more sophisticated lookup. I have nothing against such a PR. Currently my focus for the KDE integration is on porting to KF6 which is already more effort than expected.

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.