NWJS SDK is not using package.json - sdk

I am using NWJS to create a desktop app. The package.json file determines the settings. This works fine, but only in the distribution version.
{
"name": "My NWJS project",
"main": "index.html",
"window": {
"title": "Testing NWJS",
"kiosk": false,
"toolbar": true,
"frame": true,
"no-edit-menu":false
}
}
Now I want to debug with F12 (browser inspector), so I have to use the SDK version of NWJS. Problem: This SDK version ignores the package.json file. NWJS just opens with a generic window showing the version number.
nw.js v0.35.0
Node v11.3.0
Chromium 71.0.3578.80
If I drag and drop the desired HTML file into the NWJS window, the app won't load at all because AJAX requests aren't allowed in a file context. (the same as when you open the HTML file by double-clicking on it in the finder).
There is no explanation to be found on the 'debugging with devtools' page.

You can execute your app from the commandline. I'm on a mac, so (if I'm in the root directory of nwjs) I can run:
nwjs.app/Contents/MacOS/nwjs .
The docs are here: http://docs.nwjs.io/en/latest/For%20Users/Getting%20Started/#getting-started-with-nwjs
Based on what it says there, on windows you should be able to do:
nw.exe .
I have no idea why it doesn't work the same as the normal / non-sdk version, where you can just double click. However, this does work, so you can access debug features.

Related

Codesigning electron app for windows (on windows)

As it says in the title, this is what im trying to do: using windows 10, codesign my electron app using the certificate purchased from a third party vendor (which is in p12 format).
I've read the docs here: https://www.electron.build/configuration/win and here: https://www.electron.build/code-signing
And realise that I need to provide a path to the certificate file and password (if one is set) using the appropriate keys (certificateFile and certificatePassword).
I've also seen these answers:
How to sign in windows installer using electron builder
(There's also loads of questions and answers referring to people building for windows on mac, but that's not what im doing here)
But this doesnt seem to address the question.
These are how the lines in my package.json are set referring to the relevant path/password:
"certificateFile ": "./certificate_file.p12",
"certificatePassword ": "password"
I realise that it is better to have these set in a .env file and read them from there, which I intend to do later. But as I understand it, this should suffice shouldnt it?
My build command is:
"build": "electron-builder build"
And this produces the following:
But there is no mention of signing taking place at all. If Im being royally stupid, please feel free to point out where ^_^ many thanks in advance!
Updates
Queried with project maintainers on github, code signing is supposed to take place automatically provided the variables are set correctly, see convo here: https://github.com/electron-userland/electron-builder/issues/6895)
It may be significantly simpler to sign your exe OUTSIDE of electron builder. In which case, the approach I took was to use SSL.com's SSL manager GUI.
You can read about it toward the bottom of this page and see their documentation of the tool here.
About a week looking into codesigning with electron builder, still not entirely sure how to do it.
About 5 mins using this tool. Done.
I don't remember the whole process but I had to fumble around for a few days to get it working.
In my package.json file I have a build object like this:
"build":
...
"win": {
"certificateFile": "private/mycertificate.pfx",
"verifyUpdateCodeSignature": true,
"publisherName": [
"My Company Name"
]
},
Then before publishing I run this in windows powershell to set the env variable:
setx CSC_KEY_PASSWORD my-certifcate-password-here
Then finally:
electron-builder -w

Can Firefoxe's web-ext utility be made to open an extension page on start with -u?

As far as I understand, each time an extension is reloaded, it gets a new moz-extension:// URL with a new UUID. This makes it impossible to know the extension page URL I want to use with web-ext run -u in advance. This makes web-ext almost worthless for me because I have to (manually) open the page I need to run my tests on. If I knew the URL beforehand I could just pass it to web-ext and do everything completely automatically, and with a headless FF. Is there a way around this?
After some fiddling I finally managed to have web-ext open a page with moz-extension schema on browser start.
The only way (that I found) to open this page with an extension context (and test the page correctly) and not as an ordinary file:// is to use a moz-extension://<internal UUID>/path/to/extension/page/from/extension/root type URI to access it.
The problem is, as a temporary extension, it always has a different UUID that is not preserved between re-installs, so there is no way of telling web-ext to open an extension page via -u while using the defaults.
This is where this helpful documentation page comes in. It mentions the extensions.webextensions.keepUuidOnUninstall option in about:config that does exactly that. So a profile has to be created that has this option set to true, and used with web-ext -p option.
The next problem I had was that the page would silently fail to open. Apparently Firefox was attempting to open the page before the extension was installed. But web-ext has a --pre-install option that makes the extension (and its pages) available at start, so when it is enabled the page does open. Caveat 1 is that using --pre-install requires the extension to have an ID (this one is not the mentioned UUID generated by Firefox) that has to be set in manifest.json. Caveat 2, --pre-install disables extension auto-reloading on file change.
So my final solution was to:
With firefox --manageProfiles, create a separate profile to test my extension
Proceed to set and save the extensions.webextensions.keepUuidOnUninstall about:config flag (do this without web-ext or with --keep-profile-changes otherwise)
In manifest.json add an id for the extension:
"applications": {
"gecko": {
"id": "addon#example.com"
}
}
Run
web-ext run -p <testing profile name> --pre-install -u moz-extension://<extension UUID>/path/to/extension/page.html
This starts Firefox with a temporary installation of your extension and opens the desired page.
If you know a better solution (e.g. one that does not disable the auto-reloading), your answer is very welcome.

