-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mount /sdcard/ #1801
base: main
Are you sure you want to change the base?
mount /sdcard/ #1801
Conversation
android apps without root access can only access /sdcard/
While that's true, I'm not sure it's that simple. Looking at the latest KDEConnect Android app, I see the Filesystem Expose preferences seem to have vanished again, so you can no longer configure multiple shared storage locations. In the past, after giving filesystem access permission, you'd be able to select one or more device locations to share, and they'd be exposed with the pathnames the user set. For example, here's the {
"id": 1715569869701,
"type": "kdeconnect.sftp",
"body": {
"ip": "L.M.N.O",
"port": 1739,
"user": "kdeconnect",
"password": "XXXXXXXXX",
"path": "/",
"multiPaths": [
"/primary",
"/primary/DCIM"
],
"pathNames": [
"primary",
"DCIM"
]
}
} ...Now, that never worked very well, and it looks like it's gone again. The latest version of the app has no filesystem-expose preferences, and when it's activated and GSConnect tries to mount, this is the packet that comes back instead: {
"id": 1715570673060,
"type": "kdeconnect.sftp",
"body": {
"ip": "L.M.N.O",
"port": 1739,
"user": "kdeconnect",
"password": "XXXXXXXX",
"path": "/storage/emulated/0",
"multiPaths": [
"/storage/emulated/0"
],
"pathNames": [
"Internal storage"
]
}
} Point being, I don't think there's a simple mapping. Your device is probably responding with a packet that includes: "path": "/sdcard",
"multiPaths": [
"/sdcard"
],
"pathNames": [
"Internal storage"
] We likely need to start picking up that (If you could confirm that the |
@@ -222,7 +222,7 @@ const SFTPPlugin = GObject.registerClass({ | |||
|
|||
// This is the actual call to mount the device | |||
const host = this.device.channel.host; | |||
const uri = `sftp://${host}:${packet.body.port}/`; | |||
const uri = `sftp://${host}:${packet.body.port}/sdcard/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm right, then this should be...
const uri = `sftp://${host}:${packet.body.port}/sdcard/`; | |
const uri = `sftp://${host}:${packet.body.port}/${packet.body.path}/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct if we're happy to access only the Android device's internal storage.
However, if I plug a USB thumb-drive into my phone, I get:
"path": "/storage/emulated/0",
"multiPaths": [
"/storage/emulated/0",
"/mnt/media_rw/301B-13FB"
],
"pathNames": [
"Internal storage",
"Lexar USB drive"
]
We should probably mount each of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugggh, that's really ugly. The worst part of it is, the packet.body.path
is no longer even an ancestor of both (all) of the multiPaths
listed. I was hoping at least browsing packet.body.path
and seeing both of the mounts under it would be possible.
Given the data you've provided, I agree — we should stop trying to browse a single "device filesystem root" at all, and just separately mount each of the multiPaths
entries, however meany there are.
In theory we could have UI to select which one to mount, but that already feels more complicated than necessary. If the user has multiple filesystems exported on the device, and chooses to mount it, they should just get all of them.
But it's even more clear now that we should never try to browse either sftp://${host}:${packet.body.port}/
or sftp://${host}:${packet.body.port}/${packet.body.path}/
, since neither one represents the root of the remote filesystem. (There is, in fact, no path that does.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The really sucky thing is that, if I'm interpreting this right, there isn't going to be anything to indicate which mount point is which. I don't think we can set volume labels on the remote mount points, and I'm not sure GVFS will pick them up from the KDEConnect side either.
I guess we can modify _addSymlink
to create ${by_name_dir.get_path()}/${safe_device_name}
as a directory, instead of as the symbolic link itself, and then create one symlink for each mount point inside that directory. Then at least we'll have a mapping of the remote mount points to their names.
@lollilol I've updated your branch to be in sync with |
We'll likely need to get rid of the Mount submenu, as well — it used to be, the contents of gnome-shell-extension-gsconnect/src/service/plugins/sftp.js Lines 337 to 352 in 883a8f6
|
That'll mean eliminating the |
Yeah, this is the kdeconnect-android commit that switched over to using |
Changing the uri to add the path to it, whether its |
That may be because we're using gnome-shell-extension-gsconnect/src/service/plugins/sftp.js Lines 223 to 229 in 3758807
Unfortunately, with Gvfs I don't believe there's any way to actually mount any path deeper than the root, nor is there a way to set up multiple mounts to different paths on the same remote host. Even if a mount is done to a deeper path, you'll always be able to (attempt to) browse to any path on the server, and if you can't access a given path you'll get permissions errors. The mounted path is more of a "bookmark" to a certain location on the remote server. And the problem is, that bookmark is created by Nautilus semi-"automagically", and may be special-cased to Because, on login I run just And from the Gvfs perspective, the mount is still just to $ gio mount -l
Drive(0): TEAM T253X2001T
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Drive(1): TSSTcorp DVD+/-RW TS-H653F
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Volume(0): [email protected]
Type: GProxyVolume (GProxyVolumeMonitorGoa)
Volume(1): [email protected]
Type: GProxyVolume (GProxyVolumeMonitorGoa)
Mount(0): ferd on $FILESERVER -> sftp://ferd@$FILESERVER/
Type: GDaemonMount It's possible there's no way to get Nautilus to add a "bookmark" pointing to anywhere other than In which case, unless we want to make users browse to their deeper paths "by hand" (and only by typing the path in, to avoid permission errors accessing parent directories), we're back to not being able to do what we need... short of writing a GSConnect Gvfs plugin, to handle (EDIT: It's also worth noting that $ sftp ferd@$FILESERVER
Connected to $FILESERVER
sftp> pwd
Remote working directory: /home/ferd ...So, that may be what determines that the "bookmark" mount should point to that path. Not sure if that's based on the home directory path in the remote |
I can set actual bookmarks to deeper paths on my fileserver, and Nautilus will respect those and navigate directly to them — it'll even auto-mount So, if we could insert bookmarks into Nautilus for paths on the remote server, that might be a workaround... but I'd be shocked if there's an API that would let us manipulate the Nautilus bookmarks list on the user's behalf. |
(This is all made immensely harder by the fact that the SFTP service on the paired device is only open when explicitly requested, and will migrate to different ports at random — EVEN IF we're lucky enough that the actual IP address doesn't change. So any bookmarks would have to be very transient, because they'd get invalidated practically the moment we created them. Which... is a really terrible definition of "bookmark".) |
android apps without root access and permission granted
MANAGE_EXTERNAL_STORAGE
can only access/sdcard/
when trying to access
sftp://192.168.178.21:1739/
this error appears:after appending
/sdcard/
to the sftp uri, i was able to successfully connect: