Code Monkey home page Code Monkey logo

Comments (19)

theel0ja avatar theel0ja commented on July 17, 2024 1

Same issue with .deb version

from desktop.

ascendancyy avatar ascendancyy commented on July 17, 2024 1

The app protocols need to be added to script/electron-builder-linux.yml. In electron-packager the protocols are only used for mapping to CFBundleURLSchemes. Meanwhile the protocols in the electron-builder config are used to add the MimeType entry to the app's desktop file.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

This is an old Electron issue electron/electron#6440 and it looks like it will be available in 1.8.2 electron/electron#10670 (we're on 1.7.9, but 1.8.x is a major Chromium update for us which we usually do with caution to ensure a smooth transition for users).

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

We're currently testing updating Electron to 1.8.2 in Desktop in this PR, so once that is merged I'll prepare a new build and confirm this is resolved.

from desktop.

iAmWillShepherd avatar iAmWillShepherd commented on July 17, 2024

Just tested this in Mint using bump-electron and while it will open up my browser (this is an improvement), it won't attempt to start the auth process. If my browser is open, it starts the auth process but never completes.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

@iAmWillShepherd to troubleshoot further, do you see this code being invoked at all when the app is running - probably needs logging as this is in the main process. Maybe a different set of args is being passed to the app and it's not handling them correctly?

from desktop.

iAmWillShepherd avatar iAmWillShepherd commented on July 17, 2024
function handleAppURL(url: string) {
  log.info(`handeledAppUrl::url - ${url}`)
  log.info('Processing protocol url')
  const action = parseAppURL(url)
  onDidLoad(window => {
    // This manual focus call _shouldn't_ be necessary, but is for Chrome on
    // macOS. See https://github.com/desktop/desktop/issues/973.
    window.focus()
    window.sendURLAction(action)
  })
}

☝️ never get's called for me. I also pulled in the latest changes from master and tried again. No luck.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

We've just released 1.1.1 which is based on Electron 1.8.3, so I'd like to figure out what additional work we need to do in the application to support the protocol handler that Electron should be registering correctly on Linux now...

from desktop.

ThomasThelen avatar ThomasThelen commented on July 17, 2024

This sounds similar to what I just experienced after using the GitHubDesktop-linux-amd64-1.1.1.deb installer.

Summary

When authenticating with oauth & GitHub, Firefox isn't sure what to do with the x-github-client protocol. GitHub Desktop seems to wait (the login spinner spins) for a response (which never gets sent out)

Steps to Reproduce

  1. Launch the app for the first time
  2. Press buttons until you can choose to sign in in a browser, and do so
  3. Go through the OAuth prompts
  4. Confirm password
  5. See the following message from firefox with x-github-client://oauth?code=my_oauth_code as the url
The address wasn’t understood

Firefox doesn’t know how to open this address, because one of the following protocols (x-github-client) isn’t associated with any program or is not allowed in this context.

    You might need to install other software to open this address.

Expected Behavior: Github Desktop tells me that I've successfully logged in

Actual Behavior: Github Desktop stays in a state with a spinning Sign In button.

Browser: Firefox 59.0.2 (64-bit)
OS: Ubuntu Desktop 17.10
GitHub Desktop: 1.1.1
It may be a an issue with the OS/Browser figuring out what to do with x-github-client as the protocol.

Workaround

Just sign in using the email & password boxes in GitHub Desktop

from desktop.

probonopd avatar probonopd commented on July 17, 2024

How is Firefox supposed to know what to do with x-github-client://? Possibly the launcher script in the AppImage would have to copy a little helper file somewhere to "teach" Firefox what to do with this URL?

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

Some extra context on this:

Electron is invoking xdg-settings to associate the running app with a given protocol. The source for that is here.

I'm also pretty sure that Firefox uses XDG to resolve these protocol handlers: https://superuser.com/questions/162092/how-can-i-register-a-custom-protocol-with-xdg

However I can't seem to validate this worked for Desktop v1.1.1 on my Ubuntu VM - this command doesn't emit any output:

$ xdg-settings get default-url-scheme-handler x-github-client

I also get the exact same error from Firefox when trying to complete the auth flow.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

@ascendancyy

Meanwhile the protocols in the electron-builder config are used to add the MimeType entry to the app's desktop file.

Got an example of this that I can adapt? The AppImage options listed in the docs don't seem to mention it, and it sounds like an easy change to introduce and validate especially if it's just related to desktop entries.

from desktop.

ascendancyy avatar ascendancyy commented on July 17, 2024

@shiftkey

It's a top level key - the same values from here.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

I've had some time to poke into this, and before I go and try to upstream this or put together a new build could someone sanity check that this change?

diff --git a/script/electron-builder-linux.yml b/script/electron-builder-linux.yml
index 604bea24e..a58e8e8f0 100644
--- a/script/electron-builder-linux.yml
+++ b/script/electron-builder-linux.yml
@@ -9,3 +9,7 @@ linux:
     - rpm
     - AppImage
   maintainer: 'GitHub, Inc <[email protected]>'
+deb:
+  mimeTypes:
+    - x-github-client
+    - x-github-desktop-auth

Generating this desktop.desktop file for the .deb file:

[Desktop Entry]
Name=GitHubDesktop
Comment=Simple collaboration from your desktop
Exec="/opt/GitHubDesktop/desktop" %U
Terminal=false
Type=Application
Icon=desktop
StartupWMClass=GitHubDesktop
MimeType=x-github-client;x-github-desktop-auth;
Categories=GNOME;GTK;Development;

is what we're expecting to address the issue. @ascendancyy does this seem right?

from desktop.

ascendancyy avatar ascendancyy commented on July 17, 2024

@shiftkey looks good to me

from desktop.

j-f1 avatar j-f1 commented on July 17, 2024

Same issue with the .deb installer on Debian on the Chromebook.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

#110 will fix this for the Debian package, but I don't see this working for AppImage.

The installer seems to have the right .desktop contents:

$ cat squashfs-root/github-desktop.desktop 
[Desktop Entry]
Name=GitHub Desktop
Comment=Simple collaboration from your desktop
Exec=AppRun
Terminal=false
Type=Application
Icon=github-desktop
StartupWMClass=GitHub Desktop
X-AppImage-Version=1.5.1-linux1
MimeType=x-scheme-handler/x-github-client;x-scheme-handler/x-github-desktop-auth;
Categories=GNOME;GTK;Development;
X-AppImage-BuildId=1EfgDfqSKF6gMsmMocvRfpaCmF3

It's just that Firefox doesn't seem to care about it when you complete the browser login flow. For those who want this support I think you'll have to do something like this to connect the AppImage up to your browser: https://askubuntu.com/questions/819782/how-do-i-associate-a-file-type-with-an-appimage

from desktop.

probonopd avatar probonopd commented on July 17, 2024

You will probably need to run the optional appimaged daemon if you want desktop integration, such as associating MimeType=x-scheme-handler/x-github-client;x-scheme-handler/x-github-desktop-auth; to your AppImage.

from desktop.

shiftkey avatar shiftkey commented on July 17, 2024

@probonopd today I learned! Thanks for that clue - if it comes up again down the track I'll see about getting some better guidance for it.

from desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.