Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit d91a735

Browse files
authored
Merge pull request #67 from Computing-Collective/client-env-remove
Client-env-remove
2 parents d67ce9f + 92d2736 commit d91a735

8 files changed

Lines changed: 31 additions & 27 deletions

File tree

.github/workflows/client-releases.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
permissions:
1212
contents: write
1313
runs-on: ${{ matrix.os }}
14-
env:
15-
API_ENDPOINT: ${{ vars.API_ENDPOINT }}
1614
defaults:
1715
run:
1816
working-directory: client
@@ -29,10 +27,6 @@ jobs:
2927
check-latest: true
3028
- name: Install Dependencies
3129
run: npm ci
32-
- name: Setup Environment Variables
33-
run: |
34-
echo "API_ENDPOINT=$API_ENDPOINT" >> .env
35-
echo "PICO_API_ENDPOINT=http://192.168.137.159" >> .env
3630
- name: Publish Electron Application
3731
env:
3832
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

client/.env.example

Lines changed: 0 additions & 2 deletions
This file was deleted.

client/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,6 @@ out/
9090

9191
# WebStorm
9292
.idea/
93+
94+
# dotenv
95+
.env*

client/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Client Frontend
22

3-
An electron app with 3 layers of authentication that you can opt-into which includes a regular password, a motion-sensor password, and a facial recognition system. The algorithms for all of these were developed by us and allows you to securely access your account. The app allows you to interact with our cloud-based storage, allowing you to upload, download, and delete things from your own storage which are isolated to each account.
3+
An electron app with 3 layers of authentication that you can opt-into which includes a regular password, a motion-sensor password, and a facial recognition system. The algorithms for all of these were developed by us and allow you to securely access your account. The app allows you to interact with our cloud-based storage, allowing you to upload, download, and delete things from your own storage which are isolated to each account.
44

55
## Technologies Used
66

@@ -10,10 +10,11 @@ We used Electron Forge to quickly design, develop, and publish our cross-platfor
1010

1111
1. Install dependencies with `npm i`
1212

13-
2. Modify the `.env.example` file to the new hostnames. Rename the file from `.env.example` to `.env`.
14-
a. In `forge.config.js` find `devContentSecurityPolicy` and add the hostnames that you added to this field.
13+
2. Modify the [`main.js`](/client/src/main.js) and [`preload.js`](/client/src/preload.js) files with your preferred hostnames (or leave them as is to use our deployed backend). Then, in [`forge.config.js`](/client/forge.config.js) find `devContentSecurityPolicy` and add the hostnames that you added to this field.
14+
- `API_ENDPOINT = <SERVER_API_ENDPOINT>`. This is the address for the backend server.
15+
- `PICO_API_ENDPOINT = <PICO IP ADDRESS>` where Pico IP address is the address to connect with the Pico microcontroller.
1516

16-
3. Run with `npm start` to launch in development mode
17+
3. Run `npm start` to launch the application in development mode
1718

1819
## Packaging Instructions
1920

client/package-lock.json

Lines changed: 12 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@mui/icons-material": "^5.11.16",
6464
"@mui/lab": "^5.0.0-alpha.126",
6565
"@mui/material": "^5.13.3",
66-
"dotenv": "^16.0.3",
66+
"dotenv": "^16.1.4",
6767
"electron-squirrel-startup": "^1.0.0",
6868
"mime": "^3.0.0",
6969
"node-fetch": "^3.3.1",

client/src/main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ const { readFileSync, writeFile } = require("node:fs");
44
const { desktopCapturer } = require("electron");
55
require("dotenv").config();
66

7-
require('update-electron-app')({
8-
updateInterval: '1 hour',
7+
API_ENDPOINT = "https://3fa.bxian03.systems/";
8+
9+
require("update-electron-app")({
10+
updateInterval: "1 hour",
911
});
1012

1113
app.commandLine.appendSwitch("ignore-certificate-errors");
@@ -30,7 +32,7 @@ const createWindow = () => {
3032
});
3133

3234
// send API_ENDPOINT to renderer on the "API_ENDPOINT" channel
33-
mainWindow.webContents.send("API_ENDPOINT", process.env.API_ENDPOINT);
35+
mainWindow.webContents.send("API_ENDPOINT", API_ENDPOINT);
3436

3537
// and load the index.html of the app.
3638
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);

client/src/preload.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44

55
const { contextBridge, ipcRenderer, app } = require("electron");
66

7+
API_ENDPOINT = "https://3fa.bxian03.systems/";
8+
PICO_API_ENDPOINT = "http://192.168.1.153";
9+
710
// 'internal' channel is used for internal stuff
811
contextBridge.exposeInMainWorld("internal", {
912
// get video feed from camera
1013
getVideoFeed: (callback) => ipcRenderer.on("camera:live-feed", callback),
1114
// exposes the getAPIEndpoint function to get the API endpoint from env
12-
getAPIEndpoint: process.env.API_ENDPOINT,
15+
getAPIEndpoint: API_ENDPOINT,
1316
// prompts the user to select a directory to place the download in
1417
openFile: () => ipcRenderer.invoke("dialog:openFile"),
1518
getFileData: (filePath) => ipcRenderer.invoke("fs:readFile", filePath),
16-
getPicoEndpoint: process.env.PICO_API_ENDPOINT,
19+
getPicoEndpoint: PICO_API_ENDPOINT,
1720
// saves the file to file/path with fileName
1821
saveFile: (file, path, fileName) => ipcRenderer.send("save-file", file, path, fileName),
1922
});

0 commit comments

Comments
 (0)