From 5905f08615f85c199c1c02aa2a3600febcd8288e Mon Sep 17 00:00:00 2001 From: Pablo Enrici Date: Wed, 14 Nov 2018 18:33:36 -0300 Subject: [PATCH 1/2] Add script for Windows code signing --- package.json | 1 + sign/win.bat | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 sign/win.bat diff --git a/package.json b/package.json index 37a32a11..ab41d7d9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "dev": "concurrently \"BROWSER=none npm start\" \"wait-on $npm_package_config_cra_dev_serv && ELECTRON_START_URL=$npm_package_config_cra_dev_serv electron .\"", "dist": "react-scripts build && build --c.extraMetadata.main=build/electron.js", "dist:mac": "./sign/mac.sh", + "dist:win": ".\\sign\\win.bat", "eject": "react-scripts eject", "lint": "eslint --cache public && eslint --cache src", "pack": "build --c.extraMetadata.main=build/electron.js", diff --git a/sign/win.bat b/sign/win.bat new file mode 100644 index 00000000..092b5714 --- /dev/null +++ b/sign/win.bat @@ -0,0 +1,10 @@ +@echo off +echo Building and signing application for Windows + +SET CSC_LINK=as.p12 + +set /p PASSWORD="Insert the certificate password and press enter: " + +SET CSC_KEY_PASSWORD=%PASSWORD% + +npm run dist From fd060fe5fa20891fe56d321e55dc547ec8f9a824 Mon Sep 17 00:00:00 2001 From: Pablo Enrici Date: Wed, 14 Nov 2018 18:56:43 -0300 Subject: [PATCH 2/2] Avoid accessing the settings file before the app is ready This fixes a crash on the first time the app is run and the settings file doesn't exist yet. Fixes #405 --- public/analytics.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/analytics.js b/public/analytics.js index 570e473f..95150519 100644 --- a/public/analytics.js +++ b/public/analytics.js @@ -6,22 +6,24 @@ const { noop } = require('lodash') const settings = require('electron-settings') const isDev = require('electron-is-dev') -const visitor = ua(settings.get('app.trackingId')) +let visitor const analytics = {} -visitor.set('ds', 'app') -visitor.set('an', app.getName()) -visitor.set('av', app.getVersion()) - analytics.screenview = function (...args) { + if (!visitor) return visitor.screenview(...args).send() } analytics.event = function (...args) { + if (!visitor) return visitor.event(...args).send() } analytics.init = function (userAgent) { + visitor = ua(settings.get('app.trackingId')) + visitor.set('ds', 'app') + visitor.set('an', app.getName()) + visitor.set('av', app.getVersion()) visitor.set('ua', userAgent) analytics.event('App', 'App initiated') }