Publishing a Google Slides add-on

I would like to ask you for some advice: I developed a really simple Google Slides add-on that makes my life easier when I use slides. The problem is that the instructions seem to be so generic for diverse google products (apps, extensions, addons, etc) and I think I'm missing something.
I followed the instructions in the official docs. I created a script with the Scripts Editor and I choose to publish it as an addon. I completed the required fields and I was redirected to the Deveoper Dashboard, that does not let me upload the add-on with no manifest file. At this point, a manifest wasn't required by Google Slides, so I created one with no much idea and validating it with the error messages that the uploading tool throws. It is something like this:
{
"manifest_version": 2,
"name": "The name",
"version": "2",
"timeZone": "America/Argentina/Buenos_Aires",
"dependencies": {},
"exceptionLogging": "STACKDRIVER"
}
I was able to upload that manifest, but the package is listed as a Chrome extension and not as a Google Slides add-on (creating a new slide and accessing document > addons > download addons).
I spent 5 hours reading how to do it ok, but I could not achieve it and I'm really tired of guessing. Can anyone point me to a concrete documentation/tutorial/video in a concrete Google Slides scenario?
PS: if I try to update the add-on from the Script Editor, by publishing it again, it tells me "This item is not an app, please remove app section from manifest". But there is no manifest in the Script Editor, and there is no app field in the manifest uploaded in the Deveoper Dashboard. And by the way, publishing in the Deveoper Dashboard forces you to have a manifest...
Thanks, thanks, thanks in advance.
To create and publish Google Slides add-on, follow these steps:
Open https://drive.google.com.
Create new Google Apps Script project by selecting New - More - Google Apps Script.
Save project by selecting from Google Apps Script editor menu File - Save.
Popup window will ask you to enter your project's name, fill it and press OK.
Code your add-on functionality.
For publishing add-on, select from Google Apps Script editor menu Publish - Deploy as web add-on...
In opened modal, fill needed details (Add-on Type: Slides; Version: New; Post-install tip) and click Create web store draft.
https://chrome.google.com/webstore/developer/edit/ADDON_ID will open.
Scroll down the page and click Publish changes.
Your add-on is published!

Can i make Testing or Remote server in sublime3 like dreamweaver

I recently started using Sublime Text 3. I always save my web development work in USB drive.
Can I make Testing or Remote server in sublime3 like Dreamweaver
Mean's Sublime3 save my Testing or Remote (connection = local/network) Server Folder in C:\xampp\htdocs\TestSite\
and
Local Site Folder save in USB Drive e.g. x:\TestSite\
and I able to put and get files like Dreamweaver
How can I do this? I will greatly appreciate any helpful suggestion.
Synchronize Update Remote Server Files (Local/Network)
Install package SublimeSimpleSync with package control in sublime3,
After Installation go and open Preference>Package Setting>SublimeSimpleSync a file and ADD THIS CODE & SAVE
{
"config":
{
"autoSync": true,
"debug": false,
"timeout": 10
},
"rules":
[
{
"type" : "local",
// Apache Server Folder
"local" : "C:\\xampp\\htdocs\\TestSite\\",
// Local Site Folder save in USB Drive
"remote" : "N:\\TestSite\\"
}
]
}
This package {SublimeSimpleSync} use to update your USB folder files when you edit and save in Apache server Folder...
View In Browser {Configure to View on Local Server}
Install another package View In Browser with package control in sublime3, After Installation open sublime project file e.g. "TestSite.sublime-project" and ADD THIS CODE & SAVE
"settings":
{
"sublime-view-in-browser":
{
"baseUrl": "http://localhost:8080\\",
"basePath": "C:\\xampp\\htdocs\\"
}
}
Here localhost can be root URL or IP and 8080 is port no.
Now open a page in sublime (which you want to render in sever) and right click and in menu click View in Browser
Live Preview In Google Chrome Browser
For Live preview in Google Chrome search Extension LivePage in chrome web store and install it. Its is very use full for most up-to-date version of a loaded web page when you change in editor.

What's the quick way to make my change of firefox plugin take affect in windows?

Now I have to restart whenever I modified a single line...
Is there a way to make it refresh without restarting the firefox?
Yes, you use plain directories in your extension instead of a JAR file, add <em:unpack>true</em:unpack> to your install.rdf and add boolean nglayout.debug.disable_xul_cache/nglayout.debug.disable_xul_fastload preferences and set them to true. You also start Firefox with -purgecaches command line flag (for Firefox 4 and newer). Then you will be able to edit extension files directly in the profile and have these changes picked up immediately. If you have an own dialog window then closing it and opening it again will be enough. For browser window overlays you will have to open a new browser window. JavaScript modules and XPCOM component will still need a browser restart however, these are loaded only once per browser session. But at least you won't have to reinstall the extension.
More information: Setting up an extension development environment

Resources