Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a48780f50 | |||
| 33952a9896 | |||
| 8076b0cc40 | |||
| e216474196 | |||
| 2532bf1867 | |||
| 93a3c30e81 | |||
| ae8c82e83a | |||
| bc6a795750 | |||
| 9947ef13c1 | |||
| d3f0b1ac7d |
@@ -1,6 +1,6 @@
|
|||||||
WEB_PORT=3000
|
WEB_PORT=3000
|
||||||
|
|
||||||
DB_HOSTNAME=database
|
DB_HOSTNAME=localhost
|
||||||
DB_DATABASE=template
|
DB_DATABASE=template
|
||||||
DB_USERNAME=template
|
DB_USERNAME=template
|
||||||
DB_PASSWORD=pikachu
|
DB_PASSWORD=pikachu
|
||||||
@@ -12,4 +12,4 @@ DB_TIMEZONE=Australia/Sydney
|
|||||||
DB_LOGGING=
|
DB_LOGGING=
|
||||||
|
|
||||||
# Make sure this value matches the system that you connect to
|
# Make sure this value matches the system that you connect to
|
||||||
SECRET_ACCESS=access
|
SECRET_ACCESS=access
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const ChatReports = props => {
|
|||||||
<td>{report.chatlog.room}</td>
|
<td>{report.chatlog.room}</td>
|
||||||
<td>{report.chatlog.text}</td>
|
<td>{report.chatlog.text}</td>
|
||||||
<td>{report.reporter.join(', ')}</td>
|
<td>{report.reporter.join(', ')}</td>
|
||||||
<td><button onClick={() => deleteReportsFor(report.chatlogId, authTokens.tokenFetch, setReports)}>Delete</button></td>
|
<td><button onClick={() => deleteReportsFor(report.chatlogIndex, authTokens.tokenFetch, setReports)}>Delete</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -51,17 +51,17 @@ const ChatReports = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteReportsFor = (chatlogId, tokenFetch, setReports) => {
|
const deleteReportsFor = (chatlogIndex, tokenFetch, setReports) => {
|
||||||
tokenFetch(`${process.env.CHAT_URI}/admin/reports`, {
|
tokenFetch(`${process.env.CHAT_URI}/admin/reports`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Access-Control-Allow-Origin': '*'
|
'Access-Control-Allow-Origin': '*'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ chatlogId })
|
body: JSON.stringify({ chatlogIndex })
|
||||||
});
|
});
|
||||||
|
|
||||||
setReports(reports => reports.filter(report => report.chatlogId != chatlogId));
|
setReports(reports => reports.filter(report => report.chatlogIndex != chatlogIndex));
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChatReports;
|
export default ChatReports;
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import ReactMarkdown from 'react-markdown/with-html';
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import rehypeRaw from 'rehype-raw';
|
||||||
|
|
||||||
const Markdown = props => {
|
const Markdown = props => {
|
||||||
//content?
|
//content?
|
||||||
@@ -27,7 +28,7 @@ const Markdown = props => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactMarkdown escapeHtml={false} props={{...props}}>{contentHook}</ReactMarkdown>
|
<ReactMarkdown rehypePlugins={[rehypeRaw]} escapeHtml={false} props={{...props}}>{contentHook}</ReactMarkdown>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ const processLine = (line, index, accessToken) => {
|
|||||||
content = <strong>{content}</strong>;
|
content = <strong>{content}</strong>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <li key={index} className='line'>{content}<div className='report'><a onClick={() => processReport(line, accessToken)} style={{ display: line.id && !line.notification ? 'flex' : 'none' }}>!!!</a></div></li>;
|
return <li key={index} className='line'>{content}<div className='report'><a onClick={() => processReport(line, accessToken)} style={{ display: line.index && !line.notification ? 'flex' : 'none' }}>!!!</a></div></li>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const processReport = (line, accessToken) => {
|
const processReport = (line, accessToken) => {
|
||||||
@@ -105,7 +105,7 @@ const processReport = (line, accessToken) => {
|
|||||||
if (yes) {
|
if (yes) {
|
||||||
socket.emit('report', {
|
socket.emit('report', {
|
||||||
accessToken,
|
accessToken,
|
||||||
id: line.id
|
index: line.index
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -123,7 +123,7 @@ services:
|
|||||||
- traefik.http.routers.${projectName}router.service=${projectName}service@docker
|
- traefik.http.routers.${projectName}router.service=${projectName}service@docker
|
||||||
- traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort}
|
- traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort}
|
||||||
environment:
|
environment:
|
||||||
- WEB_PORT=3000
|
- WEB_PORT=${projectPort}
|
||||||
- DB_HOSTNAME=database
|
- DB_HOSTNAME=database
|
||||||
- DB_DATABASE=${projectName}
|
- DB_DATABASE=${projectName}
|
||||||
- DB_USERNAME=${projectDBUser}
|
- DB_USERNAME=${projectDBUser}
|
||||||
|
|||||||
Generated
+3542
-2982
File diff suppressed because it is too large
Load Diff
+33
-32
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mern-template",
|
"name": "mern-template",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"description": "A website template using the MERN stack.",
|
"description": "A website template using the MERN stack.",
|
||||||
"main": "server/server.js",
|
"main": "server/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"build:server": "exit 0",
|
"build:server": "exit 0",
|
||||||
"build:client": "webpack --env=production --config webpack.config.js",
|
"build:client": "webpack --env=production --config webpack.config.js",
|
||||||
"dev": "concurrently npm:watch:server npm:watch:client",
|
"dev": "concurrently npm:watch:server npm:watch:client",
|
||||||
"watch:server": "nodemon . --ext js,jsx,json --ignore 'node_modules/*'",
|
"watch:server": "nodemon ./* --ext js,jsx,json --ignore 'node_modules/*'",
|
||||||
"watch:client": "webpack serve --env=development --config webpack.config.js",
|
"watch:client": "webpack serve --env=development --config webpack.config.js",
|
||||||
"analyzer": "webpack --env=production --analyzer --config webpack.config.js"
|
"analyzer": "webpack --env=production --analyzer --config webpack.config.js"
|
||||||
},
|
},
|
||||||
@@ -24,37 +24,38 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/KRGameStudios/MERN-template#readme",
|
"homepage": "https://github.com/KRGameStudios/MERN-template#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.12.10",
|
"@babel/core": ">=7.12.10",
|
||||||
"@babel/preset-env": "^7.12.11",
|
"@babel/preset-env": ">=7.12.11",
|
||||||
"@babel/preset-react": "^7.12.10",
|
"@babel/preset-react": ">=7.12.10",
|
||||||
"@loadable/component": "^5.14.1",
|
"@loadable/component": ">=5.14.1",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": ">=8.2.2",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": ">=3.0.0",
|
||||||
"concurrently": "^5.3.0",
|
"concurrently": ">=5.3.0",
|
||||||
"css-loader": "^5.1.3",
|
"css-loader": ">=5.1.3",
|
||||||
"dateformat": "^4.5.1",
|
"dateformat": ">=4.5.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": ">=8.2.0",
|
||||||
"express": "^4.17.1",
|
"express": ">=4.17.1",
|
||||||
"html-webpack-plugin": "^5.0.0-alpha.14",
|
"html-webpack-plugin": ">=5.0.0-alpha.14",
|
||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": ">=3.1.2",
|
||||||
"mariadb": "^2.5.2",
|
"mariadb": ">=2.5.2",
|
||||||
"raw-loader": "^4.0.2",
|
"raw-loader": ">=4.0.2",
|
||||||
"react": "^17.0.1",
|
"react": ">=17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": ">=17.0.1",
|
||||||
"react-dropdown-select": "^4.7.4",
|
"react-dropdown-select": ">=4.7.4",
|
||||||
"react-markdown": "^5.0.3",
|
"react-markdown": ">=5.0.3",
|
||||||
"react-router": "^5.2.0",
|
"react-router": ">=5.2.0",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": ">=5.2.0",
|
||||||
"sequelize": "^6.4.0",
|
"rehype-raw": "^5.1.0",
|
||||||
"socket.io-client": "^4.0.0",
|
"sequelize": ">=6.4.0",
|
||||||
"style-loader": "^2.0.0",
|
"socket.io-client": ">=4.0.0",
|
||||||
"universal-cookie": "^4.0.4",
|
"style-loader": ">=2.0.0",
|
||||||
"webpack": "^5.15.0",
|
"universal-cookie": ">=4.0.4",
|
||||||
"webpack-cli": "^4.3.1"
|
"webpack": ">=5.15.0",
|
||||||
|
"webpack-cli": ">=4.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": ">=2.0.7",
|
||||||
"webpack-bundle-analyzer": "^4.3.0",
|
"webpack-bundle-analyzer": ">=4.3.0",
|
||||||
"webpack-dev-server": "^3.11.2"
|
"webpack-dev-server": ">=1.16.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+116
-116
@@ -1,116 +1,116 @@
|
|||||||
//plugins
|
//plugins
|
||||||
const { DefinePlugin } = require('webpack');
|
const { DefinePlugin } = require('webpack');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||||
|
|
||||||
//libraries
|
//libraries
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
//the exported config function
|
//the exported config function
|
||||||
module.exports = ({ production, analyzer }) => {
|
module.exports = ({ production, analyzer }) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mode: production ? "production" : "development",
|
mode: production ? "production" : "development",
|
||||||
entry: path.resolve(__dirname, 'client', 'client.jsx'),
|
entry: path.resolve(__dirname, 'client', 'client.jsx'),
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'public'),
|
path: path.resolve(__dirname, 'public'),
|
||||||
filename: '[name].[chunkhash].js',
|
filename: '[name].[chunkhash].js',
|
||||||
sourceMapFilename: '[name].[chunkhash].js.map'
|
sourceMapFilename: '[name].[chunkhash].js.map'
|
||||||
},
|
},
|
||||||
devtool: 'eval-source-map',
|
devtool: production ? 'source-map' : 'eval-source-map',
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.jsx']
|
extensions: ['.js', '.jsx']
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.(js|jsx)$/,
|
test: /\.(js|jsx)$/,
|
||||||
exclude: /(node_modules)/,
|
exclude: /(node_modules)/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
presets: ['@babel/preset-env', '@babel/preset-react'],
|
presets: ['@babel/preset-env', '@babel/preset-react'],
|
||||||
plugins: ['@babel/plugin-syntax-dynamic-import']
|
plugins: ['@babel/plugin-syntax-dynamic-import']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(css)$/,
|
test: /\.(css)$/,
|
||||||
use: ['style-loader', 'css-loader']
|
use: ['style-loader', 'css-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(md)$/,
|
test: /\.(md)$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'raw-loader'
|
loader: 'raw-loader'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new DefinePlugin({
|
new DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'PRODUCTION': production,
|
'PRODUCTION': production,
|
||||||
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.eggtrainer.com"',
|
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.krgamestudios.com"',
|
||||||
'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.eggtrainer.com"',
|
'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.krgamestudios.com"',
|
||||||
'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.eggtrainer.com"',
|
'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.krgamestudios.com"',
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
cleanOnceBeforeBuildPatterns: ['*', '!content*']
|
cleanOnceBeforeBuildPatterns: ['*', '!content*']
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: './client/template.html',
|
template: './client/template.html',
|
||||||
minify: {
|
minify: {
|
||||||
collapseWhitespace: production,
|
collapseWhitespace: production,
|
||||||
removeComments: production,
|
removeComments: production,
|
||||||
removeAttributeQuotes: production
|
removeAttributeQuotes: production
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new BundleAnalyzerPlugin({
|
new BundleAnalyzerPlugin({
|
||||||
analyzerMode: analyzer ? 'server' : 'disabled'
|
analyzerMode: analyzer ? 'server' : 'disabled'
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: path.resolve(__dirname, 'public'),
|
contentBase: path.resolve(__dirname, 'public'),
|
||||||
compress: true,
|
compress: true,
|
||||||
port: 3001,
|
port: 3001,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api/': 'http://localhost:3000/'
|
'/api/': 'http://localhost:3000/'
|
||||||
},
|
},
|
||||||
overlay: {
|
overlay: {
|
||||||
errors: true
|
errors: true
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
colors: true,
|
colors: true,
|
||||||
hash: false,
|
hash: false,
|
||||||
version: false,
|
version: false,
|
||||||
timings: false,
|
timings: false,
|
||||||
assets: false,
|
assets: false,
|
||||||
chunks: false,
|
chunks: false,
|
||||||
modules: false,
|
modules: false,
|
||||||
reasons: false,
|
reasons: false,
|
||||||
children: false,
|
children: false,
|
||||||
source: false,
|
source: false,
|
||||||
errors: true,
|
errors: true,
|
||||||
errorDetails: false,
|
errorDetails: false,
|
||||||
warnings: true,
|
warnings: true,
|
||||||
publicPath: false
|
publicPath: false
|
||||||
},
|
},
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
clientLogLevel: 'silent',
|
clientLogLevel: 'silent',
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
hot: true,
|
hot: true,
|
||||||
injectHot: true
|
injectHot: true
|
||||||
},
|
},
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
ignored: /(node_modules)/
|
ignored: /(node_modules)/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user