Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56fc50d3b9 | |||
| d29e3397a6 | |||
| 335c7008aa | |||
| e89b0645ca | |||
| 36e79a513f | |||
| 6ef0affcf6 | |||
| cb0c1284bf | |||
| 5cf4b66894 | |||
| 45cf281c91 | |||
| 2794b4c724 | |||
| b1f49a4166 | |||
| 4cbf67dcbb | |||
| fd29385cf8 | |||
| 8e81dccef6 | |||
| adeb8c4267 | |||
| eb6c3a40d7 | |||
| 4d4a0b5401 | |||
| 490860159e | |||
| ed01fe6db5 | |||
| cfb8d20ad2 | |||
| d44cae397d | |||
| b97fff05b3 | |||
| 22703bfbcb | |||
| 14a3c9eabe | |||
| 8e90a4a540 | |||
| 1d3c94a1aa | |||
| ca5e79ccf3 | |||
| 03acce1907 | |||
| c0b7280533 | |||
| 2925cce7ca | |||
| b90670b922 | |||
| 290f25f898 | |||
| 3cdef433f9 | |||
| 53c8ddab54 |
@@ -0,0 +1,5 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
patreon: krgamestudios
|
||||
ko_fi: krgamestudios
|
||||
custom: ["https://www.paypal.com/donate/?hosted_button_id=73Q82T2ZHV8AA"]
|
||||
@@ -39,7 +39,7 @@ docker-compose up --build
|
||||
To set up this template in development mode:
|
||||
|
||||
1. Ensure mariadb is running in your development environment
|
||||
2. Run `mariadb sql/create_database.sql` as the root user
|
||||
2. Run `mariadb tools/create_database.sql` as the root user
|
||||
3. Run `npm install`
|
||||
4. Run `cp .envdev .env` and enter your details into the `.env` file
|
||||
5. Execute `npm run dev`
|
||||
@@ -56,6 +56,7 @@ To set up this template in development mode:
|
||||
- Account deletion
|
||||
- Password management
|
||||
- JSON web token authentication
|
||||
- HttpOnly cookies for security
|
||||
- Optional post validation hook
|
||||
- Fully Featured News Blog (as a microservice)
|
||||
- Publish, edit or delete articles as needed
|
||||
|
||||
+9
-7
@@ -2,14 +2,16 @@
|
||||
import 'regenerator-runtime/runtime';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
import App from './pages/app';
|
||||
import TokenProvider from './pages/utilities/token-provider';
|
||||
|
||||
ReactDOM.render(
|
||||
<TokenProvider>
|
||||
<App />
|
||||
</TokenProvider>,
|
||||
document.querySelector('#root')
|
||||
);
|
||||
ReactDOM
|
||||
.createRoot(document.getElementById('root'))
|
||||
.render(
|
||||
<TokenProvider>
|
||||
<App />
|
||||
</TokenProvider>
|
||||
)
|
||||
;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useContext, useRef } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
@@ -13,7 +13,7 @@ const Account = props => {
|
||||
|
||||
//misplaced?
|
||||
if (!authTokens.accessToken) {
|
||||
return <Redirect to='/' />;
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
|
||||
//refs
|
||||
@@ -23,12 +23,7 @@ const Account = props => {
|
||||
|
||||
//grab the user's info
|
||||
useEffect(() => {
|
||||
authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
})
|
||||
authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`)
|
||||
.then(blob => blob.json())
|
||||
.then(json => contactRef.current.checked = json.contact)
|
||||
.catch(e => console.error(e))
|
||||
@@ -88,7 +83,6 @@ const update = async (password, retype, contact, tokenFetch) => {
|
||||
const result = await tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
@@ -13,7 +13,7 @@ const Login = props => {
|
||||
|
||||
//misplaced?
|
||||
if (authTokens.accessToken) {
|
||||
return <Redirect to='/' />;
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
|
||||
//refs
|
||||
@@ -31,17 +31,16 @@ const Login = props => {
|
||||
async evt => {
|
||||
//on submit
|
||||
evt.preventDefault();
|
||||
const [err, newTokens] = await handleSubmit(emailRef.current.value, passwordRef.current.value);
|
||||
const [err, accessToken] = await handleSubmit(emailRef.current.value, passwordRef.current.value);
|
||||
if (err) {
|
||||
alert(err);
|
||||
}
|
||||
|
||||
//save auth tokens and redirect
|
||||
if (newTokens) {
|
||||
authTokens.setAccessToken(newTokens.accessToken);
|
||||
authTokens.setRefreshToken(newTokens.refreshToken);
|
||||
if (accessToken) {
|
||||
authTokens.setAccessToken(accessToken);
|
||||
|
||||
props.history.push('/');
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
}
|
||||
}>
|
||||
@@ -72,13 +71,13 @@ const handleSubmit = async (email, password) => {
|
||||
const result = await fetch(`${process.env.AUTH_URI}/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
password,
|
||||
})
|
||||
}),
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
//handle errors
|
||||
@@ -89,8 +88,8 @@ const handleSubmit = async (email, password) => {
|
||||
}
|
||||
|
||||
//return the new auth tokens
|
||||
const newTokens = await result.json();
|
||||
return [null, newTokens];
|
||||
const accessToken = await result.text();
|
||||
return [null, accessToken];
|
||||
};
|
||||
|
||||
//returns an error message, or null on success
|
||||
|
||||
@@ -38,7 +38,6 @@ const handleSubmit = async (password, authTokens) => {
|
||||
const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/account`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
@@ -52,14 +51,7 @@ const handleSubmit = async (password, authTokens) => {
|
||||
|
||||
//force a logout
|
||||
const result2 = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: authTokens.refreshToken
|
||||
})
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
if (!result2.ok) {
|
||||
@@ -67,7 +59,6 @@ const handleSubmit = async (password, authTokens) => {
|
||||
}
|
||||
|
||||
authTokens.setAccessToken('');
|
||||
authTokens.setRefreshToken('');
|
||||
|
||||
return [null];
|
||||
};
|
||||
|
||||
@@ -12,14 +12,7 @@ const Logout = () => {
|
||||
{ /* Logout logs you out of the server too */ }
|
||||
<Link to='/' onClick={async () => {
|
||||
const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, { //NOTE: this gets overwritten as a bugfix
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: authTokens.refreshToken
|
||||
})
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
//any problems?
|
||||
@@ -27,7 +20,6 @@ const Logout = () => {
|
||||
console.error(await result.text());
|
||||
} else {
|
||||
authTokens.setAccessToken('');
|
||||
authTokens.setRefreshToken('');
|
||||
}
|
||||
}}>Logout</Link>
|
||||
</>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
@@ -9,12 +9,15 @@ import { TokenContext } from '../utilities/token-provider';
|
||||
const validateEmail = require('../../../common/utilities/validate-email');
|
||||
|
||||
const Recover = props => {
|
||||
//history
|
||||
const navigate = useNavigate();
|
||||
|
||||
//context
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
//misplaced?
|
||||
if (authTokens.accessToken) {
|
||||
return <Redirect to='/' />;
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
//refs
|
||||
@@ -39,7 +42,7 @@ const Recover = props => {
|
||||
|
||||
//redirect
|
||||
if (redirect) {
|
||||
props.history.push('/');
|
||||
navigate("/");
|
||||
}
|
||||
}
|
||||
}>
|
||||
@@ -66,8 +69,7 @@ const handleSubmit = async (email) => {
|
||||
const result = await fetch(`${process.env.AUTH_URI}/auth/recover`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import queryString from 'query-string';
|
||||
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
import { TokenContext } from '../utilities/token-provider';
|
||||
|
||||
const Reset = props => {
|
||||
//params
|
||||
const [params, setParams] = useSearchParams(); //the URLSearchParams API
|
||||
|
||||
//history
|
||||
const navigate = useNavigate();
|
||||
|
||||
//context
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
//query
|
||||
const query = queryString.parse(props.location.search);
|
||||
|
||||
//misplaced?
|
||||
if (authTokens.accessToken || !query.email || !query.token) {
|
||||
return <Redirect to='/' />;
|
||||
if (authTokens.accessToken || !params.has('email') || !params.has('token')) {
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
//refs
|
||||
@@ -31,7 +33,7 @@ const Reset = props => {
|
||||
<h1 className='text centered'>Reset Password</h1>
|
||||
<form className='constrained' onSubmit={async evt => {
|
||||
evt.preventDefault();
|
||||
const [err, redirect] = await update(passwordRef.current.value, retypeRef.current.value, query);
|
||||
const [err, redirect] = await update(passwordRef.current.value, retypeRef.current.value, params);
|
||||
|
||||
if (err) {
|
||||
alert(err);
|
||||
@@ -42,7 +44,7 @@ const Reset = props => {
|
||||
|
||||
//redirect
|
||||
if (redirect) {
|
||||
props.history.push('/');
|
||||
navigate("/");
|
||||
}
|
||||
}}>
|
||||
<input type='password' name='password' placeholder='New Password' ref={passwordRef} />
|
||||
@@ -56,7 +58,7 @@ const Reset = props => {
|
||||
);
|
||||
};
|
||||
|
||||
const update = async (password, retype, query) => {
|
||||
const update = async (password, retype, params) => {
|
||||
if (password != retype) {
|
||||
return ['Passwords do not match'];
|
||||
}
|
||||
@@ -65,10 +67,9 @@ const update = async (password, retype, query) => {
|
||||
return ['Password is too short'];
|
||||
}
|
||||
|
||||
const result = await fetch(`${process.env.AUTH_URI}/auth/reset?email=${query.email}&token=${query.token}`, {
|
||||
const result = await fetch(`${process.env.AUTH_URI}/auth/reset?email=${params.get('email')}&token=${params.get('token')}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
@@ -10,12 +10,15 @@ const validateEmail = require('../../../common/utilities/validate-email');
|
||||
const validateUsername = require('../../../common/utilities/validate-username');
|
||||
|
||||
const Signup = props => {
|
||||
//history
|
||||
const navigate = useNavigate();
|
||||
|
||||
//context
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
//misplaced?
|
||||
if (authTokens.accessToken) {
|
||||
return <Redirect to='/' />;
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
//refs
|
||||
@@ -44,7 +47,7 @@ const Signup = props => {
|
||||
|
||||
//redirect
|
||||
if (redirect) {
|
||||
props.history.push('/');
|
||||
navigate("/");
|
||||
}
|
||||
}
|
||||
}>
|
||||
@@ -83,8 +86,7 @@ const handleSubmit = async (email, username, password, retype, contact) => {
|
||||
const result = await fetch(`${process.env.AUTH_URI}/auth/signup`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import React, { useContext } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
import { TokenContext } from '../utilities/token-provider';
|
||||
|
||||
import NewsPublisher from './panels/news-publisher';
|
||||
import NewsEditor from './panels/news-editor';
|
||||
|
||||
import GrantAdmin from './panels/grant-admin';
|
||||
import GrantMod from './panels/grant-mod';
|
||||
|
||||
@@ -17,7 +14,7 @@ const Admin = props => {
|
||||
|
||||
//misplaced? (admin only)
|
||||
if (!authTokens.accessToken || !authTokens.getPayload().admin) {
|
||||
return <Redirect to='/' />;
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -26,9 +23,6 @@ const Admin = props => {
|
||||
<div className='page panel'>
|
||||
<div className='central panel'>
|
||||
<h1 className='text centered'>Administration Tools</h1>
|
||||
<NewsPublisher />
|
||||
<br />
|
||||
<NewsEditor />
|
||||
<br />
|
||||
<GrantAdmin />
|
||||
<br />
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import React, { useContext } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from '../utilities/apply-to-body';
|
||||
|
||||
import { TokenContext } from '../utilities/token-provider';
|
||||
|
||||
import NewsPublisher from './panels/news-publisher';
|
||||
import NewsEditor from './panels/news-editor';
|
||||
|
||||
import ChatReports from './panels/chat-reports';
|
||||
import BanUser from './panels/ban-user';
|
||||
|
||||
@@ -14,7 +17,7 @@ const Mod = props => {
|
||||
|
||||
//misplaced? (admin only)
|
||||
if (!authTokens.accessToken || !(authTokens.getPayload().admin || authTokens.getPayload().mod)) {
|
||||
return <Redirect to='/' />;
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -23,7 +26,12 @@ const Mod = props => {
|
||||
<div className='page panel'>
|
||||
<div className='central panel'>
|
||||
<h1 className='text centered'>Moderation Tools</h1>
|
||||
<NewsPublisher />
|
||||
<br />
|
||||
<NewsEditor />
|
||||
<br />
|
||||
<BanUser />
|
||||
<br />
|
||||
<ChatReports />
|
||||
<Link to='/' className='text centered'>Return Home</Link>
|
||||
</div>
|
||||
|
||||
@@ -42,8 +42,7 @@ const handleButtonPress = async (username, tokenFetch) => {
|
||||
const result = await tokenFetch(`${process.env.AUTH_URI}/admin/banuser`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username
|
||||
|
||||
@@ -7,21 +7,13 @@ const ChatReports = props => {
|
||||
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
useEffect(async () => {
|
||||
const result = await authTokens.tokenFetch(`${process.env.CHAT_URI}/admin/reports`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
const err = `${result.status}: ${await result.text()}`;
|
||||
console.log(err);
|
||||
alert(err);
|
||||
} else {
|
||||
setReports(await result.json());
|
||||
}
|
||||
useEffect(() => {
|
||||
authTokens.tokenFetch(`${process.env.CHAT_URI}/admin/reports`)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
setReports(json);
|
||||
})
|
||||
;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -59,8 +51,7 @@ const deleteReportsFor = (chatlogIndex, tokenFetch, setReports) => {
|
||||
tokenFetch(`${process.env.CHAT_URI}/admin/reports`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ chatlogIndex })
|
||||
});
|
||||
|
||||
@@ -51,8 +51,7 @@ const handleButtonPress = async (username, tokenFetch, method) => {
|
||||
const result = await tokenFetch(`${process.env.AUTH_URI}/admin/admin`, {
|
||||
method: method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username
|
||||
|
||||
@@ -51,8 +51,7 @@ const handleButtonPress = async (username, tokenFetch, method) => {
|
||||
const result = await tokenFetch(`${process.env.AUTH_URI}/admin/mod`, {
|
||||
method: method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username
|
||||
|
||||
@@ -17,22 +17,13 @@ const NewsEditor = props => {
|
||||
const [index, setIndex] = useState(null);
|
||||
|
||||
//run once
|
||||
useEffect(async () => {
|
||||
const result = await fetch(`${process.env.NEWS_URI}/news/metadata?limit=999`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
const err = `${result.status}: ${await result.text()}`;
|
||||
console.log(err);
|
||||
alert(err);
|
||||
} else {
|
||||
setArticles(await result.json());
|
||||
}
|
||||
useEffect(() => {
|
||||
fetch(`${process.env.NEWS_URI}/news/metadata?limit=999`)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
setArticles(json)
|
||||
})
|
||||
;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -42,11 +33,7 @@ const NewsEditor = props => {
|
||||
options={articles.map(article => { return { label: article.title, index: article.index }; })}
|
||||
onChange={async ({index}) => {
|
||||
//fetch this article
|
||||
const result = await fetch(`${process.env.NEWS_URI}/news/archive/${index}`, {
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
}
|
||||
});
|
||||
const result = await fetch(`${process.env.NEWS_URI}/news/archive/${index}`);
|
||||
|
||||
if (!result.ok) {
|
||||
const err = `${result.status}: ${await result.text()}`;
|
||||
@@ -107,8 +94,7 @@ const handleSubmit = async (title, author, body, index, tokenFetch) => {
|
||||
const result = await tokenFetch(`${process.env.NEWS_URI}/news/${index}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title,
|
||||
|
||||
@@ -46,8 +46,7 @@ const handleSubmit = async (title, author, body, tokenFetch) => {
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title,
|
||||
|
||||
+34
-21
@@ -1,11 +1,8 @@
|
||||
//react
|
||||
import React, { useContext } from 'react';
|
||||
import { BrowserRouter, Switch } from 'react-router-dom';
|
||||
import React, { useContext, Suspense, lazy } from 'react';
|
||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||
import { TokenContext } from './utilities/token-provider';
|
||||
|
||||
//library components
|
||||
import LazyRoute from './utilities/lazy-route';
|
||||
|
||||
//styling
|
||||
import '../styles/styles.css';
|
||||
|
||||
@@ -13,33 +10,49 @@ import '../styles/styles.css';
|
||||
import Footer from './panels/footer';
|
||||
import PopupChat from './panels/popup-chat';
|
||||
|
||||
//lazy wrappers
|
||||
const Homepage = lazy(() => import('./homepage'));
|
||||
const Signup = lazy(() => import('./accounts/signup'));
|
||||
const Login = lazy(() => import('./accounts/login'));
|
||||
const Account = lazy(() => import('./accounts/account'));
|
||||
const Dashboard = lazy(() => import('./dashboard'));
|
||||
const Recover = lazy(() => import('./accounts/recover'));
|
||||
const Reset = lazy(() => import('./accounts/reset'));
|
||||
const Admin = lazy(() => import('./administration/admin'));
|
||||
const Mod = lazy(() => import('./administration/mod'));
|
||||
const PrivacyPolicy = lazy(() => import('./static/privacy-policy'));
|
||||
const Credits = lazy(() => import('./static/credits'));
|
||||
const NotFound = lazy(() => import('./not-found'));
|
||||
|
||||
const App = props => {
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
//default render
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Switch>
|
||||
<LazyRoute exact path='/' component={() => import('./homepage')} />
|
||||
<Suspense>
|
||||
<Routes>
|
||||
<Route exact path='/' element={<Homepage />} />
|
||||
|
||||
<LazyRoute path='/signup' component={() => import('./accounts/signup')} />
|
||||
<LazyRoute path='/login' component={() => import('./accounts/login')} />
|
||||
<LazyRoute path='/account' component={() => import('./accounts/account')} />
|
||||
<LazyRoute path='/dashboard' component={() => import('./dashboard')} />
|
||||
<Route path='/signup' element={<Signup />} />
|
||||
<Route path='/login' element={<Login />} />
|
||||
<Route path='/account' element={<Account />} />
|
||||
<Route path='/dashboard' element={<Dashboard />} />
|
||||
|
||||
<LazyRoute path='/recover' component={() => import('./accounts/recover')} />
|
||||
<LazyRoute path='/reset' component={() => import('./accounts/reset')} />
|
||||
<Route path='/recover' element={<Recover />} />
|
||||
<Route path='/reset' element={<Reset />} />
|
||||
|
||||
<LazyRoute path='/admin' component={() => import('./administration/admin')} />
|
||||
<LazyRoute path='/mod' component={() => import('./administration/mod')} />
|
||||
<Route path='/admin' element={<Admin />} />
|
||||
<Route path='/mod' element={<Mod />} />
|
||||
|
||||
<LazyRoute path='/privacypolicy' component={() => import('./static/privacy-policy')} />
|
||||
<LazyRoute path='/credits' component={() => import('./static/credits')} />
|
||||
<Route path='/privacypolicy' element={<PrivacyPolicy />} />
|
||||
<Route path='/credits' element={<Credits />} />
|
||||
|
||||
<LazyRoute path='*' component={() => import('./not-found')} />
|
||||
</Switch>
|
||||
{ authTokens.accessToken ? <PopupChat /> : <></> }
|
||||
<Footer />
|
||||
<Route path='*' element={<NotFound />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
{ authTokens.accessToken ? <PopupChat /> : <></> }
|
||||
<Footer />
|
||||
</BrowserRouter>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useContext } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from './utilities/apply-to-body';
|
||||
|
||||
@@ -13,7 +13,7 @@ const Dashboard = props => {
|
||||
|
||||
//misplaced?
|
||||
if (!authTokens.accessToken) {
|
||||
return <Redirect to='/' />;
|
||||
return <Navigate to='/' />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useContext } from 'react';
|
||||
import { Link, Redirect } from 'react-router-dom';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
|
||||
import ApplyToBody from './utilities/apply-to-body';
|
||||
|
||||
@@ -13,7 +13,7 @@ const HomePage = props => {
|
||||
|
||||
//misplaced?
|
||||
if (authTokens.accessToken) {
|
||||
return <Redirect to='/dashboard' />;
|
||||
return <Navigate to='/dashboard' />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -13,7 +13,7 @@ const Break = () => {
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer>
|
||||
<p className='text centered'>© <a href='https://krgamestudios.com'>KR Game Studios</a> 2020-2021<Break /><Link to='/privacypolicy'>Privacy Policy</Link><Break /><Link to='/credits'>Credits</Link></p>
|
||||
<p className='text centered'>© <a href='https://krgamestudios.com'>KR Game Studios</a> 2020-2022<Break /><Link to='/privacypolicy'>Privacy Policy</Link><Break /><Link to='/credits'>Credits</Link></p>
|
||||
</footer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -8,11 +8,6 @@ const NewsFeed = props => {
|
||||
useEffect(() => {
|
||||
//this... um...
|
||||
fetch(`${process.env.NEWS_URI}/news`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
signal: aborter.current.signal //oh dear
|
||||
})
|
||||
.then(blob => blob.json())
|
||||
@@ -27,7 +22,6 @@ const NewsFeed = props => {
|
||||
<div className='panel'>
|
||||
<h1 className='text centered'>News Feed</h1>
|
||||
{articles.map((article, index) => {
|
||||
console.log(article)
|
||||
return (
|
||||
<div key={index} className='panel'>
|
||||
<hr />
|
||||
|
||||
@@ -78,7 +78,7 @@ const handleSend = (inputRef, pushChatlog, username, accessToken) => {
|
||||
});
|
||||
|
||||
if (!inputRef.current.value.startsWith('/')) {
|
||||
pushChatlog({ username: username, text: inputRef.current.value });
|
||||
pushChatlog({ createdAt: (new Date(Date.now())).toISOString(), username: username, text: inputRef.current.value });
|
||||
}
|
||||
|
||||
inputRef.current.value = '';
|
||||
@@ -86,7 +86,36 @@ const handleSend = (inputRef, pushChatlog, username, accessToken) => {
|
||||
|
||||
//render each line
|
||||
const processLine = (line, index, accessToken) => {
|
||||
let content = <div className='content'>{line.username ? <span className='username'>{line.username}: </span> : ''}{line.text ? <span className='text'>{line.text}</span> : ''}</div>;
|
||||
//utility functions
|
||||
const isValidDate = d => {
|
||||
return d instanceof Date && !isNaN(d);
|
||||
};
|
||||
|
||||
const isToday = d => {
|
||||
const now = new Date(Date.now());
|
||||
return d.getDate() == now.getDate() && d.getMonth() == now.getMonth() && d.getFullYear() == now.getFullYear();
|
||||
};
|
||||
|
||||
const isThisYear = d => {
|
||||
const now = new Date(Date.now());
|
||||
return d.getFullYear() == now.getFullYear();
|
||||
};
|
||||
|
||||
//parse the date
|
||||
const date = new Date(line.createdAt);
|
||||
|
||||
//split it up so we can format each field individually
|
||||
const year = `${date.getFullYear()}`;
|
||||
const month = `${date.getMonth() + 1}`;
|
||||
const day = `${date.getDate()}`;
|
||||
const hours = `${date.getHours()}`;
|
||||
const minutes = `${date.getMinutes()}`.padStart(2, '0');
|
||||
|
||||
//combine into the final timestamp
|
||||
const timestamp = !isValidDate(date) ? '' : isToday(date) ? `${hours}:${minutes}` : isThisYear(date) ? `${month}/${day}` : `${year}`;
|
||||
|
||||
//generate the content string
|
||||
let content = <div className='content row'>{timestamp.length > 0 ? <span className='timestamp col'>{timestamp}</span> : null }<span className='inner col'>{line.username ? <span className='username'>{line.username}: </span> : ''}{line.text ? <span className='text'>{line.text}</span> : ''}</span></div>;
|
||||
|
||||
//decorators
|
||||
if (line.emphasis) {
|
||||
@@ -97,7 +126,8 @@ const processLine = (line, index, accessToken) => {
|
||||
content = <strong>{content}</strong>;
|
||||
}
|
||||
|
||||
return <li key={index} className='line'>{content}<a className='report' onClick={() => processReport(line, accessToken)}>!!!</a></li>;
|
||||
|
||||
return <li key={index} className='line table noCollapse'>{content}<a className='report' onClick={() => processReport(line, accessToken)}>!!!</a></li>;
|
||||
};
|
||||
|
||||
const processReport = (line, accessToken) => {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const Static = props => {
|
||||
return (
|
||||
<>
|
||||
<div className='page central'>
|
||||
<header>
|
||||
<h1 className='text centered'>Credits</h1>
|
||||
</header>
|
||||
<h2>MERN-template</h2>
|
||||
<h2 className='text centered'>MERN-template</h2>
|
||||
<p>The <a href='https://github.com/krgamestudios/MERN-template'>MERN-template</a> developed by Kayne Ruse, KR Game Studios</p>
|
||||
</>
|
||||
|
||||
<Link className='text centered' to='/'>Return Home</Link>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Static;
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const Static = props => {
|
||||
return (
|
||||
<header>
|
||||
<h1 className="text centered">Privacy Policy</h1>
|
||||
</header>
|
||||
<div className='page central'>
|
||||
<header>
|
||||
<h1 className="text centered">Privacy Policy</h1>
|
||||
|
||||
<Link className='text centered' to='/'>Return Home</Link>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Static;
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Route } from 'react-router-dom';
|
||||
import loadable from '@loadable/component';
|
||||
|
||||
const LazyRoute = props => {
|
||||
const { component, ...lazyProps } = props;
|
||||
|
||||
const lazyComponent = loadable(component);
|
||||
|
||||
return <Route {...lazyProps} component={lazyComponent} />
|
||||
};
|
||||
|
||||
export default LazyRoute;
|
||||
@@ -8,19 +8,22 @@ export const TokenContext = createContext();
|
||||
const TokenProvider = props => {
|
||||
//state to be used
|
||||
const [accessToken, setAccessToken] = useState('');
|
||||
const [refreshToken, setRefreshToken] = useState('');
|
||||
|
||||
//make the access and refresh tokens persist between reloads
|
||||
//force a logout under certain conditions
|
||||
const forceLogout = () => {
|
||||
localStorage.removeItem("accessToken");
|
||||
setAccessToken("");
|
||||
};
|
||||
|
||||
//make the access token persist between reloads
|
||||
useEffect(() => {
|
||||
setAccessToken(localStorage.getItem("accessToken") || '');
|
||||
setRefreshToken(localStorage.getItem("refreshToken") || '');
|
||||
}, []);
|
||||
|
||||
//update the stored copies
|
||||
useEffect(() => {
|
||||
localStorage.setItem("accessToken", accessToken);
|
||||
localStorage.setItem("refreshToken", refreshToken);
|
||||
}, [accessToken, refreshToken]);
|
||||
}, [accessToken]);
|
||||
|
||||
//wrap the default fetch function
|
||||
const tokenFetch = async (url, options) => {
|
||||
@@ -36,30 +39,23 @@ const TokenProvider = props => {
|
||||
return fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Authorization': `Bearer ${bearer}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: refreshToken
|
||||
})
|
||||
credentials: 'include'
|
||||
});
|
||||
}
|
||||
|
||||
//ping the auth server for a new token
|
||||
//ping the auth server for a new access token
|
||||
const response = await fetch(`${process.env.AUTH_URI}/auth/token`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: refreshToken
|
||||
})
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
//any errors, throw them
|
||||
if (!response.ok) {
|
||||
if (response.status == 403) {
|
||||
forceLogout();
|
||||
}
|
||||
throw `${response.status}: ${await response.text()}`;
|
||||
}
|
||||
|
||||
@@ -67,7 +63,6 @@ const TokenProvider = props => {
|
||||
const newAuth = await response.json();
|
||||
|
||||
setAccessToken(newAuth.accessToken);
|
||||
setRefreshToken(newAuth.refreshToken);
|
||||
bearer = newAuth.accessToken;
|
||||
}
|
||||
|
||||
@@ -77,7 +72,8 @@ const TokenProvider = props => {
|
||||
headers: {
|
||||
...(options || { headers: {} }).headers,
|
||||
'Authorization': `Bearer ${bearer}`
|
||||
}
|
||||
},
|
||||
credentials: 'include'
|
||||
});
|
||||
};
|
||||
|
||||
@@ -90,17 +86,14 @@ const TokenProvider = props => {
|
||||
//ping the auth server for a new token
|
||||
const response = await fetch(`${process.env.AUTH_URI}/auth/token`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: refreshToken
|
||||
})
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
//any errors, throw them
|
||||
if (!response.ok) {
|
||||
if (response.status == 403) {
|
||||
forceLogout();
|
||||
}
|
||||
throw `${response.status}: ${await response.text()}`;
|
||||
}
|
||||
|
||||
@@ -108,7 +101,6 @@ const TokenProvider = props => {
|
||||
const newAuth = await response.json();
|
||||
|
||||
setAccessToken(newAuth.accessToken);
|
||||
setRefreshToken(newAuth.refreshToken);
|
||||
|
||||
//finally
|
||||
return cb(newAuth.accessToken);
|
||||
@@ -118,7 +110,7 @@ const TokenProvider = props => {
|
||||
};
|
||||
|
||||
return (
|
||||
<TokenContext.Provider value={{ accessToken, refreshToken, setAccessToken, setRefreshToken, tokenFetch, tokenCallback, getPayload: () => decode(accessToken) }}>
|
||||
<TokenContext.Provider value={{ accessToken, setAccessToken, tokenFetch, tokenCallback, getPayload: () => decode(accessToken) }}>
|
||||
{props.children}
|
||||
</TokenContext.Provider>
|
||||
)
|
||||
|
||||
@@ -77,6 +77,16 @@
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.chat .timestamp {
|
||||
max-width: 44px;
|
||||
}
|
||||
|
||||
.chat .inner {
|
||||
flex: 1 !important;
|
||||
display: inline-block !important;
|
||||
flex-direction: row !important;
|
||||
}
|
||||
|
||||
.chat .username {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
<meta property="og:description" content="" />
|
||||
</head>
|
||||
<body>
|
||||
<div id = "root"></div>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+20
-11
@@ -46,6 +46,14 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
|
||||
`
|
||||
);
|
||||
|
||||
//determine local computer address for mac user vs everyone else
|
||||
let macUser = '';
|
||||
while (macUser.toLowerCase() !== 'yes' && macUser.toLowerCase() !== 'no') {
|
||||
macUser = await question('Will the MERN Template be running locally on a MacOS system? (yes or no)', '');
|
||||
}
|
||||
|
||||
const localAddress = macUser ? 'localhost' : '%';
|
||||
|
||||
//project configuration
|
||||
const projectName = await question('Project Name', 'template');
|
||||
const projectWebAddress = await question('Project Web Address', 'example.com');
|
||||
@@ -62,7 +70,7 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
|
||||
//auth configuration
|
||||
const authName = await question('Auth Name', 'auth');
|
||||
const authWebAddress = await question('Auth Web Address', `${authName}.${projectWebAddress}`);
|
||||
const authPostValidationHook = await question('Auth Post Validation Hook', '');
|
||||
const authPostValidationHookArray = await question('Auth Post Validation Hook Array', '');
|
||||
const authResetAddress = await question('Auth Reset Addr', `${projectWebAddress}/reset`);
|
||||
const authDBUser = await question('Auth DB Username', authName);
|
||||
const authDBPass = await question('Auth DB Password', 'charizard');
|
||||
@@ -181,7 +189,7 @@ services:
|
||||
environment:
|
||||
- WEB_PROTOCOL=https
|
||||
- WEB_ADDRESS=${authWebAddress}
|
||||
- HOOK_POST_VALIDATION=${authPostValidationHook}
|
||||
- HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray}
|
||||
- WEB_RESET_ADDRESS=${authResetAddress}
|
||||
- WEB_PORT=${authPort}
|
||||
- DB_HOSTNAME=database
|
||||
@@ -270,7 +278,7 @@ networks:
|
||||
`;
|
||||
|
||||
const dockerfile = `
|
||||
FROM node:16
|
||||
FROM node:18-bullseye-slim
|
||||
WORKDIR "/app"
|
||||
COPY . /app
|
||||
RUN mkdir /app/public
|
||||
@@ -284,24 +292,25 @@ CMD ["sleep 10 && npm start"]
|
||||
|
||||
const sqlfile = `
|
||||
CREATE DATABASE IF NOT EXISTS ${projectName};
|
||||
CREATE USER IF NOT EXISTS '${projectDBUser}'@'%' IDENTIFIED BY '${projectDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${projectName}.* TO '${projectDBUser}'@'%';
|
||||
CREATE USER IF NOT EXISTS '${projectDBUser}'@'${localAddress}' IDENTIFIED BY '${projectDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${projectName}.* TO '${projectDBUser}'@'${localAddress}';
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS ${newsName};
|
||||
CREATE USER IF NOT EXISTS '${newsDBUser}'@'%' IDENTIFIED BY '${newsDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${newsName}.* TO '${newsDBUser}'@'%';
|
||||
CREATE USER IF NOT EXISTS '${newsDBUser}'@'${localAddress}' IDENTIFIED BY '${newsDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${newsName}.* TO '${newsDBUser}'@'${localAddress}';
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS ${authName};
|
||||
CREATE USER IF NOT EXISTS '${authDBUser}'@'%' IDENTIFIED BY '${authDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${authName}.* TO '${authDBUser}'@'%';
|
||||
CREATE USER IF NOT EXISTS '${authDBUser}'@'${localAddress}' IDENTIFIED BY '${authDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${authName}.* TO '${authDBUser}'@'${localAddress}';
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS ${chatName};
|
||||
CREATE USER IF NOT EXISTS '${chatDBUser}'@'%' IDENTIFIED BY '${chatDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${chatName}.* TO '${chatDBUser}'@'%';
|
||||
CREATE USER IF NOT EXISTS '${chatDBUser}'@'${localAddress}' IDENTIFIED BY '${chatDBPass}';
|
||||
GRANT ALL PRIVILEGES ON ${chatName}.* TO '${chatDBUser}'@'${localAddress}';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
`;
|
||||
|
||||
|
||||
fs.writeFileSync('docker-compose.yml', ymlfile);
|
||||
fs.writeFileSync('Dockerfile', dockerfile);
|
||||
fs.writeFileSync('startup.sql', sqlfile);
|
||||
|
||||
Generated
+1932
-9997
File diff suppressed because it is too large
Load Diff
+29
-33
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mern-template",
|
||||
"version": "1.2.0",
|
||||
"version": "1.4.1",
|
||||
"description": "A website template using the MERN stack.",
|
||||
"main": "server/server.js",
|
||||
"scripts": {
|
||||
@@ -9,10 +9,10 @@
|
||||
"build:server": "exit 0",
|
||||
"build:client": "webpack --env=production --config webpack.config.js",
|
||||
"dev": "concurrently npm:dev:server npm:dev:client",
|
||||
"dev:server": "nodemon ./* --ext js,jsx,json --ignore 'node_modules/*'",
|
||||
"dev:server": "nodemon --ext js,jsx,json --ignore 'node_modules/*'",
|
||||
"dev:client": "webpack serve --env=development --config webpack.config.js",
|
||||
"local": "concurrently npm:local:server npm:local:client",
|
||||
"local:server": "nodemon ./* --ext js,jsx,json --ignore 'node_modules/*'",
|
||||
"local:server": "nodemon --ext js,jsx,json --ignore 'node_modules/*'",
|
||||
"local:client": "webpack serve --env=local --config webpack.config.js",
|
||||
"analyze": "webpack --env=production --env=analyze --config webpack.config.js"
|
||||
},
|
||||
@@ -27,38 +27,34 @@
|
||||
},
|
||||
"homepage": "https://github.com/KRGameStudios/MERN-template#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.14.8",
|
||||
"@babel/preset-env": "^7.14.8",
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@loadable/component": "^5.15.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"compression-webpack-plugin": "^8.0.1",
|
||||
"concurrently": "^6.2.0",
|
||||
"css-loader": "^6.2.0",
|
||||
"dateformat": "^4.5.1",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"html-webpack-plugin": "^5.3.2",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"babel-loader": "^8.3.0",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"compression-webpack-plugin": "^10.0.0",
|
||||
"concurrently": "^7.6.0",
|
||||
"css-loader": "^6.7.2",
|
||||
"dateformat": "^5.0.3",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.18.2",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"mariadb": "^2.5.4",
|
||||
"query-string": "^7.0.1",
|
||||
"raw-loader": "^4.0.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-router": "^5.2.0",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-select": "^5.2.1",
|
||||
"rehype-raw": "^5.1.0",
|
||||
"sequelize": "^6.6.5",
|
||||
"socket.io-client": "^4.1.3",
|
||||
"style-loader": "^3.2.1",
|
||||
"webpack": "^5.46.0",
|
||||
"webpack-bundle-analyzer": "^4.4.2",
|
||||
"webpack-cli": "^4.7.2"
|
||||
"mariadb": "^3.0.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router": "^6.3.0",
|
||||
"react-router-dom": "^6.4.3",
|
||||
"react-select": "^5.6.1",
|
||||
"sequelize": "^6.25.8",
|
||||
"socket.io-client": "^4.5.4",
|
||||
"style-loader": "^3.3.1",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-bundle-analyzer": "^4.7.0",
|
||||
"webpack-cli": "^4.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.12",
|
||||
"webpack-dev-server": "^4.6.0"
|
||||
"nodemon": "^2.0.20",
|
||||
"webpack-dev-server": "^4.11.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,6 @@ module.exports = ({ production, development, local, analyze }) => {
|
||||
test: /\.(css)$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.(md)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'raw-loader'
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
|
||||
Reference in New Issue
Block a user