Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/deploy-example.yml

This file was deleted.

40 changes: 17 additions & 23 deletions .github/workflows/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: Electron Builder
on:
push:
branches:
- main
pull_request:

jobs:
WindowsBuild:
runs-on: windows-latest
MacBuild:
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
WIN_CERT: ${{ secrets.WIN_CERT }}
WIN_CERT_PASSWORD: ${{ secrets.WIN_CERT_PASSWORD }}
DEBUG: electron-osx-sign*
KEYCHAIN: job-${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
steps:
- uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.base64P12File }}
p12-password: ${{ secrets.p12Password }}
keychain: ${{ env.KEYCHAIN }}

- name: Check out Git repository
uses: actions/checkout@v3

Expand All @@ -33,14 +36,6 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-

- uses: actions/github-script@v5
id: should-publish
with:
result-encoding: string
script: |
const script = require('./check-for-version-bump.js');
return await script({ github, context, core })

- name: Install deps
run: yarn install

Expand All @@ -51,17 +46,16 @@ jobs:
# electron forge only builds on start, run-as-node forces it to crash out
run: yarn start --run-as-node || true

- name: Forge publish
if: ${{ steps.should-publish.outputs.result == 'publish' }}
run: yarn run publish

- name: Forge make
if: ${{ steps.should-publish.outputs.result == 'make' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_PROVIDER: ${{ secrets.APPLE_PROVIDER }}
run: yarn make

- uses: actions/upload-artifact@v3
with:
name: WindowsRelease
path: out/make/squirrel.windows/x64
name: MacDMG
path: out/make/EyeCommander.dmg
# Github has size limits so this avoids hitting them
retention-days: 1
retention-days: 14
40 changes: 0 additions & 40 deletions .github/workflows/release-template.yml

This file was deleted.

126 changes: 11 additions & 115 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,127 +1,30 @@
const os = require("os");

let icon = undefined;
let osxSigning = {};
let certParams = {};

if (os.platform() === "win32") {
icon = "./assets/windows_icon.ico";

// if (process.env.WIN_CERT_PASSWORD) {
// console.log("WINDOWS SIGNING PARAM FOUND");

// certParams = {
// certificateFile: "./win-cert.pfx",
// certificatePassword: process.env.WIN_CERT_PASSWORD,
// exe: "EyeCommander.exe",
// setupExe: "EyeCommanderSetup.exe",
// };
// } else {
// console.log("NO WINDOWS SIGNING PARAMS");
// }
}

if (os.platform() === "darwin") {
icon = "./assets/apple-icon.icns";

osxSigning = {
module.exports = {
electronRebuildConfig: {
force: true,
useCache: false,
},
packagerConfig: {
appBundleId: "com.acecentre.eyecommander",
icon: "./assets/apple-icon.icns",
executableName: "EyeCommander",
osxSign: {
keychain: `${process.env.KEYCHAIN}.keychain-db`,
identity: "Developer ID Application: THE ACE CENTRE-NORTH (K45HHA96ND)",
"hardened-runtime": true,
entitlements: "./assets/entitlements.plist",
"entitlements-inherit": "./assets/entitlements.plist",
"signature-flags": "library",
"gatekeeper-assess": false,
},
};

console.log("=========");
if (
process.env.APPLE_ID &&
process.env.APPLE_ID_PASSWORD &&
process.env.APPLE_PROVIDER
) {
console.log("SIGNING PARAMS ADDED");
osxSigning.osxNotarize = {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
ascProvider: process.env.APPLE_PROVIDER,
};
} else {
console.log("NO SIGNING PARAMS IN ENV");
}
console.log("=========");
}

let publishers = [];

if (process.env.GITHUB_TOKEN) {
publishers.push({
name: "@electron-forge/publisher-github",
config: {
repository: {
owner: "AceCentre",
name: "EyeCommander",
},
prerelease: false,
draft: false,
},
});
}

module.exports = {
electronRebuildConfig: {
force: true,
useCache: false,
},
packagerConfig: {
icon,
executableName: "eyecommander",
...osxSigning,
},
publishers,
publishers: [],
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "EyeCommander",
...certParams,
},
},
{
name: "@electron-forge/maker-zip",
platforms: ["darwin"],
},
{
name: "@electron-forge/maker-deb",
config: {
options: {
maintainer: "Ace Centre",
homepage: "https://acecentre.org.uk",
},
},
},
{
name: "@electron-forge/maker-rpm",
config: {
options: {
maintainer: "Ace Centre",
homepage: "https://acecentre.org.uk",
},
},
},
{
name: "@electron-forge/maker-dmg",
config: {
format: "ULFO",
name: "EyeCommander",
icon: "./assets/apple-icon.png",
additionalDMGOptions: {
"code-sign": {
identifier: "",
"signing-identity": "",
},
},
},
},
],
Expand All @@ -146,12 +49,5 @@ module.exports = {
},
},
],
[
"@timfish/forge-externals-plugin",
{
externals: ["ffi-napi", "ref-napi"],
includeDeps: true,
},
],
],
};
12 changes: 1 addition & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@
"@babel/core": "^7.15.8",
"@babel/preset-react": "^7.16.0",
"@electron-forge/cli": "^6.0.0-beta.61",
"@electron-forge/maker-deb": "^6.0.0-beta.61",
"@electron-forge/maker-dmg": "^6.0.0-beta.61",
"@electron-forge/maker-rpm": "^6.0.0-beta.61",
"@electron-forge/maker-squirrel": "^6.0.0-beta.61",
"@electron-forge/maker-zip": "^6.0.0-beta.61",
"@electron-forge/plugin-webpack": "6.0.0-beta.61",
"@electron-forge/publisher-github": "^6.0.0-beta.61",
"@timfish/forge-externals-plugin": "^0.1.2",
"babel-loader": "^8.2.3",
"css-loader": "^6.0.0",
"electron": "15.3.0",
Expand All @@ -51,21 +46,16 @@
"auto-launch": "^5.0.5",
"copy-webpack-plugin": "^9.0.1",
"electron-log": "^4.4.1",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^8.0.1",
"eslint": "7.32.0",
"eslint-plugin-react": "^7.26.1",
"execa": "^5.1.1",
"ffi-napi": "4.0.3",
"lodash": "^4.17.21",
"posthog-node": "^1.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-webcam": "^6.0.0",
"ref-napi": "3.0.3",
"sendkeys": "^1.1.1",
"sudo-prompt": "^9.2.1",
"update-electron-app": "^2.0.1",
"robotjs": "^0.6.0",
"use-sound": "^4.0.1",
"uuid": "^8.3.2",
"webpack-node-externals": "^3.0.0"
Expand Down
44 changes: 44 additions & 0 deletions src/backend/mac-keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { AbstractOutput } from "./abstract-output";

