squalou / google-chat-linux

source of a fork of google-chat-linux unofficial client from robyf
50 stars 10 forks source link

Support navigation from web browsers to the app #84

Closed pbabinca closed 9 months ago

pbabinca commented 9 months ago

This requires User script https://greasyfork.org/en/scripts/481609-google-chat-alt-landing-page on extension(s) that are able to work around content security policy (CSP) headers - currently tested with Tampermonkey (see https://github.com/Tampermonkey/tampermonkey/issues/952#issuecomment-638373937 ) and it didn't work with Greasemonkey.

Once that is installed the user intercepts loading of https://chat.google.com/ with a static page that informs people that the link will be opened in an app like this:

Screenshot 2023-12-07 at 14-33-22 Google Chat Alt landing page

Technically it loads iframe with src where https:// of the Google Chat page was replaced with a psedo-scheme "gchat://".

Then following happens on the google-chat-linux end:

When generating XDG Desktop file claim support of gchat:// scheme (see https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#uri-schemes-handling ). If an URL with this scheme is passed on the command line replace that scheme with https:// one and navigate to that URL. This works for both new instance and when an instance is already running - for "second-instance".


I was inspired by similar approaches used by:

squalou commented 9 months ago

Nice, and if I understand well : for users without extension installed it is completely transparent right ?

Maybe a word in doc would be nice - even if the readme is beginning to be a mess - I never tidied it up enough :)

pbabinca commented 9 months ago

Nice, and if I understand well : for users without extension installed it is completely transparent right ?

That's correct.

Maybe a word in doc would be nice - even if the readme is beginning to be a mess - I never tidied it up enough :)

I put one or two words in the updated commit. :)

pbabinca commented 9 months ago

Reading admin section of Greasy Fork:

Greasy Fork can import scripts that already hosted elsewhere, for example in a version control system (like GitHub), your own server, or another user script hosting site.

Would you like me to put the script in this repo?

Then, for better control I read more there:

You can add other Greasy Fork users as authors of this script. They will have the same rights as on this script as you do.

Would you like me to invite you to get admin privileges on that script on Greasy Fork? (I guess you'll need to create an account and give me link to your profile there)