Skip to content

Commit

Permalink
Merge pull request #134 from CyferShepard/unstable
Browse files Browse the repository at this point in the history
Merge Unstable to Main 1.0.8 -> 1.0.9
  • Loading branch information
CyferShepard authored Dec 8, 2023
2 parents fd0be75 + 95ab3c0 commit d3203f6
Show file tree
Hide file tree
Showing 158 changed files with 16,292 additions and 9,502 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
.vscode
.github
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode/launch.json
.vscode/launch.json

# env
/backend/.env

# local deployment
/dist
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@
"command": "npm run start",
"cwd": "${workspaceFolder}"
}
,
{
"type": "node-terminal",
"name": "Run Script: start-server",
"request": "launch",
"command": "npm run start-server",
"cwd": "${workspaceFolder}"
}
]
}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ RUN npm install

COPY ./ ./

# Build the application
RUN npm run build

# Stage 2: Create the production image
FROM node:slim

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

EXPOSE 3000

CMD ["npm", "run", "start-app"]
CMD ["npm", "run", "start"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
## Getting Started with Development
- Clone the project from git
- set your env variables before strating the server (Variable names as per the docker compose file).
- Run `npm init` to install necessary packages
- Run `npm install` to install necessary packages
- Run `npm run start-server` to only run the backend nodejs server
- Run `npm run start` to only run the frontend React UI
- Run `npm run start-app` to run both backend and frontend at the same time
Expand Down
10 changes: 10 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
POSTGRES_USER = # your postgres username
POSTGRES_PASSWORD = # your postgres password

POSTGRES_IP = # your postgres IP
POSTGRES_PORT = # your postgres port

JWT_SECRET = # ultra secret word

VITE_GEOLITE_ACCOUNT_ID = # optional, your GeoLite account ID to show geolocation info for client IPs
VITE_GEOLITE_LICENSE_KEY = # optional, your GeoLite account license key to show geolocation info for client IPs
68 changes: 0 additions & 68 deletions backend/WebsocketHandler.js

This file was deleted.

17 changes: 17 additions & 0 deletions backend/classes/axios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const axios = require("axios");
const https = require('https');

const agent = new https.Agent({
rejectUnauthorized: (process.env.REJECT_SELF_SIGNED_CERTIFICATES || 'true').toLowerCase() ==='true'
});


const axios_instance = axios.create({
httpsAgent: agent
});

module.exports =
{
axios:axios_instance
};

43 changes: 43 additions & 0 deletions backend/classes/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const db = require("../db");

class Config{

async getConfig() {
try {
const { rows: config } = await db.query(
'SELECT * FROM app_config where "ID"=1'
);

if (
config.length === 0 ||
config[0].JF_HOST === null ||
config[0].JF_API_KEY === null
) {
return { error: "Config Details Not Found" };
}


return ({
JF_HOST:config[0].JF_HOST ,
JF_API_KEY:config[0].JF_API_KEY ,
APP_USER:config[0].APP_USER ,
APP_PASSWORD:config[0].APP_PASSWORD ,
REQUIRE_LOGIN:config[0].REQUIRE_LOGIN ,
settings:config[0].settings ,
api_keys:config[0].api_keys ,
});

} catch (error) {
return { error: "Config Details Not Found" };
}
}

async getPreferedAdmin() {
const config=await this.getConfig();
return config.settings?.preferred_admin?.userid;
}

}


module.exports = Config;
Loading

0 comments on commit d3203f6

Please sign in to comment.