Is there a way to package chrome apps using nodejs-webkit - node.js

Lets say i have an app and i want it to be executable standalone. I've found that you can do that with normal webpages, webapps, using https://github.com/rogerwang/node-webkit.
But if its chrome packaged app how do you do that.
I know it's possible as you can see in slides it uses webkit.
https://speakerdeck.com/u/zcbenz/p/node-webkit-app-runtime-based-on-chromium-and-node-dot-js

Theoretically it is possible but you will have to implement by hand all of the chrome apis you use in your chrome app

Related

Chrome extension accessing UWP app?

We have chrome and FF extensions which works with a native messaging app. Recently we developed edge extension and a UWP app which works in the same way. Now the user has to install two separate native messaging apps if they want use any chrome/FF/Edge browsers.
My question is, is it possible for Chrome/FF extension talk to windows UWP app?
Unfortunately no. On Windows, both Chrome and Firefox use the registry to locate the native applications manifest, and Windows Store apps are forbidden from writing to the registry. (ref: Prepare to package an app (Desktop Bridge)
If something changes (Store apps gain the ability to alter the registry, or Chrome and Firefox introduce an alternative way to locate the manifest), then it might be possible. Though likely not via the UWP app directly. UWP apps appear to support standard input and output, but the way they are run prevents access to it. It might however be possible to create an intermediary Win32 app that can communicate with the UWP app via the AppService and the browser extension via stdio.
Afterthought: Enpass Password Manager (win32) was ported to the Windows Store reportedly because of API issues, and has a browser extension for Chrome and Firefox. Might be worth asking them how they pulled it off. I did some more digging, and figured it out. localhost loopback, a custom url scheme, web sockets, and browser verifications is how they are doing it. Not an ideal solution, but it seems to work.

running headless chrome in an microsoft azure web app

I am currently using phantomjs to generate screenshots of web pages.
Due to various issues including web fonts, and video tag support, I would like to try switching to headless chrome.
Has anyone had success running headless chrome in an azure web app?
I cannot find a .net api, and assume I need to run node.js with puppeteer If I want a javascript api similar to phantomjs.
Right now most of the big libraries are made for NodeJS. It's possible to run Chrome headless without it, but you'll need a library for your .NET API to effectively communicate with Chrome. If none exist, then the protocol itself is documented here, and you could build one for .NET.
If you're struggling to get Chrome running on Azure I have a service that offers Docker images, which could be as simple as a few commands to have up and running (located here). Other than that there's a few open-source options out there, but they have differing issues and uses-cases.

Get list of Chrome extensions from Chrome app

I have a Chrome extension that uses the chrome.management API to get a list of installed Chrome extensions and apps. The problem starts because I also want to use the chrome.syncFileSystem API which only seems to be available to Chrome apps.
If I switch the extension to an app, I can no longer use the chrome.management API. I haven't been able to find an API to access the installed extensions from an app. Any tips?
I don't think you can, not without having both an extension and an app.
Google has a private API to do that, but for public API, they want apps to be as independent as possible from the browser.

Global(system) hotkeys for chrome extension

Is it possible to create system hotkeys/shortcuts for Google Chrome Extension? I mean hotkeys that also works when Chrome doesn't have focus.
Yes, but it won't be trivial. To get truly global hotkeys you will have to use native messaging. You will need to create some application to run in the background and capture keypresses and then you can send those keypresses back to Chrome through stdout. This approach will require you to create an additional installer for your extension to install the native messaging app onto the user's system...before you could bundle your app along with the extension (using NPAPI) but that has recently been phased out. I have seen some discussion in the Chromium group about adding bundling support for native messaging apps, but nothing has been added (yet).
Another much easier option is to use the Chrome commands API which will enable you to use hotkeys across all Chrome windows (but not globally...). Just something to consider if "true" global hotkeys are not an absolute requirement since this approach is (much) less complex.
Global media keys will be added to Chrome soon, however. There is a good discussion about this feature to read here.
It's now part of Chrome: chrome://extensions/shortcuts

Do I need to create both an extension & packaged app if I want chrome.socket and Context Menus?

I am developing a chrome extension/app that requires
communicate with Intranet services in UDP binary protocol using chrome.socket APIs
need to extract DOM content from non-app web pages. This could be done using bookmarklet, Browser Actions, page actions, or chrome context menus.
There are two chrome.contextMenus APIs
http://developer.chrome.com/apps/contextMenus.html
http://developer.chrome.com/extensions/contextMenus.html
One for Packaged App, another for Extensions. The former only insert contextMenus to Packages Apps, not normal web pages.
If I need both chrome.socket & invoking from normal webpage capability, do I need to create both an extension as well as an app? That would be very confusing to end users.
Yes, you need both the app and the extension. Apps are intentionally devoid of APIs that modify web pages. That's where extensions come in.
I ran into the same problem and had to make two separate apps for exactly the same reasons. (JSTorrent contextmenu extension && JSTorrent).
I believe there are ways to trigger the install dialog from one to the other, but I have not tried to do this yet. If somebody had examples for how to do this, that would be great to add here!
Consider using <webview> in an app. You'll be able to display web content there, and you can more easily communicate between the app and the content. It will result in a single installable item.

Resources