FIX: No longer using hard coded values.

This commit is contained in:
Hayden Hargreaves 2025-03-05 14:18:52 -07:00
parent 18b88e2b50
commit c9eeddc2b6
4 changed files with 29 additions and 2 deletions

View File

@ -22,6 +22,7 @@
"@types/express": "^5.0.0", "@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.9", "@types/jsonwebtoken": "^9.0.9",
"@types/node": "^22.13.9", "@types/node": "^22.13.9",
"dotenv": "^16.4.7",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.8.2" "typescript": "^5.8.2"
} }
@ -1041,6 +1042,19 @@
"node": ">=0.3.1" "node": ">=0.3.1"
} }
}, },
"node_modules/dotenv": {
"version": "16.4.7",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
"integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dunder-proto": { "node_modules/dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",

View File

@ -5,7 +5,7 @@
"scripts": { "scripts": {
"build": "npx tsc", "build": "npx tsc",
"start": "node dist/server.js", "start": "node dist/server.js",
"dev": "ts-node-dev src/server.ts" "dev": "source .env && ts-node-dev src/server.ts"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -13,14 +13,19 @@
"description": "", "description": "",
"dependencies": { "dependencies": {
"archiver": "^7.0.1", "archiver": "^7.0.1",
"bcrypt": "^5.1.1",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.21.2" "express": "^4.21.2",
"jsonwebtoken": "^9.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/archiver": "^6.0.3", "@types/archiver": "^6.0.3",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17", "@types/cors": "^2.8.17",
"@types/express": "^5.0.0", "@types/express": "^5.0.0",
"@types/jsonwebtoken": "^9.0.9",
"@types/node": "^22.13.9", "@types/node": "^22.13.9",
"dotenv": "^16.4.7",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.8.2" "typescript": "^5.8.2"
} }

View File

@ -9,6 +9,7 @@ import archiver from "archiver";
import {appendDirectoryToArchive, appendFileToArchive} from "./download"; import {appendDirectoryToArchive, appendFileToArchive} from "./download";
import path from "node:path"; import path from "node:path";
import jwt from "jsonwebtoken"; import jwt from "jsonwebtoken";
import {config} from "dotenv";
import {verifyToken} from "./authenicate"; import {verifyToken} from "./authenicate";
/** /**
@ -18,6 +19,12 @@ const PORT = 5000;
const APP: Express = express(); const APP: Express = express();
const ROOT: string = "/home/azpect"; const ROOT: string = "/home/azpect";
/**
* Configure the .env file, this is for testing only
* TODO: Remove this
*/
config({path: ".env"});
/** /**
* Invalid file extentions for the file editor. * Invalid file extentions for the file editor.
*/ */

View File

@ -67,6 +67,7 @@ export default function LoginForm() {
const data = await resp.json(); const data = await resp.json();
// TODO: Handle error here // TODO: Handle error here
console.error(data.message); console.error(data.message);
return data;
} }
return await resp.json(); return await resp.json();
}; };