import { WEB_KEY_TO_ROBOT_KEY } from "../web-key-to-os-key";
import robot from "robotjs";

const getWithDefault = (store, id, defaultVal) => {
const val = store.get(id);

if (val !== undefined) return val;

store.set(id, defaultVal);

return defaultVal;
};

export class MacKeyboard extends AbstractOutput {
constructor({ store }) {
super();

this.store = store;
}

blink() {
const webKey = getWithDefault(this.store, "CURRENT_WEB_KEY", " ");
const osKey = WEB_KEY_TO_ROBOT_KEY[webKey.toLowerCase()];

robot.keyTap(osKey);

console.log("BLINK", osKey, webKey);
}

static getCompatiblePlatforms() {
return ["darwin"];
}

static info() {
return {
name: "Keyboard Emulator",
description:
"Emulates a keypress. Allows you to change the key that is pressed.",
icon: "KeyboardIcon",
};
}
}
16 changes: 4 additions & 12 deletions src/backend/output-controller.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { RobotKeyboard } from "./robot-keyboard";
import { DebugOutput } from "./debug-output";
import { GridOutput } from "./grid-output";
import { MacKeyboard } from "./mac-keyboard";

import os from "os";
import { OUTPUT_TYPE_NAME } from "../react-app/lib/store-consts";
import { NuVoice } from "./nu-voice";
import { MindExpress } from "./mind-express";

const OUTPUT_TYPES = [
RobotKeyboard,
DebugOutput,
GridOutput,
NuVoice,
MindExpress,
];

const OUTPUT_TYPES = [DebugOutput, MacKeyboard];
export class OutputController {
constructor({ store }) {
this.store = store;
Expand Down
Loading