UNTESTED: Updated all dependencies

This commit is contained in:
2024-05-03 07:07:32 +10:00
parent 90a4fc1a6a
commit ab9e7456fb
5 changed files with 922 additions and 369 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
import React, { useState, useEffect, createContext } from 'react'; import React, { useState, useEffect, createContext } from 'react';
import decode from 'jwt-decode'; import { jwtDecode } from 'jwt-decode';
export const TokenContext = createContext(); export const TokenContext = createContext();
@@ -31,7 +31,7 @@ const TokenProvider = props => {
let bearer = accessToken; let bearer = accessToken;
//if expired (10 minutes, normally) //if expired (10 minutes, normally)
const expired = new Date(decode(accessToken).exp) < Date.now() / 1000; const expired = new Date(jwtDecode(accessToken).exp) < Date.now() / 1000;
if (expired) { if (expired) {
//BUGFIX: if logging out, just skip over the refresh token //BUGFIX: if logging out, just skip over the refresh token
@@ -86,7 +86,7 @@ const TokenProvider = props => {
let bearer = accessToken; let bearer = accessToken;
//if expired (10 minutes, normally) //if expired (10 minutes, normally)
const expired = new Date(decode(accessToken).exp) < Date.now() / 1000; const expired = new Date(jwtDecode(accessToken).exp) < Date.now() / 1000;
if (expired) { if (expired) {
//ping the auth server for a new token //ping the auth server for a new token
@@ -119,7 +119,7 @@ const TokenProvider = props => {
}; };
return ( return (
<TokenContext.Provider value={{ accessToken, setAccessToken, tokenFetch, tokenCallback, getPayload: () => decode(accessToken) }}> <TokenContext.Provider value={{ accessToken, setAccessToken, tokenFetch, tokenCallback, getPayload: () => jwtDecode(accessToken) }}>
{props.children} {props.children}
</TokenContext.Provider> </TokenContext.Provider>
) )
+24 -8
View File
@@ -184,18 +184,17 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
const supportEmail = await question('Support Email', emailUser); const supportEmail = await question('Support Email', emailUser);
//misc. configuration //misc. configuration
const projectPort = 3000; const projectPort = '3000';
const newsPort = 3100; const newsPort = '3100';
const authPort = 3200; const authPort = '3200';
const chatPort = 3300; const chatPort = '3300';
const ymlfile = ` const ymlfile = `
version: "3.8"
services: services:
${projectName}: ${projectName}:
build: . build: .
ports: ports:
- "${projectPort}" - ${projectPort}
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.routers.${projectName}router.rule=Host(\`${projectWebAddress}\`) - traefik.http.routers.${projectName}router.rule=Host(\`${projectWebAddress}\`)
@@ -215,6 +214,9 @@ services:
- AUTH_URI=https://${authWebAddress} - AUTH_URI=https://${authWebAddress}
- CHAT_URI=https://${chatWebAddress} - CHAT_URI=https://${chatWebAddress}
- SECRET_ACCESS=${accessToken} - SECRET_ACCESS=${accessToken}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
depends_on:${ projectDBHost != 'database' ? '' : ` depends_on:${ projectDBHost != 'database' ? '' : `
@@ -242,6 +244,9 @@ services:
- DB_TIMEZONE=${dbTimeZone} - DB_TIMEZONE=${dbTimeZone}
- PAGE_SIZE=10 - PAGE_SIZE=10
- SECRET_ACCESS=${accessToken} - SECRET_ACCESS=${accessToken}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
depends_on:${ newsDBHost != 'database' ? '' : ` depends_on:${ newsDBHost != 'database' ? '' : `
@@ -279,6 +284,9 @@ services:
- ADMIN_DEFAULT_PASSWORD=${defaultPass} - ADMIN_DEFAULT_PASSWORD=${defaultPass}
- SECRET_ACCESS=${accessToken} - SECRET_ACCESS=${accessToken}
- SECRET_REFRESH=${refreshToken} - SECRET_REFRESH=${refreshToken}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
depends_on:${ authDBHost != 'database' ? '' : ` depends_on:${ authDBHost != 'database' ? '' : `
@@ -305,11 +313,15 @@ services:
- DB_PASSWORD=${chatDBPass} - DB_PASSWORD=${chatDBPass}
- DB_TIMEZONE=${dbTimeZone} - DB_TIMEZONE=${dbTimeZone}
- SECRET_ACCESS=${accessToken} - SECRET_ACCESS=${accessToken}
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
depends_on:${ chatDBHost != 'database' ? '' : ` depends_on:${ chatDBHost != 'database' ? '' : `
- database`} - database`}
- traefik - traefik
${ [projectDBHost, newsDBHost, authDBHost, chatDBHost].some(x => x == "database") == false ? '' : ` ${ [projectDBHost, newsDBHost, authDBHost, chatDBHost].some(x => x == "database") == false ? '' : `
database: database:
image: mariadb image: mariadb
@@ -319,11 +331,13 @@ ${ [projectDBHost, newsDBHost, authDBHost, chatDBHost].some(x => x == "database"
volumes: volumes:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
- ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro - ./startup.sql:/docker-entrypoint-initdb.d/startup.sql:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
`} `}
traefik: traefik:
image: traefik:v2.10 image: traefik:latest
container_name: traefik container_name: traefik
command: command:
- --log.level=ERROR - --log.level=ERROR
@@ -344,6 +358,8 @@ ${ [projectDBHost, newsDBHost, authDBHost, chatDBHost].some(x => x == "database"
volumes: volumes:
- ./letsencrypt:/letsencrypt - ./letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- app-network - app-network
@@ -353,7 +369,7 @@ networks:
`; `;
const dockerfile = ` const dockerfile = `
FROM node:21-bookworm-slim FROM node:22-bookworm-slim
WORKDIR "/app" WORKDIR "/app"
COPY . /app COPY . /app
RUN mkdir /app/public RUN mkdir /app/public
+878 -342
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -27,34 +27,34 @@
}, },
"homepage": "https://github.com/KRGameStudios/MERN-template#readme", "homepage": "https://github.com/KRGameStudios/MERN-template#readme",
"dependencies": { "dependencies": {
"@babel/core": "^7.24.4", "@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.4", "@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1", "@babel/preset-react": "^7.24.1",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0", "clean-webpack-plugin": "^4.0.0",
"compression-webpack-plugin": "^10.0.0", "compression-webpack-plugin": "^11.1.0",
"concurrently": "^7.6.0", "concurrently": "^8.2.2",
"css-loader": "^6.11.0", "css-loader": "^7.1.1",
"dateformat": "^5.0.3", "dateformat": "^5.0.3",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"html-webpack-plugin": "^5.6.0", "html-webpack-plugin": "^5.6.0",
"jwt-decode": "^3.1.2", "jwt-decode": "^4.0.0",
"mariadb": "^3.3.0", "mariadb": "^3.3.0",
"react": "^18.2.0", "react": "^18.3.1",
"react-dom": "^18.2.0", "react-dom": "^18.3.1",
"react-router": "^6.3.0", "react-router": "^6.3.0",
"react-router-dom": "^6.22.3", "react-router-dom": "^6.23.0",
"react-select": "^5.8.0", "react-select": "^5.8.0",
"sequelize": "^6.37.3", "sequelize": "^6.37.3",
"socket.io-client": "^4.7.5", "socket.io-client": "^4.7.5",
"style-loader": "^3.3.4", "style-loader": "^4.0.0",
"webpack": "^5.91.0", "webpack": "^5.91.0",
"webpack-bundle-analyzer": "^4.10.2", "webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^3.1.0", "nodemon": "^3.1.0",
"webpack-dev-server": "^4.15.2" "webpack-dev-server": "^5.0.4"
} }
} }
+5 -4
View File
@@ -91,11 +91,12 @@ module.exports = ({ production, development, local, analyze }) => {
} }
}, },
proxy: { proxy: [
'/api': { {
target: 'http://localhost:3000' context: ['/api'],
target: 'http://localhost:3000',
} }
}, ],
static: '/public', static: '/public',