Skip to content

Commit d3203f6

Browse files
authored
Merge pull request #134 from CyferShepard/unstable
Merge Unstable to Main 1.0.8 -> 1.0.9
2 parents fd0be75 + 95ab3c0 commit d3203f6

File tree

158 files changed

+16292
-9502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+16292
-9502
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
npm-debug.log
3+
Dockerfile
4+
.dockerignore
5+
.git
6+
.gitignore
7+
.vscode
8+
.github

.eslintrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:react/recommended',
7+
'plugin:react/jsx-runtime',
8+
'plugin:react-hooks/recommended',
9+
],
10+
ignorePatterns: ['dist', '.eslintrc.cjs'],
11+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12+
settings: { react: { version: '18.2' } },
13+
plugins: ['react-refresh'],
14+
rules: {
15+
'react-refresh/only-export-components': [
16+
'warn',
17+
{ allowConstantExport: true },
18+
],
19+
},
20+
}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@
2323
npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
26+
.vscode/launch.json
27+
.vscode/launch.json
28+
29+
# env
30+
/backend/.env
31+
32+
# local deployment
33+
/dist

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@
1515
"command": "npm run start",
1616
"cwd": "${workspaceFolder}"
1717
}
18+
,
19+
{
20+
"type": "node-terminal",
21+
"name": "Run Script: start-server",
22+
"request": "launch",
23+
"command": "npm run start-server",
24+
"cwd": "${workspaceFolder}"
25+
}
1826
]
1927
}

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ RUN npm install
99

1010
COPY ./ ./
1111

12+
# Build the application
13+
RUN npm run build
14+
1215
# Stage 2: Create the production image
1316
FROM node:slim
1417

@@ -18,4 +21,4 @@ COPY --from=builder /app .
1821

1922
EXPOSE 3000
2023

21-
CMD ["npm", "run", "start-app"]
24+
CMD ["npm", "run", "start"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
## Getting Started with Development
2525
- Clone the project from git
2626
- set your env variables before strating the server (Variable names as per the docker compose file).
27-
- Run `npm init` to install necessary packages
27+
- Run `npm install` to install necessary packages
2828
- Run `npm run start-server` to only run the backend nodejs server
2929
- Run `npm run start` to only run the frontend React UI
3030
- Run `npm run start-app` to run both backend and frontend at the same time

backend/.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
POSTGRES_USER = # your postgres username
2+
POSTGRES_PASSWORD = # your postgres password
3+
4+
POSTGRES_IP = # your postgres IP
5+
POSTGRES_PORT = # your postgres port
6+
7+
JWT_SECRET = # ultra secret word
8+
9+
VITE_GEOLITE_ACCOUNT_ID = # optional, your GeoLite account ID to show geolocation info for client IPs
10+
VITE_GEOLITE_LICENSE_KEY = # optional, your GeoLite account license key to show geolocation info for client IPs

backend/WebsocketHandler.js

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

backend/classes/axios.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const axios = require("axios");
2+
const https = require('https');
3+
4+
const agent = new https.Agent({
5+
rejectUnauthorized: (process.env.REJECT_SELF_SIGNED_CERTIFICATES || 'true').toLowerCase() ==='true'
6+
});
7+
8+
9+
const axios_instance = axios.create({
10+
httpsAgent: agent
11+
});
12+
13+
module.exports =
14+
{
15+
axios:axios_instance
16+
};
17+

backend/classes/config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const db = require("../db");
2+
3+
class Config{
4+
5+
async getConfig() {
6+
try {
7+
const { rows: config } = await db.query(
8+
'SELECT * FROM app_config where "ID"=1'
9+
);
10+
11+
if (
12+
config.length === 0 ||
13+
config[0].JF_HOST === null ||
14+
config[0].JF_API_KEY === null
15+
) {
16+
return { error: "Config Details Not Found" };
17+
}
18+
19+
20+
return ({
21+
JF_HOST:config[0].JF_HOST ,
22+
JF_API_KEY:config[0].JF_API_KEY ,
23+
APP_USER:config[0].APP_USER ,
24+
APP_PASSWORD:config[0].APP_PASSWORD ,
25+
REQUIRE_LOGIN:config[0].REQUIRE_LOGIN ,
26+
settings:config[0].settings ,
27+
api_keys:config[0].api_keys ,
28+
});
29+
30+
} catch (error) {
31+
return { error: "Config Details Not Found" };
32+
}
33+
}
34+
35+
async getPreferedAdmin() {
36+
const config=await this.getConfig();
37+
return config.settings?.preferred_admin?.userid;
38+
}
39+
40+
}
41+
42+
43+
module.exports = Config;

0 commit comments

Comments
 (0)