Skip to content

Commit

Permalink
Merge pull request #164 from firecamp-dev/feat/62-desktop #62
Browse files Browse the repository at this point in the history
Firecamp Desktop Apps
  • Loading branch information
Nishchit14 authored Mar 4, 2024
2 parents 83f80a7 + ae5f7b4 commit 21e36f6
Show file tree
Hide file tree
Showing 101 changed files with 3,804 additions and 732 deletions.
6 changes: 5 additions & 1 deletion .env.vault
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#/ cloud-agnostic vaulting standard /
#/ [how it works](https://dotenv.org/env-vault) /
#/--------------------------------------------------/
DOTENV_VAULT=vlt_a7698f74e5365a7834b9f3a62cc555169343e436f2cde5d317afa8c4adfa4eda

# development
DOTENV_VAULT_DEVELOPMENT="Yhme4DuEh1lu1ysCEEfwHtP+Qbxfa8RWkV3lTacXbO9PYbAVGm3jKDTt5i7D/xNp17s18Vqe4S8iqa3mdE0odWBpUuZG8JhvdCw2elMoLFq2uKU0zeeWIP2camdOogxKa6hmCJni58Re3d0OfIMDpCew28MzrSRSnGYLDqEKadhDkf8k5Ei06V/yUy4NQZ6Xj9wzKWRTC6eU4i9O/+puWHJCg0HUrx6eb2/m8tb1A0WSuaMIIjmk7zpzpeviyD+9J+4jlzxRkGP43W2mmBpHyQveBBe13OYIxH3rjL1a13fn2nHLvrOk3N6LLak/ITLekw3NeHakuMv7BmL8l+J5Msua89wqJuMIN8DxXaUJYFysxMBfuWQYcVOBnWoEW/XCZwptOgV/xK3EpcanAH+YdjNa1LALVxrlGNICNflfvzmKbVtp6yCiimaHKHy50Z+mCV2FGBHYKR1R+LONWvftKBOgOvlMhaqTDGAsGMe7ocyBYKYocr5NwBwwSbUXsTWhV6G2mRwQ/V7D7nvHot8QLBNbW6aPUjroUkQkcUjvmeKtZkmGIWMw0i1cdSwQjpiGTgKYqu0p6i5gb3Dgf6ffLI3ZuMg+URNvpOyVFIEBfR24s5Q6cw7tVsJv6FyH52KJJNQf9A3MiiHTLhh51NaQNSso/FG8v+rKKhU64fhKLw0Xlx+wu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F23xVlOw0ZFybhB2yPhLH8EAk1voAyo5KrHgv59o/e3keqzJIPIIkzaRyaRXRB9FF29HlJBF70af7ymOLgO9WnWE+RwPacxEPc3zEuEHNtOMXsDM2cpCZQmwFduoyCvelyULjaQK/MjW058DvvsT3Lw02yXiE1nWluLcSDe2j/QXx+s5Lr395i4LhHW9f/qlEhZVD3fJNr610UuAYe5OH9XOXW1/0g9VwEbHJ7I1hL6MLFx8h5c/JkuI62CnQYPVMKnQmR44jwR3cRseXRi/MJ44BjFxwLijEGu3cNgG4UIUH3X5VpvDZkjMiJ47hn2e8vpn1u/XNOTWeY1PruVlwhmXOVe8vVZybOARXm/1q9DT0fcHB5OQ=="
DOTENV_VAULT_PRODUCTION_VERSION=13

#/----------------settings/metadata-----------------/
DOTENV_VAULT="vlt_a7698f74e5365a7834b9f3a62cc555169343e436f2cde5d317afa8c4adfa4eda"
DOTENV_API_URL="https://vault.dotenv.org"
DOTENV_CLI="npx dotenv-vault@latest"
24 changes: 24 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,27 @@ https
ssh
ubuntu
workarounds
tauri
portpicker
Avenir
osx
serde
Enume
OPPT
Yirfjyjaujc
heroku
nel
tne
cloudflare
vegur
nosniff
ratelimit
icns
notarisation
Ecies
ecies
pbk
encryptio
keyval
fce

