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