Electron AutoUpdater Issue - electron

I have an issue with updating Electron app from a private repo.
I'm using https://github.com/electron-react-boilerplate/electron-react-boilerplate for web.
I've tried Hazel + Vercel approach(https://github.com/vercel/hazel) but i receive Cannot find Squirrel error.
I have target nsis and still getting Squirrel error.
"win": {
"icon": "./assets/android-chrome-512x512.png",
"target": [
"nsis"
]
},
What is the best way of doing autoupdates with private repo so it could scale and minimize bandwidth?
I'm asking because Hazel, Nuts and Nucleus are not maintained anymore and i'm having some hard time with Hazel.

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

How to run nestjs with electron?

I am trying to make a desktop application with electronjs. Since nestjs makes the back-end development super-easy, I want to use it with electron.
Initially I tried to run the command
electron . && nest start
This makes the nest process start only after the electron app is closed.
I found only one video on youtube for this and no other proper solution elsewhere.
link: https://www.youtube.com/watch?v=vWpybfpyzPI
I was having difficulty in understanding it.
I also wanted to know the possibility of smooth communication between electron and nestjs if I am able to achieve what has been achieved in the video. It doesn't seem like a standard thing to me.
This is not easy but not impossible as well...
I will assume that you are going to create some angular frontend application along with local nestjs api server... Then we can do this with following tricks...
Create electron + angular app using xplat
Create your local nestjs application.
For production builds do the following trick..
a) In electron index.ts file add the following may be in create window function.
if (!serve) {
const { fork } = require('child_process');
const ps = fork(${__dirname}/main.js);
}
a.1) first build your Web Application.
b) build your nestjs application and then copy nestjs node_modules plus nestjs dist into your angular dist.
c) using electron_builder generate your packages and make sure electron builder will copy node_modules.. by default it will ignore it but we can pass some arguments to electron builder... by using package.json
something like below...
"files":[
"/*",
{
"from": "node_modules",
"to": "node_modules",
"filter": ["/*"]
}
],
Note : for serving we dont need to run nestjs in electron all we need is to serve nestjs separately...

NWJS SDK is not using package.json

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.

Do 'orientation' and 'display' properties of manifest.json only work when service worker is registered?

I'm building my first progressive web app. I haven't got as far as registering a service worker just yet, but I have created a manifest.json file, which looks like this:
{
"short_name": "My PWA",
"name": "My Progressive Web Application",
"start_url": "/",
"background_color": "#222",
"display": "standalone",
"scope": "/",
"theme_color": "#222",
"orientation": "portrait",
"icons": [
{
"src": "/assets/images/logo-square-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/assets/images/logo-square-512.png",
"type": "image/png",
"sizes": "512x512"
}
]
}
I've loaded this onto a test server (not running over HTTPS currently, so I'm aware that a service worker won't work, hence I haven't got that far yet) and have looked at the site on Chrome latest on a new Nokia 6.1 running Android. I notice that the 'display' property doesn't seem to be doing what it should, and I can also turn the device to landscape and browse the site in that orientation. So it seems that the manifest.json file isn't doing anything.
I can't find any documentation stating whether the manifest.json file only becomes 'active' when a service worker is installed and/or via HTTPS so I wondered if anyone here could shed any light on this?
Many thanks.
So a bit of experimentation later... It seems the manifest.json rules only become active once the site has been added to the home-screen. (I don't have a service worker to facilitate this yet, but it can be done in the browser settings). So on Chrome/Android at least the manifest settings don't need HTTPS enabled nor a service worker.

Can iOS universal app link support multiple apps using the same domain?

Background:
Building a vanilla app for multiple clients.
Same code base with different bundle ids, i.e.:
com.company.client1
com.company.client2
Want to support all client builds with the same universal app link, i.e.:
company.com/app/path
Tried to add this to the 'apple-app-site-association' file
'apple-app-site-association' file:
{"applinks": {"apps": [],"details": [
{"paths": ["/app/*"],"appID": "XXXXXXXXXX.com.company.client1"},
{"paths": ["/app/*"],"appID": "XXXXXXXXXX.com.company.client2"}]}
Is this a limitation from apple?
This is possible. There is no limitation from Apple on Universal Links for multiple apps on the same domain.
It appears your apple-app-site-association is malformed. You need it to look like this:
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "XXXXXXXXXX.com.company.client1",
"paths": [
"/app/*"
]
},
{
"appID": "XXXXXXXXXX.com.company.client2",
"paths": [
"/app/*"
]
}
]
}
}
Note the order of the appID and paths keys, and the final closing }.
You will also run into issues with this setup if more than one app is installed, since they're all registering for the same paths. You may want to consider adding a unique ID to each one, such as /app/client1/*.
Another important note is that Universal Links don't work in many situations so this is not a complete deep linking solution (despite Apple's wishful claims to the contrary). If you want a simpler deep linking approach that will easily handle a multi-app requirement like this, take a look at Branch.io (full disclosure: I'm on the Branch team).

Resources