0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 12:22:44 +00:00

Merge branch 'master' into Extended_DD

This commit is contained in:
David Bolack
2024-01-18 22:59:22 -06:00
7 changed files with 105 additions and 62 deletions

View File

@@ -2,7 +2,7 @@
.metadataEditor{ .metadataEditor{
position : absolute; position : absolute;
z-index : 10000; z-index : 5;
box-sizing : border-box; box-sizing : border-box;
width : 100%; width : 100%;
padding : 25px; padding : 25px;

View File

@@ -72,7 +72,7 @@
position : absolute; position : absolute;
top : 25px; top : 25px;
right : 0; right : 0;
z-index : 1; z-index : 10;
display : flex; display : flex;
align-items : center; align-items : center;
justify-content : center; justify-content : center;

View File

@@ -21,10 +21,11 @@ const ErrorNavItem = createClass({
this.props.parent.setState(state); this.props.parent.setState(state);
}; };
const error = this.props.error; const error = this.props.error;
const response = error.response; const response = error.response;
const status = response.status; const status = response.status;
const message = response.body?.message; const HBErrorCode = response.body?.HBErrorCode;
const message = response.body?.message;
let errMsg = ''; let errMsg = '';
try { try {
errMsg += `${error.toString()}\n\n`; errMsg += `${error.toString()}\n\n`;
@@ -40,7 +41,9 @@ const ErrorNavItem = createClass({
{message ?? 'Conflict: please refresh to get latest changes'} {message ?? 'Conflict: please refresh to get latest changes'}
</div> </div>
</Nav.item>; </Nav.item>;
} else if(status === 412) { }
if(status === 412) {
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'> return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
Oops! Oops!
<div className='errorContainer' onClick={clearError}> <div className='errorContainer' onClick={clearError}>
@@ -48,6 +51,36 @@ const ErrorNavItem = createClass({
</div> </div>
</Nav.item>; </Nav.item>;
} }
if(HBErrorCode === '04') {
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
Oops!
<div className='errorContainer' onClick={clearError}>
You are no longer signed in as an author of
this brew! Were you signed out from a different
window? Visit our log in page, then try again!
<br></br>
<a target='_blank' rel='noopener noreferrer'
href={`https://www.naturalcrit.com/login?redirect=${window.location.href}`}>
<div className='confirm'>
Sign In
</div>
</a>
<div className='deny'>
Not Now
</div>
</div>
</Nav.item>;
}
if(response.body?.errors?.[0].reason == 'storageQuotaExceeded') {
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
Oops!
<div className='errorContainer' onClick={clearError}>
Can't save because your Google Drive seems to be full!
</div>
</Nav.item>;
}
if(response.req.url.match(/^\/api.*Google.*$/m)){ if(response.req.url.match(/^\/api.*Google.*$/m)){
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'> return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
@@ -57,6 +90,7 @@ const ErrorNavItem = createClass({
expired! Visit our log in page to sign out expired! Visit our log in page to sign out
and sign back in with Google, and sign back in with Google,
then try saving again! then try saving again!
<br></br>
<a target='_blank' rel='noopener noreferrer' <a target='_blank' rel='noopener noreferrer'
href={`https://www.naturalcrit.com/login?redirect=${window.location.href}`}> href={`https://www.naturalcrit.com/login?redirect=${window.location.href}`}>
<div className='confirm'> <div className='confirm'>

96
package-lock.json generated
View File

@@ -14,7 +14,7 @@
"@babel/plugin-transform-runtime": "^7.23.7", "@babel/plugin-transform-runtime": "^7.23.7",
"@babel/preset-env": "^7.23.8", "@babel/preset-env": "^7.23.8",
"@babel/preset-react": "^7.23.3", "@babel/preset-react": "^7.23.3",
"@googleapis/drive": "^8.5.0", "@googleapis/drive": "^8.6.0",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"codemirror": "^5.65.6", "codemirror": "^5.65.6",
@@ -35,20 +35,20 @@
"marked-smartypants-lite": "^1.0.2", "marked-smartypants-lite": "^1.0.2",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.0.4", "mongoose": "^8.1.0",
"nanoid": "3.3.4", "nanoid": "3.3.4",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-frame-component": "^4.1.3", "react-frame-component": "^4.1.3",
"react-router-dom": "6.21.2", "react-router-dom": "6.21.3",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"superagent": "^8.1.2", "superagent": "^8.1.2",
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git" "vitreum": "git+https://git@github.com/calculuschild/vitreum.git"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.56.0", "eslint": "^8.56.0",
"eslint-plugin-jest": "^27.6.2", "eslint-plugin-jest": "^27.6.3",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.33.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-expect-message": "^1.1.3", "jest-expect-message": "^1.1.3",
@@ -1966,9 +1966,9 @@
} }
}, },
"node_modules/@googleapis/drive": { "node_modules/@googleapis/drive": {
"version": "8.5.0", "version": "8.6.0",
"resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.5.0.tgz", "resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.6.0.tgz",
"integrity": "sha512-5SIODqhdxcimwR06peQcvqAf0tEpj14oEi8dcFB/KvNaev5NRf2MqMMWA3G6dgDPdLKAX/HTmwGz8OD7oGpe8Q==", "integrity": "sha512-Af3/5i6h7gbjHnwFuO9zMTpYOy2yhhfZlNciUEjb14L3ZdT1WNIDM038viIAb9ovFzkrIDqLSfUbFCgh1pywkw==",
"dependencies": { "dependencies": {
"googleapis-common": "^7.0.0" "googleapis-common": "^7.0.0"
}, },
@@ -2794,9 +2794,9 @@
} }
}, },
"node_modules/@mongodb-js/saslprep": { "node_modules/@mongodb-js/saslprep": {
"version": "1.1.1", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz",
"integrity": "sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ==", "integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==",
"dependencies": { "dependencies": {
"sparse-bitfield": "^3.0.3" "sparse-bitfield": "^3.0.3"
} }
@@ -2957,7 +2957,8 @@
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.15.5", "version": "18.15.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==" "integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
"dev": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {
"version": "2.4.1", "version": "2.4.1",
@@ -2983,11 +2984,10 @@
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
}, },
"node_modules/@types/whatwg-url": { "node_modules/@types/whatwg-url": {
"version": "8.2.2", "version": "11.0.4",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz",
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", "integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==",
"dependencies": { "dependencies": {
"@types/node": "*",
"@types/webidl-conversions": "*" "@types/webidl-conversions": "*"
} }
}, },
@@ -5642,9 +5642,9 @@
} }
}, },
"node_modules/eslint-plugin-jest": { "node_modules/eslint-plugin-jest": {
"version": "27.6.2", "version": "27.6.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.2.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz",
"integrity": "sha512-CI1AlKrsNhYFoP48VU8BVWOi7+qHTq4bRxyUlGjeU8SfFt8abjXhjOuDzUoMp68DoXIx17KpNpIkMrl4s4ZW0g==", "integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "^5.10.0" "@typescript-eslint/utils": "^5.10.0"
@@ -10444,22 +10444,22 @@
} }
}, },
"node_modules/mongodb-connection-string-url": { "node_modules/mongodb-connection-string-url": {
"version": "2.6.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz",
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", "integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==",
"dependencies": { "dependencies": {
"@types/whatwg-url": "^8.2.1", "@types/whatwg-url": "^11.0.2",
"whatwg-url": "^11.0.0" "whatwg-url": "^13.0.0"
} }
}, },
"node_modules/mongoose": { "node_modules/mongoose": {
"version": "8.0.4", "version": "8.1.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.0.4.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.1.0.tgz",
"integrity": "sha512-wN9qvdevX3+922VnLT7CpaZRT3jmVCBOK2QMHMGeScQxDRnFMPpkuI9StEPpZo/3x8t+kbzH7F8RMPsyNwyM4w==", "integrity": "sha512-kOA4Xnq2goqNpN9EmYElGNWfxA9H80fxcr7UdJKWi3UMflza0R7wpTihCpM67dE/0MNFljoa0sjQtlXVkkySAQ==",
"dependencies": { "dependencies": {
"bson": "^6.2.0", "bson": "^6.2.0",
"kareem": "2.5.1", "kareem": "2.5.1",
"mongodb": "6.2.0", "mongodb": "6.3.0",
"mpath": "0.9.0", "mpath": "0.9.0",
"mquery": "5.0.0", "mquery": "5.0.0",
"ms": "2.1.3", "ms": "2.1.3",
@@ -10531,13 +10531,13 @@
} }
}, },
"node_modules/mongoose/node_modules/mongodb": { "node_modules/mongoose/node_modules/mongodb": {
"version": "6.2.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.2.0.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz",
"integrity": "sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==", "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==",
"dependencies": { "dependencies": {
"@mongodb-js/saslprep": "^1.1.0", "@mongodb-js/saslprep": "^1.1.0",
"bson": "^6.2.0", "bson": "^6.2.0",
"mongodb-connection-string-url": "^2.6.0" "mongodb-connection-string-url": "^3.0.0"
}, },
"engines": { "engines": {
"node": ">=16.20.1" "node": ">=16.20.1"
@@ -11873,9 +11873,9 @@
"dev": true "dev": true
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "6.21.2", "version": "6.21.3",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.21.2.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.21.3.tgz",
"integrity": "sha512-jJcgiwDsnaHIeC+IN7atO0XiSRCrOsQAHHbChtJxmgqG2IaYQXSnhqGb5vk2CU/wBQA12Zt+TkbuJjIn65gzbA==", "integrity": "sha512-a0H638ZXULv1OdkmiK6s6itNhoy33ywxmUFT/xtSoVyf9VnC7n7+VT4LjVzdIHSaF5TIh9ylUgxMXksHTgGrKg==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.14.2" "@remix-run/router": "1.14.2"
}, },
@@ -11887,12 +11887,12 @@
} }
}, },
"node_modules/react-router-dom": { "node_modules/react-router-dom": {
"version": "6.21.2", "version": "6.21.3",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.21.2.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.21.3.tgz",
"integrity": "sha512-tE13UukgUOh2/sqYr6jPzZTzmzc70aGRP4pAjG2if0IP3aUT+sBtAKUJh0qMh0zylJHGLmzS+XWVaON4UklHeg==", "integrity": "sha512-kNzubk7n4YHSrErzjLK72j0B5i969GsuCGazRl3G6j1zqZBLjuSlYBdVdkDOgzGdPIffUOc9nmgiadTEVoq91g==",
"dependencies": { "dependencies": {
"@remix-run/router": "1.14.2", "@remix-run/router": "1.14.2",
"react-router": "6.21.2" "react-router": "6.21.3"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
@@ -13843,14 +13843,14 @@
} }
}, },
"node_modules/tr46": { "node_modules/tr46": {
"version": "3.0.0", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dependencies": { "dependencies": {
"punycode": "^2.1.1" "punycode": "^2.3.0"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=14"
} }
}, },
"node_modules/trim-newlines": { "node_modules/trim-newlines": {
@@ -14760,15 +14760,15 @@
} }
}, },
"node_modules/whatwg-url": { "node_modules/whatwg-url": {
"version": "11.0.0", "version": "13.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
"dependencies": { "dependencies": {
"tr46": "^3.0.0", "tr46": "^4.1.1",
"webidl-conversions": "^7.0.0" "webidl-conversions": "^7.0.0"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=16"
} }
}, },
"node_modules/which": { "node_modules/which": {

View File

@@ -84,7 +84,7 @@
"@babel/plugin-transform-runtime": "^7.23.7", "@babel/plugin-transform-runtime": "^7.23.7",
"@babel/preset-env": "^7.23.8", "@babel/preset-env": "^7.23.8",
"@babel/preset-react": "^7.23.3", "@babel/preset-react": "^7.23.3",
"@googleapis/drive": "^8.5.0", "@googleapis/drive": "^8.6.0",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"codemirror": "^5.65.6", "codemirror": "^5.65.6",
@@ -105,20 +105,20 @@
"marked-smartypants-lite": "^1.0.2", "marked-smartypants-lite": "^1.0.2",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.0.4", "mongoose": "^8.1.0",
"nanoid": "3.3.4", "nanoid": "3.3.4",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-frame-component": "^4.1.3", "react-frame-component": "^4.1.3",
"react-router-dom": "6.21.2", "react-router-dom": "6.21.3",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"superagent": "^8.1.2", "superagent": "^8.1.2",
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git" "vitreum": "git+https://git@github.com/calculuschild/vitreum.git"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.56.0", "eslint": "^8.56.0",
"eslint-plugin-jest": "^27.6.2", "eslint-plugin-jest": "^27.6.3",
"eslint-plugin-react": "^7.33.2", "eslint-plugin-react": "^7.33.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-expect-message": "^1.1.3", "jest-expect-message": "^1.1.3",

View File

@@ -472,9 +472,18 @@ const getPureError = (error)=>{
}; };
app.use(async (err, req, res, next)=>{ app.use(async (err, req, res, next)=>{
const status = err.status || err.code || 500; err.originalUrl = req.originalUrl;
console.error(err); console.error(err);
if(err.originalUrl?.startsWith('/api/')) {
// console.log('API error');
res.status(err.status || err.response?.status || 500).send(err);
return;
}
// console.log('non-API error');
const status = err.status || err.code || 500;
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : 'Error Page', title : 'Error Page',
description : 'Something went wrong!' description : 'Something went wrong!'

View File

@@ -42,8 +42,8 @@ module.exports = function(classname){
#### Equipment #### Equipment
You start with the following equipment, in addition to the equipment granted by your background: You start with the following equipment, in addition to the equipment granted by your background:
- *(a)* a martial weapon and a shield or *(b)* two martial weapons - (*a*) a martial weapon and a shield or (*b*) two martial weapons
- *(a)* five javelins or *(b)* any simple melee weapon - (*a*) five javelins or (*b*) any simple melee weapon
- ${_.sample(['10 lint fluffs', '1 button', 'a cherished lost sock'])} - ${_.sample(['10 lint fluffs', '1 button', 'a cherished lost sock'])}
`; `;
}; };