gnome-shell-extension-gsconnect icon indicating copy to clipboard operation
gnome-shell-extension-gsconnect copied to clipboard

Handle incoming traffic while not logged in

Open boblun opened this issue 2 years ago • 3 comments

The issue: From what I can see the DBUS connection to the server process only exists while a user is logged in. In my case I have a directory monitored for files, whenever a text file appears in that directory a script sends that file to the correct recipient via SMS - This allows me to use SMS remotely - internationally - without roaming charges. I can attach the SMS file creation to a Web server or drop a file in the correct directory. I want also to be able to see incoming SMS messages - the same way, In a directory and in my case I want to forward them to an email (SMS to e-mail gateway). All this I want to do while a user is NOT logged in - Ie using cron scripts or for received SMS messages perhaps a user handler.

What I'd like I'd like a way to operate GSConnect cli when a user isn't logged in - maybe this already works but I can't seem to configure it. This may be that GSConnect needs to talk over the system DBUS rather than a transitory user DBUS connection. Al alternative client to server backend would also work.

I'd like daemon.js to support retrieving SMS messages and passing them to a user defined handler. If you felt inclined you could build usefull agents into daemon.js eg daemon.js --forward-messages mailto://my.email.@address and daemon.js forward-sms file://directory.

In order to support this there might also need to be a delete-sms feature so I can prune the phones SMS database, but clearly SMS messages would have to be limited to new ones in some way. Deleting the messages from the phone after retrieval is only one way.

Alternative approaches I haven't found any alternatives to adding a get-sms /forward-sms feature and changing the communication method to allow communications while not logged into a Gnome Desktop, It may be possible to run a desktop using xserver-xorg-video-dummy to get a security context but I've not tried this. Nor have I found a way to get gsconnect to work while logged out because the DBUS connection doesn't exist if daemon.js is run from a crontab. Sending SMS works while logged in and in theory I could probably use the graphical app (Leave it on-screen) to retrieve e-mails then write a daemon to monitor the incoming notifications and handle them when they arrive - but the security context is non existent - I have to leave the computer (And the phone) logged in... Baaaad! This metthod is a whole lot more workthat adding get-sms to daemon.js but unfortunately my Javascript skills aren't up to rolling my own fork with these features, so here's hoping you are interested.

System: I use Ubuntu and have checked all versions of GSconnect for get-sms/forward-sms support in the cli

boblun avatar Jun 09 '22 23:06 boblun

Thanks for your interest!

All this I want to do while a user is NOT logged in - Ie using cron scripts or for received SMS messages perhaps a user handler. [...] I'd like a way to operate GSConnect cli when a user isn't logged in - maybe this already works but I can't seem to configure it.

This is unfortunately not possible. GSConnect (and KDE Connect) is unavoidably a user service, so unless you plan on running it as root (a bad idea) there's just no way for this to be done. GSConnect also needs a display (ie. X11/Wayland) to run, which is pretty much a no-go for system services.

I'd like daemon.js to support retrieving SMS messages and passing them to a user defined handler.

This is possible, but to be blunt would require someone coming forward to contribute it. GSConnect is effectively community-maintained now, so large features are unlikely to come from one of the repository maintainers, unless they want it for themselves. The reasonable way to do this would be with a D-Bus interface emitting a signal, but the same caveats apply to the previous note about user vs system services.

In order to support this there might also need to be a delete-sms feature so I can prune the phones SMS database, but clearly SMS messages would have to be limited to new ones in some way. Deleting the messages from the phone after retrieval is only one way.

This is not supported by the KDE Connect protocol, so this request would have to go through the upstream project before it could be implemented in GSConnect.

andyholmes avatar Jun 10 '22 22:06 andyholmes

Ok, thanks. I appreciate the response. I guess logging the user into the dummy Xserver is the only way to go.

On 11 June 2022 8:35:22 am AEST, Andy Holmes @.***> wrote:

Thanks for your interest!

All this I want to do while a user is NOT logged in - Ie using cron scripts or for received SMS messages perhaps a user handler. [...] I'd like a way to operate GSConnect cli when a user isn't logged in - maybe this already works but I can't seem to configure it.

This is unfortunately not possible. GSConnect (and KDE Connect) is unavoidably a user service, so unless you plan on running it as root (a bad idea) there's just no way for this to be done. GSConnect also needs a display (ie. X11/Wayland) to run, which is pretty much a no-go for system services.

I'd like daemon.js to support retrieving SMS messages and passing them to a user defined handler.

This is possible, but to be blunt would require someone coming forward to contribute it. GSConnect is effectively community-maintained now, so large features are unlikely to come from one of the repository maintainers, unless they want it for themselves. The reasonable way to do this would be with a D-Bus interface emitting a signal, but the same caveats apply to the previous note about user vs system services.

In order to support this there might also need to be a delete-sms feature so I can prune the phones SMS database, but clearly SMS messages would have to be limited to new ones in some way. Deleting the messages from the phone after retrieval is only one way.

This is not supported by the KDE Connect protocol, so this request would have to go through the upstream project before it could be implemented in GSConnect.

-- Reply to this email directly or view it on GitHub: https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/1385#issuecomment-1152781351 You are receiving this because you authored the thread.

Message ID: @.***> -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

boblun avatar Oct 11 '22 07:10 boblun

I'd like a way to operate GSConnect cli when a user isn't logged in - maybe this already works but I can't seem to configure it. This may be that GSConnect needs to talk over the system DBUS rather than a transitory user DBUS connection. Al alternative client to server backend would also work.

I'd like daemon.js to support retrieving SMS messages and passing them to a user defined handler. If you felt inclined you could build usefull agents into daemon.js eg daemon.js --forward-messages mailto://my.email.@address and daemon.js forward-sms file://directory.

It might even be worth looking at whether KDE Connect itself can be made to support what you're trying to do, on the Linux side. kdeconnectd can be run headless (via the standard Qt -platform offscreen flag), and once you're talking about a system service running outside of GNOME Shell there's really no advantage to using GSConnect over kdeconnectd.

ferdnyc avatar Oct 13 '22 14:10 ferdnyc