Question: Supported Interface for Online Accounts or Mounted Servers

I’m wondering what Interface to choose in order to let users access data on a mounted server - let’s say I have a Google Drive (via Online Accounts) mounted in my Ubuntu Files and I want to let people access it through an app. The most intuitive would be to let the app access the files through a file select, however in the list of folders only my local ones show up and not said Google Drive.

I’m pretty sure it’s not “removable-media” and I wonder if it’s “network-manager”. Has anyone got experience in that matter and would like to share their insights?

1 Like

Is your snap a graphical application using portals ? If so then AFAIK any directory should show up in the file select window, but if you are not using portals then it depends on where the directory is being mounted locally for users to see outside of the snap.

2 Likes

@hideosnes. thanks for supporting on the topic here. I followed @ijohnson suggestion and added portal support, as described here https://snapcraft.io/docs/xdg-desktop-portals

The only problem is that Electron support is still being worked on at the moment and maybe still missing as mentioned in the article. But it can’t hurt to test the latest build.

Portal support is included in the latest edge build of sleek

sudo snap install --edge sleek

I cannot vouch for it to work though, as I don’t have any network shares at the moment.

1 Like

A good test would be to see if you can open a file stored in /tmp on the host system.

Strictly confined snaps run with a custom mount namespace that provides a private version of /tmp that won’t see any files from the host system. If you can see host system /tmp files in the file chooser and actually open them, then it would indicate that portals are working.

image

It is possible to access the tmp folder. But only specific files, propably snap related ;), are being listed.

For comparision, this is how tmp looks like in my file explorer:
image

In that case, you are not seeing an xdg-desktop-portal file chooser.

Ah I see, this is something I need specifically to trigger out of the app? And that might be the restriction of Electron apps, that is mentioned in the Snapcraft documentary.

Yes, it needs application support. GTK apps get it for free if they use the GtkFileChooserNative API. I think there is still some work to be done on the Electron side.

What essentially happens is that instead of presenting the file chooser itself, the application makes a D-Bus call to xdg-desktop-portal asking it to present a file chooser on its behalf. As xdg-desktop-portal is running outside of the application sandbox, it can see everything on the host system.

If the user picks a file in a location inaccessible to the sandboxed app, then the file name will be rewritten to a location served through a special FUSE file system that will only expose files the app has been granted access to. With a compatible app it should look like the app can access any file the user can see, while ensuring the app can only acess files the user has selected through the file chooser.

1 Like

Ok, so @hideosnes until the Electron project has been enhanced by this, it can’t be part of sleek. As soon as this has happened, I will switch to GtkFileChooserNative API.

As a workaround you can try to manually mount the share you would like to access with sleek in your home folder or /mnt/, both can be accessed with sleeks file chooser.

1 Like