4 changes: 4 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
abksi
adpcm
ajv
APPIMAGE
applixware
arraybufferview
asds
Expand Down Expand Up @@ -52,6 +53,7 @@ dssc
dts
duplicat
eamodio
eciesjs
ecmascript
edt
EGraph
Expand Down Expand Up @@ -229,6 +231,7 @@ ROfb
Rpbjpvc
rsd
rtls
rustc
saf
salesforce
salesforcecli
Expand Down Expand Up @@ -268,6 +271,7 @@ timestamptz
TItem
tocstop
TODOs
togglefullscreen
Tokenfrom
TOODs
tooltiptext
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cypress/videos
*.zip
*.crx
*.pem
!x-dev-certs/**/*.pem
update.xml
.idea
package-lock.json
Expand Down
2 changes: 1 addition & 1 deletion packages/firecamp-agent-manager/src/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { IRest, IRestResponse, TId } from '@firecamp/types';
import { _misc } from '@firecamp/utils';
import RestExecutor from '@firecamp/rest-executor/dist/esm';
import RestExecutor from '@firecamp/rest-executor';

// Holds the rest executors instance to handle
const restExecutors: { [key: TId]: RestExecutor } = {};
Expand Down
19 changes: 11 additions & 8 deletions packages/firecamp-agent-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ export const send = async (
testResult: any;
scriptErrors: any[];
}> => {
const requestId = request.__ref.id;
let res: any;
switch (firecampAgent) {
case EFirecampAgent.Desktop:
return window.fc.restExecutor.send(request, variables);
//@ts-ignore
return await window.__electron__.http.send(request, variables);
case EFirecampAgent.Extension:
return extension.send(request, variables);
case EFirecampAgent.Web:
restExecutors[request.__ref.id] = new RestExecutor();
//@ts-ignore
return await restExecutors[request.__ref.id].send(request, variables);
res = restExecutors[request.__ref.id].send(request, variables);
delete restExecutors[requestId];
return res;
case EFirecampAgent.Cloud:
if (request.body?.type == ERestBodyTypes.FormData) {
const body = await parseBody(request.body);
Expand Down Expand Up @@ -76,14 +80,13 @@ export const cancel = async (
): Promise<void> => {
switch (firecampAgent) {
case EFirecampAgent.Desktop:
return window.fc.restExecutor.cancel(requestId);
case EFirecampAgent.Extension:
return extension.cancel(requestId);
/** @ts-ignore */
return window.__electron__.http.stop(requestId);
// case EFirecampAgent.Extension:
// return extension.cancel(requestId);
case EFirecampAgent.Web:
restExecutors[requestId].cancel();

delete restExecutors[requestId];

return;
case EFirecampAgent.Cloud:
const response = await axios.get(
Expand Down
11 changes: 11 additions & 0 deletions packages/firecamp-electron/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea/*
.nyc_output
.vscode
build
node_modules
test
src/**.js
coverage
*.log
!src/declarations.d.ts
dev-app-update.yml
1 change: 1 addition & 0 deletions packages/firecamp-electron/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
10 changes: 10 additions & 0 deletions packages/firecamp-electron/assets/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/firecamp-electron/assets/icons/mac/64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
151 changes: 151 additions & 0 deletions packages/firecamp-electron/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"name": "@firecamp/electron",
"productName": "Firecamp",
"version": "3.3.0-beta.2",
"description": "The Firecamp Desktop Application",
"main": "build/main.js",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/firecamp-dev/firecamp.git",
"directory": "packages/firecamp-electron"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "pnpm build && electron .",
"build": "tsc",
"release": "pnpm build && electron-builder -mlw --publish always",
"pack": "pnpm build && electron-builder --dir -c.compression=store -c.mac.identity=null",
"postinstall": "electron-builder install-app-deps"
},
"keywords": [],
"author": "",
"license": "AGPLv3",
"dependencies": {
"@firecamp/rest-executor": "workspace:*",
"@firecamp/scripts": "workspace:*",
"@firecamp/socket.io-executor": "workspace:*",
"@firecamp/ws-executor": "workspace:*",
"electron-is-dev": "^2.0.0",
"electron-log": "^5.0.0",
"electron-notarize": "^1.2.2",
"electron-updater": "^6.1.4",
"react-fast-compare": "^3.2.2"
},
"devDependencies": {
"@types/node": "^20.8.9",
"electron": "^27.1.2",
"electron-builder": "^24.13.3"
},
"build": {
"appId": "com.firecamp.electron",
"generateUpdatesFilesForAllChannels": true,
"productName": "Firecamp",
"afterSign": "scripts/notarize.js",
"files": [
"./build/**/*",
"package.json",
{
"from": "../../build/production",
"to": "app"
}
],
"directories": {
"buildResources": "assets"
},
"dmg": {
"sign": false
},
"mac": {
"artifactName": "Firecamp-${version}.${arch}.${ext}",
"executableName": "Firecamp",
"type": "distribution",
"target": {
"target": "default",
"arch": [
"x64",
"arm64"
]
},
"category": "public.app-category.developer-tools",
"entitlements": "assets/entitlements.mac.plist",
"entitlementsInherit": "assets/entitlements.mac.plist",
"icon": "icons/mac/512.png",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"publish": [
{
"provider": "github",
"owner": "firecamp-dev",
"repo": "firecamp"
},
{
"provider": "spaces",
"name": "firecamp",
"region": "ams3",
"channel": "latest",
"path": "/electron-apps/mac",
"acl": "public-read"
}
]
},
"linux": {
"artifactName": "Firecamp-${version}.${arch}.${ext}",
"executableName": "Firecamp",
"icon": "icons/mac/512.png",
"category": "Development",
"target": {
"target": "AppImage",
"arch": [
"x64"
]
},
"publish": [
{
"provider": "github",
"owner": "firecamp-dev",
"repo": "firecamp"
},
{
"provider": "spaces",
"name": "firecamp",
"region": "ams3",
"channel": "latest",
"path": "/electron-apps/linux",
"acl": "public-read"
}
]
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
},
"win": {
"artifactName": "Firecamp-${version}.${arch}.${ext}",
"executableName": "Firecamp",
"icon": "icons/win/logo.ico",
"target": {
"target": "nsis",
"arch": [
"x64"
]
},
"verifyUpdateCodeSignature": false,
"publish": [
{
"provider": "github",
"owner": "firecamp-dev",
"repo": "firecamp"
},
{
"provider": "spaces",
"name": "firecamp",
"region": "ams3",
"channel": "latest",
"path": "/electron-apps/win",
"acl": "public-read"
}
]
}
}
}
29 changes: 29 additions & 0 deletions packages/firecamp-electron/scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
console.log('notarisation started manually.');
const { electronPlatformName, appOutDir } = context;
if (
electronPlatformName !== 'darwin' ||
!process.env.AID ||
!process.env.APASS
) {
console.log(
'not running notarize. platform is not macos or environment not set up.'
);
return;
}

const appName = context.packager.appInfo.productFilename;

try {
return await notarize({
appBundleId: process.env.appBundleId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.AID,
appleIdPassword: process.env.APASS,
});
} catch (e) {
console.log('notarize error', e);
}
};
33 changes: 33 additions & 0 deletions packages/firecamp-electron/src/icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const path = require('path');
const isDev = require('electron-is-dev');

let trayIcon: string;
let appIcon: string;

// dev environment tray icon paths
if (isDev) {
if (process.platform === 'linux')
trayIcon = path.join(__dirname, '../assets/icons/mac/64.png'); //22x22
else if (process.platform === 'darwin')
trayIcon = path.join(__dirname, '../assets/icons/mac/64.png'); // 16x16
else if (process.platform === 'win32')
trayIcon = path.join(__dirname, '.../assets/icons/mac/64.png'); //32x32
} else if (process.platform === 'linux')
// prod. environment tray icon paths
trayIcon = path.join(process.resourcesPath, 'assets/icons/mac/64.png');
// 22x22
else if (process.platform === 'darwin')
trayIcon = path.join(process.resourcesPath, 'assets/icons/images/16x16.png');
// 16x16
else if (process.platform === 'win32')
trayIcon = path.join(process.resourcesPath, 'assets/icons/mac/64.png'); // 32x32

// App icon paths
if (process.platform === 'linux')
appIcon = path.join(__dirname, '../assets/icons/mac/512x512.png');
else if (process.platform === 'darwin')
appIcon = path.join(__dirname, '../assets/mac/icon.icns');
else if (process.platform === 'win32')
appIcon = path.join(__dirname, '../assets/icons/win/icon.ico');

export { appIcon, trayIcon };
Loading

0 comments on commit 21e36f6

Please sign in to comment.