diff --git a/.travis.yml b/.travis.yml
index 92494c2e..884c3aa7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,35 @@
-language: node_js
+language: c
sudo: false
dist: trusty
-node_js:
- - '6.9.4'
+env:
+ global:
+ - ELECTRON_CACHE=$HOME/.electron
+
+matrix:
+ fast_finish: true
+ include:
+ - os: osx
+
+ - os: linux
+ env: CC=clang CXX=clang++ npm_config_clang=1
+ compiler: clang
+
+cache:
+ directories:
+ - node_modules
+ - $HOME/.electron
+ - $HOME/.cache
+
+addons:
+ apt:
+ packages:
+ - libgnome-keyring-dev
+ - libsecret-1-dev
+ - icnsutils
install:
- - npm install -g npm@3.10.7
+ - nvm install
- npm install
before_script:
@@ -15,7 +38,8 @@ before_script:
- npm run lint
script:
- - cd ./test-serializer && node ./test-serializer.js
+ - npm run test
+ - npm run release
cache:
directories:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..3d2a01c9
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,12 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+
+# 1.0.0-alpha.1 (2017-06-01)
+
+
+### Bug Fixes
+
+* First macro opening ([#123](https://github.com/UltimateHackingKeyboard/agent/issues/123)) ([aca22f9](https://github.com/UltimateHackingKeyboard/agent/commit/aca22f9)), closes [#121](https://github.com/UltimateHackingKeyboard/agent/issues/121)
+* **device:** Mac is not allow excusive right to use USB ([6778ca9](https://github.com/UltimateHackingKeyboard/agent/commit/6778ca9))
diff --git a/appveyor.yml b/appveyor.yml
index 921f880c..1bfb1edb 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,6 +1,8 @@
os: unstable
environment:
+ GH_TOKEN: #TODO Change it to the master repo access token
+ secure: SGC3hXXPFwK+vV8jMLJjngg93vCq0lqPaKuBLluWxhaaPR/FZgoZe1aqXIkdFDxR
matrix:
- nodejs_version: 6.9.4
@@ -21,9 +23,8 @@ install:
- npm install
test_script:
- - node --version
- - npm --version
- npm run build
- npm run build:test
- npm run lint
- npm run test
+ - npm run release
diff --git a/build/icon.icns b/build/icon.icns
new file mode 100644
index 00000000..04b608d5
Binary files /dev/null and b/build/icon.icns differ
diff --git a/build/icon.ico b/build/icon.ico
new file mode 100644
index 00000000..93b19acc
Binary files /dev/null and b/build/icon.ico differ
diff --git a/build/icons/1024x1024.png b/build/icons/1024x1024.png
new file mode 100644
index 00000000..fbaac1b7
Binary files /dev/null and b/build/icons/1024x1024.png differ
diff --git a/build/icons/128x128.png b/build/icons/128x128.png
new file mode 100644
index 00000000..e9136f9f
Binary files /dev/null and b/build/icons/128x128.png differ
diff --git a/build/icons/16x16.png b/build/icons/16x16.png
new file mode 100644
index 00000000..cdd4b9fa
Binary files /dev/null and b/build/icons/16x16.png differ
diff --git a/build/icons/24x24.png b/build/icons/24x24.png
new file mode 100644
index 00000000..d88440f4
Binary files /dev/null and b/build/icons/24x24.png differ
diff --git a/build/icons/256x256.png b/build/icons/256x256.png
new file mode 100644
index 00000000..3aacd8a8
Binary files /dev/null and b/build/icons/256x256.png differ
diff --git a/build/icons/32x32.png b/build/icons/32x32.png
new file mode 100644
index 00000000..abd8f942
Binary files /dev/null and b/build/icons/32x32.png differ
diff --git a/build/icons/48x48.png b/build/icons/48x48.png
new file mode 100644
index 00000000..ecab7477
Binary files /dev/null and b/build/icons/48x48.png differ
diff --git a/build/icons/512x512.png b/build/icons/512x512.png
new file mode 100644
index 00000000..272ab13e
Binary files /dev/null and b/build/icons/512x512.png differ
diff --git a/build/icons/64x64.png b/build/icons/64x64.png
new file mode 100644
index 00000000..341f7e75
Binary files /dev/null and b/build/icons/64x64.png differ
diff --git a/build/icons/96x96.png b/build/icons/96x96.png
new file mode 100644
index 00000000..c4d65e31
Binary files /dev/null and b/build/icons/96x96.png differ
diff --git a/electron/src/services/uhk-device.service.ts b/electron/src/services/uhk-device.service.ts
index a3a81d34..979eda71 100644
--- a/electron/src/services/uhk-device.service.ts
+++ b/electron/src/services/uhk-device.service.ts
@@ -97,7 +97,13 @@ export class UhkDeviceService implements OnDestroy {
if (process.platform !== 'win32' && usbInterface.isKernelDriverActive()) {
usbInterface.detachKernelDriver();
}
- usbInterface.claim();
+
+ // https://github.com/tessel/node-usb/issues/30
+ // Mac is not allow excusive right to use USB
+ if (process.platform !== 'darwin') {
+ usbInterface.claim();
+ }
+
this.messageIn$ = Observable.create((subscriber: Subscriber) => {
const inEndPoint: InEndpoint = usbInterface.endpoints[0];
console.log('Try to read');
diff --git a/electron/src/tsconfig-electron-main.json b/electron/src/tsconfig-electron-main.json
index 46fa1b0f..a83953aa 100644
--- a/electron/src/tsconfig-electron-main.json
+++ b/electron/src/tsconfig-electron-main.json
@@ -1,22 +1,6 @@
{
- "compilerOptions": {
- "target": "es6",
- "module": "commonjs",
- "moduleResolution": "node",
- "sourceMap": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "removeComments": false,
- "noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "typeRoots": [
- "../../node_modules/@types"
- ],
- "types": [
- "electron"
- ]
- },
+ "extends": "../../tsconfig.json",
"files": [
"electron-main.ts"
]
-}
\ No newline at end of file
+}
diff --git a/electron/src/tsconfig.json b/electron/src/tsconfig.json
index ff03177a..8a661e67 100644
--- a/electron/src/tsconfig.json
+++ b/electron/src/tsconfig.json
@@ -1,30 +1,8 @@
{
- "compilerOptions": {
- "target": "es5",
- "module": "commonjs",
- "moduleResolution": "node",
- "sourceMap": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "removeComments": false,
- "noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "typeRoots": [
- "../../node_modules/@types"
- ],
- "types": [
- "node",
- "jquery",
- "core-js",
- "select2",
- "file-saver",
- "electron",
- "usb"
- ]
- },
+ "extends": "../../tsconfig.json",
"exclude": [
"../dist",
"electron-main.ts",
"webpack.config.*"
]
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index d4f46702..cde0161d 100644
--- a/package.json
+++ b/package.json
@@ -1,90 +1,96 @@
{
- "name": "uhk-agent",
- "version": "1.0.0-alpha.1",
- "description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
- "repository": {
- "type": "git",
- "url": "git@github.com:UltimateHackingKeyboard/agent.git"
- },
- "license": "GPL-3.0",
- "engines": {
- "node": ">=6.9.5 <7.0.0",
- "npm": ">=3.10.7 <4.0.0"
- },
- "devDependencies": {
- "@ngrx/store-devtools": "3.2.4",
- "@ngrx/store-log-monitor": "3.0.2",
- "@types/core-js": "0.9.35",
- "@types/electron": "^1.4.37",
- "@types/file-saver": "0.0.0",
- "@types/jquery": "^2.0.40",
- "@types/node": "^6.0.70",
- "@types/usb": "^1.1.3",
- "angular2-template-loader": "0.6.2",
- "copy-webpack-plugin": "^4.0.1",
- "electron": "1.6.5",
- "electron-rebuild": "^1.5.7",
- "expose-loader": "^0.7.1",
- "html-loader": "0.4.5",
- "node-sass": "^4.5.2",
- "npm-run-all": "4.0.2",
- "path": "^0.12.7",
- "raw-loader": "^0.5.1",
- "sass-loader": "^6.0.3",
- "stylelint": "^7.10.1",
- "ts-loader": "^2.0.3",
- "tslint": "~5.1.0",
- "webpack": "^2.4.1",
- "webpack-dev-server": "^2.4.4",
- "webpack-svgstore-plugin": "4.0.0"
- },
- "dependencies": {
- "@angular/animations": "4.0.3",
- "@angular/common": "4.0.3",
- "@angular/compiler": "4.0.3",
- "@angular/core": "4.0.3",
- "@angular/forms": "4.0.3",
- "@angular/platform-browser": "4.0.3",
- "@angular/platform-browser-dynamic": "4.0.3",
- "@angular/router": "4.0.3",
- "@ngrx/core": "1.2.0",
- "@ngrx/effects": "2.0.3",
- "@ngrx/store": "2.2.2",
- "bootstrap": "^3.3.7",
- "browser-stdout": "^1.3.0",
- "buffer": "^5.0.6",
- "core-js": "2.4.1",
- "dragula": "^3.7.2",
- "filesaver.js": "^0.2.0",
- "font-awesome": "^4.6.3",
- "jquery": "3.2.1",
- "json-loader": "^0.5.4",
- "ng2-dragula": "1.3.1",
- "ng2-select2": "1.0.0-beta.10",
- "rxjs": "5.3.0",
- "select2": "^4.0.3",
- "sudo-prompt": "^7.0.0",
- "typescript": "2.2.2",
- "usb": "git+https://github.com/aktary/node-usb.git",
- "xml-loader": "1.2.1",
- "zone.js": "0.8.5"
- },
- "scripts": {
- "postinstall": "run-p build:usb \"symlink -- -i\" ",
- "test": "cd ./test-serializer && node ./test-serializer.js",
- "lint": "run-s -scn lint:ts lint:style",
- "lint:ts": "tslint \"electron/**/*.ts\" \"web/**/*.ts\" \"shared/**/*.ts\" \"test-serializer/**/*.ts\"",
- "lint:style": "stylelint \"electron/**/*.scss\" \"web/**/*.scss\" \"shared/**/*.scss\" --syntax scss",
- "build": "run-p build:web build:electron",
- "build:web": "webpack --config \"web/src/webpack.config.js\"",
- "build:electron": "run-s -scn build:electron:main build:electron:app",
- "build:electron:main": "webpack --config \"electron/src/webpack.config.electron-main.js\"",
- "build:electron:app": "webpack --config \"electron/src/webpack.config.js\"",
- "build:usb": "electron-rebuild -w usb -p",
- "build:test": "webpack --config \"test-serializer/webpack.config.js\"",
- "server:web": "webpack-dev-server --config \"web/src/webpack.config.js\" --content-base \"./web/dist\"",
- "server:electron": "webpack --config \"electron/src/webpack.config.js\" --watch",
- "electron": "electron electron/dist/electron-main.js",
- "symlink": "node ./tools/symlinker"
- }
+ "name": "uhk-agent",
+ "main": "electron/dist/electron-main.js",
+ "version": "1.0.0-alpha.1",
+ "description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:UltimateHackingKeyboard/agent.git"
+ },
+ "license": "GPL-3.0",
+ "engines": {
+ "node": ">=6.9.5 <7.0.0",
+ "npm": ">=3.10.7 <4.0.0"
+ },
+ "devDependencies": {
+ "@ngrx/store-devtools": "3.2.4",
+ "@ngrx/store-log-monitor": "3.0.2",
+ "@types/core-js": "0.9.35",
+ "@types/electron": "^1.4.37",
+ "@types/file-saver": "0.0.0",
+ "@types/jquery": "^2.0.40",
+ "@types/node": "^6.0.70",
+ "@types/usb": "^1.1.3",
+ "angular2-template-loader": "0.6.2",
+ "copy-webpack-plugin": "^4.0.1",
+ "electron": "1.6.5",
+ "electron-builder": "^18.3.0",
+ "electron-rebuild": "^1.5.7",
+ "expose-loader": "^0.7.1",
+ "html-loader": "0.4.5",
+ "node-sass": "^4.5.2",
+ "npm-run-all": "4.0.2",
+ "path": "^0.12.7",
+ "raw-loader": "^0.5.1",
+ "sass-loader": "^6.0.3",
+ "standard-version": "^4.0.0",
+ "stylelint": "^7.10.1",
+ "ts-loader": "^2.0.3",
+ "tslint": "~5.1.0",
+ "webpack": "^2.4.1",
+ "webpack-dev-server": "^2.4.4",
+ "webpack-svgstore-plugin": "4.0.0"
+ },
+ "dependencies": {
+ "@angular/animations": "4.0.3",
+ "@angular/common": "4.0.3",
+ "@angular/compiler": "4.0.3",
+ "@angular/core": "4.0.3",
+ "@angular/forms": "4.0.3",
+ "@angular/platform-browser": "4.0.3",
+ "@angular/platform-browser-dynamic": "4.0.3",
+ "@angular/router": "4.0.3",
+ "@ngrx/core": "1.2.0",
+ "@ngrx/effects": "2.0.3",
+ "@ngrx/store": "2.2.2",
+ "bootstrap": "^3.3.7",
+ "browser-stdout": "^1.3.0",
+ "buffer": "^5.0.6",
+ "core-js": "2.4.1",
+ "dragula": "^3.7.2",
+ "filesaver.js": "^0.2.0",
+ "font-awesome": "^4.6.3",
+ "jquery": "3.2.1",
+ "json-loader": "^0.5.4",
+ "ng2-dragula": "1.3.1",
+ "ng2-select2": "1.0.0-beta.10",
+ "rxjs": "5.3.0",
+ "select2": "^4.0.3",
+ "sudo-prompt": "^7.0.0",
+ "typescript": "2.2.2",
+ "usb": "git+https://github.com/aktary/node-usb.git",
+ "xml-loader": "1.2.1",
+ "zone.js": "0.8.5"
+ },
+ "scripts": {
+ "postinstall": "run-p build:usb \"symlink -- -i\" ",
+ "test": "cd ./test-serializer && node ./test-serializer.js",
+ "lint": "run-s -scn lint:ts lint:style",
+ "lint:ts": "tslint \"electron/**/*.ts\" \"web/**/*.ts\" \"shared/**/*.ts\" \"test-serializer/**/*.ts\"",
+ "lint:style": "stylelint \"electron/**/*.scss\" \"web/**/*.scss\" \"shared/**/*.scss\" --syntax scss",
+ "build": "run-p build:web build:electron",
+ "build:web": "webpack --config \"web/src/webpack.config.js\"",
+ "build:electron": "run-s -scn build:electron:main build:electron:app",
+ "build:electron:main": "webpack --config \"electron/src/webpack.config.electron-main.js\"",
+ "build:electron:app": "webpack --config \"electron/src/webpack.config.js\"",
+ "build:usb": "electron-rebuild -w usb -p",
+ "build:test": "webpack --config \"test-serializer/webpack.config.js\"",
+ "server:web": "webpack-dev-server --config \"web/src/webpack.config.js\" --content-base \"./web/dist\"",
+ "server:electron": "webpack --config \"electron/src/webpack.config.js\" --watch",
+ "electron": "electron electron/dist/electron-main.js",
+ "symlink": "node ./tools/symlinker",
+ "standard-version": "standard-version",
+ "pack": "node ./scripts/release.js",
+ "release": "node ./scripts/release.js"
+ }
}
diff --git a/scripts/release.js b/scripts/release.js
new file mode 100644
index 00000000..6a112fa2
--- /dev/null
+++ b/scripts/release.js
@@ -0,0 +1,111 @@
+'use strict';
+
+const TEST_BUILD = true; // set true if you would like to test on your local machince
+
+if (!process.env.CI && !TEST_BUILD) {
+ console.error('Create release only on CI server')
+ process.exit(1)
+}
+
+let branchName = ''
+let pullRequestNr = ''
+let gitTag = ''
+let repoName = ''
+
+if (process.env.TRAVIS) {
+ branchName = process.env.TRAVIS_BRANCH
+ pullRequestNr = process.env.TRAVIS_PULL_REQUEST
+ gitTag = process.env.TRAVIS_TAG
+ repoName = process.env.TRAVIS_REPO_SLUG
+} else if (process.env.APPVEYOR) {
+ branchName = process.env.APPVEYOR_REPO_BRANCH
+ pullRequestNr = process.env.APPVEYOR_PULL_REQUEST_NUMBER
+ gitTag = process.env.APPVEYOR_REPO_TAG_NAME
+ repoName = process.env.APPVEYOR_REPO_NAME
+}
+
+console.log({ branchName, pullRequestNr, gitTag, repoName })
+
+// TODO(Robi): Remove the comment after success tests
+const isReleaseCommit = TEST_BUILD || branchName === gitTag //&& repoName === 'ert78gb/electron-playground'
+
+if (!isReleaseCommit) {
+ console.log('It is not a release task. Skipping publish.')
+ process.exit(0)
+}
+
+
+const fs = require('fs-extra')
+const cp = require('child_process')
+const path = require('path')
+const builder = require("electron-builder")
+const Platform = builder.Platform
+
+let sha = ''
+if (process.env.TRAVIS) {
+ sha = process.env.TRAVIS_COMMIT
+} else if (process.env.APPVEYOR) {
+ sha = process.env.APPVEYOR_REPO_COMMIT
+}
+
+let target = ''
+
+if (process.platform === 'darwin') {
+ target = Platform.MAC.createTarget()
+} else if (process.platform === 'win32') {
+ target = Platform.WINDOWS.createTarget()
+} else if (process.platform === 'linux') {
+ target = Platform.LINUX.createTarget()
+} else {
+ console.error(`I dunno how to publish a release for ${process.platform} :(`)
+ process.exit(1)
+}
+
+if (process.platform === 'darwin') {
+ // TODO: Remove comment when macOS certificates boughted and exported
+ //require('./setup-macos-keychain').registerKeyChain()
+}
+
+let version = ''
+if (TEST_BUILD || gitTag) {
+ version = gitTag
+
+ builder.build({
+ dir: true,
+ targets: target,
+ appMetadata: {
+ main: 'electron/dist/electron-main.js',
+ name: 'UHK Agent',
+ author: {
+ name: 'Ultimate Gaget Laboratories'
+ },
+ },
+ config: {
+ appId: 'com.ultimategadgetlabs.uhk.agent',
+ productName: 'UHK Agent',
+ mac: {
+ category: 'public.app-category.utilities',
+ },
+ publish: 'github',
+ files: [
+ '!**/*',
+ 'electron/dist/**/*',
+ 'node_modules/**/*'
+ ]
+
+ },
+ })
+ .then(() => {
+ console.log('Packing success.')
+ })
+ .catch((error) => {
+ console.error(`${error}`)
+ process.exit(1)
+ })
+}
+else {
+ console.log('No git tag')
+ // TODO: Need it?
+ version = sha.substr(0, 8)
+ process.exit(1)
+}
diff --git a/scripts/setup-macos-keychain.js b/scripts/setup-macos-keychain.js
new file mode 100644
index 00000000..1e369a23
--- /dev/null
+++ b/scripts/setup-macos-keychain.js
@@ -0,0 +1,20 @@
+'use strict'
+
+const cp = require('child_process')
+const path = require('path')
+
+function registerKeyChain() {
+ const encryptedFile = path.join(__dirname, '../certs/developer-id-cert.p12.enc')
+ const decryptedFile = path.join(__dirname, '../certs/developer-id-cert.p12')
+ cp.execSync(`openssl aes-256-cbc -K $encrypted_04061b49eb95_key -iv $encrypted_04061b49eb95_iv -in ${encryptedFile} -out ${decryptedFile} -d`)
+
+ const keyChain = 'mac-build.keychain'
+ cp.execSync(`security create-keychain -p travis ${keyChain}`)
+ cp.execSync(`security default-keychain -s ${keyChain}`)
+ cp.execSync(`security unlock-keychain -p travis ${keyChain}`)
+ cp.execSync(`security set-keychain-settings -t 3600 -u ${keyChain}`)
+
+ cp.execSync(`security import ${decryptedFile} -k ${keyChain} -P $KEY_PASSWORD -T /usr/bin/codesign`)
+}
+
+module.exports.registerKeyChain = registerKeyChain
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 00000000..fd1d1019
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "removeComments": false,
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors": true
+ }
+}
diff --git a/web/src/tsconfig.json b/web/src/tsconfig.json
index b4d65ff0..3dd8c5da 100644
--- a/web/src/tsconfig.json
+++ b/web/src/tsconfig.json
@@ -1,27 +1,6 @@
{
- "compilerOptions": {
- "target": "es5",
- "module": "commonjs",
- "moduleResolution": "node",
- "sourceMap": true,
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "removeComments": false,
- "noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "typeRoots": [
- "../../node_modules/@types"
- ],
- "types": [
- "node",
- "jquery",
- "core-js",
- "select2",
- "file-saver"
- ]
- },
+ "extends": "../../tsconfig.json",
"exclude": [
- "node_modules",
"config-serializer"
]
-}
\ No newline at end of file
+}