nativefier / nativefier

Make any web page a desktop application
MIT License
34.9k stars 2.21k forks source link

Add basic "Navigate to URL" feature, e.g. to follow a URL obtained from a side channel #1072

Open barrenreaction278 opened 3 years ago

barrenreaction278 commented 3 years ago

Hi The website* I've created a ubuntu "app" via nativefier sends an email url that needs opening in the specific "browser" to verify that that browser/device is being used by the account owner after username/password and 2fa has been inputted. So if I just go to the url via my default browser it states device cant be verified as its the wrong browser. And I cant log in through nativefier app

Is there a way to "paste" the email verify url within nativefier so I can verify the browser? Thanks Using Ubuntu 20.04 via vmware workstation (Windows Server 2019)

ronjouch commented 3 years ago

@barrenreaction278 eh, true, not easy to do with current Nativefier. I renamed the issue to suggest we should add the feature you're mentioning.

In the meantime, workaround:

  1. Open <your-nativefier-app-folder>/resources/app/nativefier.json, then paste your validation url in the targetUrl field (careful to not barf the JSON!)
  2. Restart your app
  3. Pass validation, be logged in
  4. Leave the app
  5. Restore a normal "home" targetUrl for your app.
djantzen commented 3 years ago

I have a somewhat related request. I want to open up links received via chat or email in a new tab in the appropriate Nativefied app. Using the Finicky tool I can get the right app to open based on URL, however it just opens the app with the targetURL or foregrounds the app with whatever is currently loaded. Finicky is issuing commands to the OSX utility open: e.g., "open /Applications/Clubhouse.app --args https://app.clubhouse.io/rest-of-url". Is there a way to capture that URL argument and spawn a new tab using it as the targetURL?

vergenzt commented 3 years ago

Alternative workaround for now: you can open up devtools, and run location.href = "<your_url>" to navigate to a page.

WCByrne commented 3 years ago

Someway to open links would be a big win. I'm actually using Nativefier with Clubhouse as well and since our team shares lots of links I'm constantly ending up back in the browser with no easy way to open them in the my Nativefier Clubhouse app. Obviously the ideal would be some sort of url scheme handling but that seems like it would require the CH site to be involved, or perhaps a browser extension. But even just a "Paste and go (to url on clipboard)" would suffice.

bpartridge commented 3 years ago

On macOS, adding something like the following into Info.plist should cause https://www.electronjs.org/docs/api/app#event-open-url-macos to be triggered - we'd just need to handle that as if it were a custom protocol, but by registering that we can handle e.g. https:// URLs, I believe it will be called.

        <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>com.fluidapp.FluidApp2</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>http</string>
                <string>https</string>
            </array>
        </dict>
    </array>

Docs: https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleurltypes

Not sure how to get electron-packager et. al. to emit this into the Info.plist though - if anyone can research, this should be an easy fix!

bpartridge commented 3 years ago

Following up on the above, it seems this is in fileAssociations.protocols in the electron-builder config:

https://github.com/electron-userland/electron-builder/blob/4a177dc01c9119443426f1eb500afb836fd4f381/packages/app-builder-lib/src/electron/electronMac.ts#L175

https://www.electron.build/configuration/configuration.html#overridable-per-platform-options

voltechs commented 2 years ago

@bpartridge is this the way to get "https://app.asana.com" links to open in the asana app, for example? Or if I made an app for meet.google.com for example, all "https://meet.google.com" links would try to open in that native-fied app?

thomasbachem commented 1 year ago

This was fixed in #405 afaik.