-
Notifications
You must be signed in to change notification settings - Fork 279
WIP: Fix SFTP mounting, as much as possible #1921
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
base: main
Are you sure you want to change the base?
Conversation
04c53c4 to
6251a6b
Compare
|
This PR currently also adds a bunch of debugging to the SFTP plugin, which I'm personally inclined to leave in there permanently. (Except for the one bit that dumps out the remote-directory mapping object, that's clearly an unnecessary level of "debug printf" output that I simply forgot I'd left in there.) But debug messages in general, I say: love 'em, want 'em, need more of 'em! One of the things that can be frustrating in working on the GSConnect codebase is that there's precious little output even in debug mode, other than the ubiquitous packet dumps and (if you're lucky) tracebacks from any exceptions caught. Which means that communication-heavy plugins like SMS, connectivity, and MPRIS (now that I've discovered its accidental spamminess, as documented in #1919) can be overwhelming as they incessantly chatter back and forth with the other end of the connection. Which only worsens the problem that operations in other plugins like SFTP, the ones that involve minimal kdeconnect packet traffic, occur in such relative silence that it feels like you have absolutely no idea what's happening on most of the time, and no way to find out, either. ...Oh, and I changed at least one call to the underlying |
I'm away from my computer, so can't test this to confirm, but this sounds a lot like #1794? |
|
@mavit Yup, sounds the same. (Well, I haven't tried using keyboard nav to open the submenu, but even if that works it's not really useful so I'll just assume it does.) |
|
OK, I think I have a plan for this, but it's going to mean a fairly substantial re-re-working of the whole setup. I got to thinking: The thing about the SFTP plugin is, because of the way it works (handing off operation to Gvfs completely), mounted shares aren't really tied to the device at all. You could shut down GSConnect, the mount would still be there. You could unpair the device, the mount would still be there. It's even theoretically possible that you could disconnect the device from GSConnect, and the mount would still be there. (Probably not, because it would be disconnected from SFTP as well, but it's theoretically possible.) The mount can also be disconnected outside the control of the device, by the user Ejecting it in Nautilus/Nemo/etc. (It can be created the same way, if KDE Connect hasn't shut down its SFTP server, but let's ignore that.) So, because (once mounted) a device's shared filesystem really has nothing to do with that device anymore, I think the mounts list should be taken out of the device menu. Instead, I want to add a new section to the GSConnect menu, above the device list, that shows mounted shares from any/all devices. Each would be labeled (in a translatable string, for locales where the :-separated label doesn't make sense) as So, if I Mount the remote storage of my Samsung Galaxy A53 phone, the menu would show this: When I unmount the (last) share, the entire "Mounted Shares" section disappears. If the device disconnects, but the mount is still there, it stays and only the device section is removed. So, effectively, the monitoring of mounts would be taken out of the hands of the SFTP plugin, and given to a new GSConnect service. The device plugins would be responsible for:
Now, don't ask me (a) how I'm going to represent this in panel mode, or (b) how I'm going to represent it in the GSConnect preferences interface. Because I have no idea. |
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 pretty good to me. Probably some nifty JS tricks that could be used, but the code is very readable.
👍 from me, assuming it's tested in the real world :)
Add a new utility module for file/directory tools. Currently it contains only the filesystem-name sanitization code that used to live in service/plugins/sftp.js (used when creating filesystem objects with names based on device names).
Remove `_listDirectories()` from the SFTP plugin code, and never
try to probe the root of the remote device mount (since it's
always a permission-denied path on Android). Instead, use the
`multiPaths` / `pathNames` keys in the SFTP packet body to
determine the director(y/ies) on the remote device.
Instead of creating a single symlink to the device's root path
in the `by-name` directory, turn the `by-name/${device_name}`
path into a directory, populated on mount with a symlink to each
of the device paths supplied in the packet.
Build the `Files` menu for the device with a list of these shared
path names, each of which (although KDE Connect seems to be back
to just a single shared directory, again) will open the remote path
associated with that share-name. Unmounts (either explicit via the
Files submenu, or observed) will remove these symlinks from the
device directory (which is kept around for future mounts).
6251a6b to
16b80c4
Compare
|
Thanks for reminding me, I realized that I should change the address to |
Remove
_listDirectories()from the SFTP plugin code, and never try to probe the root of the remote device mount (since it's always a permission-denied path on Android). Instead, use themultiPaths/pathNameskeys in the SFTP packet body to determine the director(y/ies) on the remote device.Instead of creating a single symlink to the device's root path in the
by-namedirectory, turn theby-name/${device_name}path into a directory, populated on mount with a symlink to each of the device paths supplied in the packet.Build the
Filesmenu for the device with a list of these shared path names, each of which (although KDE Connect seems to be back to just a single shared directory, again) will open the remote path associated with that share-name. Unmounts (either explicit via the Files submenu, or observed) will remove these symlinks from the device directory (which is kept around for future mounts)....This all works great, from the Preferences device interface. If I open the "Mobile Settings" interface, click on my paired device, and use the vertical ellipsis (︙) menu, I can choose "Mount" to mount the remote share, and that menu entry is replaced with a "Files" submenu that, when entered, shows the name of my remotely-accessible share ("Internal Storage", on my Samsung phone) and the "Unmount" option. I can click "Internal Storage" to open the URL of the remote path, or "Unmount' to disconnect and turn the "Files" submenu back into "Mount".
Yay, right?
Only problem, it completely breaks in the user menu. For some reason, there, the Files submenu doesn't work at all. It shows up when "Mount" is activated, but attempting to enter it just closes the user menu instead of revealing the submenu contents.
So, until that's fixed, this gets draft status. Ideas on how to fix that (along with any other reviews) more than welcome!
(If/when it actually works right...)
Fixes #1203
Fixes #1861
Fixes #1857
Fixes #1794
Fixes #1610
...and probably more beyond that.