0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-21 13:42:46 +00:00

Merge branch 'master' into Stat-Block-H3-CSS-Tweak

This commit is contained in:
Trevor Buckner
2023-10-30 22:02:50 -04:00
committed by GitHub
9 changed files with 485 additions and 363 deletions

View File

@@ -5,12 +5,12 @@
version: 2.1 version: 2.1
orbs: orbs:
node: circleci/node@3.0.0 node: circleci/node@5.1.0
jobs: jobs:
build: build:
docker: docker:
- image: cimg/node:16.11.0 - image: cimg/node:20.8.0
- image: mongo:4.4 - image: mongo:4.4
working_directory: ~/homebrewery working_directory: ~/homebrewery
@@ -27,7 +27,7 @@ jobs:
# fallback to using the latest cache if no exact match is found # fallback to using the latest cache if no exact match is found
- v1-dependencies- - v1-dependencies-
- run: sudo npm install -g npm@8.10.0 - run: sudo npm install -g npm@10.2.0
- node/install-packages: - node/install-packages:
app-dir: ~/homebrewery app-dir: ~/homebrewery
cache-path: node_modules cache-path: node_modules
@@ -45,7 +45,7 @@ jobs:
test: test:
docker: docker:
- image: cimg/node:16.11.0 - image: cimg/node:20.8.0
working_directory: ~/homebrewery working_directory: ~/homebrewery
parallelism: 1 parallelism: 1

View File

@@ -80,6 +80,56 @@ pre {
## changelog ## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Friday 13/10/2023 - v3.10.0
{{taskList
##### G-Ambatte
* [x] Fix user preferred save location being ignored
Fixes issue [#2993](https://github.com/naturalcrit/homebrewery/issues/2993)
* [x] Fix crash to white screen when starting new brews while not signed in
Fixes issue [#2999](https://github.com/naturalcrit/homebrewery/issues/2999)
* [x] Fix FreeBSD install script
Fixes issue [#3005](https://github.com/naturalcrit/homebrewery/issues/3005)
* [x] Fix *"This brew has been changed on another device"* triggering when manually saving during auto-save
Fixes issue [#2641](https://github.com/naturalcrit/homebrewery/issues/2641)
* [x] Fix Firefox different column-flow behavior
Fixes issue [#2982](https://github.com/naturalcrit/homebrewery/issues/2982)
* [x] Fix brew titles being mis-sorted on user page
Fixes issue [#2775](https://github.com/naturalcrit/homebrewery/issues/2775)
* [x] Text Editor themes now available via new drop-down
Fixes issue [#362](https://github.com/naturalcrit/homebrewery/issues/362)
##### 5e-Cleric
* [x] New {{openSans **PHB → {{fas,fa-quote-right}} QUOTE** }} snippet for V3!
Fixes issue [#2920](https://github.com/naturalcrit/homebrewery/issues/2920)
* [x] Several updates and fixes to FAQ and Welcome page
Fixes issue [#2729](https://github.com/naturalcrit/homebrewery/issues/2729),
[#2787](https://github.com/naturalcrit/homebrewery/issues/2787)
##### Gazook89
* [x] Add syntax highlighting for Definition Lists <code>:\:</code>
}}
### Thursday 17/08/2023 - v3.9.2 ### Thursday 17/08/2023 - v3.9.2
{{taskList {{taskList
@@ -124,9 +174,10 @@ Fixes issue [#2920](https://github.com/naturalcrit/homebrewery/issues/2920)
##### Gazook89 ##### Gazook89
* [x] Adjustments to improve mobile viewing * [x] Adjustments to improve mobile viewing
}} }}
### Wednesday 28/06/2023 - v3.9.1 ### Wednesday 28/06/2023 - v3.9.1
{{taskList {{taskList
@@ -171,6 +222,8 @@ Fixes issue [#2790](https://github.com/naturalcrit/homebrewery/issues/2790)
Fixes issue [#2784](https://github.com/naturalcrit/homebrewery/issues/2784) Fixes issue [#2784](https://github.com/naturalcrit/homebrewery/issues/2784)
}} }}
\page
### Wednesday 12/04/2023 - v3.8.0 ### Wednesday 12/04/2023 - v3.8.0
{{taskList {{taskList
@@ -232,8 +285,6 @@ Fixes issues [#2731](https://github.com/naturalcrit/homebrewery/issues/2731)
}} }}
\page
### Monday 13/03/2023 - v3.7.2 ### Monday 13/03/2023 - v3.7.2
{{taskList {{taskList
@@ -314,7 +365,11 @@ Fixes issues [#2603](https://github.com/naturalcrit/homebrewery/issues/2603)
* [x] Add message to refresh the browser if the user is missing an update to the Homebrewery * [x] Add message to refresh the browser if the user is missing an update to the Homebrewery
Fixes issues [#2583](https://github.com/naturalcrit/homebrewery/issues/2583) Fixes issues [#2583](https://github.com/naturalcrit/homebrewery/issues/2583)
}}
\page
{{taskList
##### G-Ambatte ##### G-Ambatte
* [x] Auto-compile Themes CSS on development server * [x] Auto-compile Themes CSS on development server
@@ -324,7 +379,6 @@ Fixes issues [#2583](https://github.com/naturalcrit/homebrewery/issues/2583)
* [x] Fix cloned brews inheriting the parent view count * [x] Fix cloned brews inheriting the parent view count
}} }}
\page
### Friday 23/12/2022 - v3.5.0 ### Friday 23/12/2022 - v3.5.0
{{taskList {{taskList

View File

@@ -149,6 +149,17 @@ const Editor = createClass({
codeMirror.addLineClass(lineNumber, 'text', 'columnSplit'); codeMirror.addLineClass(lineNumber, 'text', 'columnSplit');
} }
// definition lists
if(line.includes('::')){
const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym;
let match;
while ((match = regex.exec(line)) != null){
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[0]) }, { line: lineNumber, ch: line.indexOf(match[0]) + match[0].length }, { className: 'define' });
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length }, { className: 'term' });
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[2]) }, { line: lineNumber, ch: line.indexOf(match[2]) + match[2].length }, { className: 'definition' });
}
}
// Highlight injectors {style} // Highlight injectors {style}
if(line.includes('{') && line.includes('}')){ if(line.includes('{') && line.includes('}')){
const regex = /(?:^|[^{\n])({(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\2})/gm; const regex = /(?:^|[^{\n])({(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\2})/gm;

View File

@@ -7,59 +7,67 @@
height : 100%; height : 100%;
.pageLine { .pageLine {
background : #33333328; background : #33333328;
border-top : #339 solid 1px; border-top : #333399 solid 1px;
} }
.editor-page-count { .editor-page-count {
color : grey;
float : right; float : right;
color : grey;
} }
.columnSplit { .columnSplit {
font-style : italic; font-style : italic;
color : grey; color : grey;
background-color : fade(#299, 15%); background-color : fade(#229999, 15%);
border-bottom : #299 solid 1px; border-bottom : #229999 solid 1px;
}
.define {
&:not(.term):not(.definition) {
font-weight : bold;
color : #949494;
background : #E5E5E5;
border-radius : 3px;
}
&.term { color : rgb(96, 117, 143); }
&.definition { color : rgb(97, 57, 178); }
} }
.block:not(.cm-comment) { .block:not(.cm-comment) {
color : purple;
font-weight : bold; font-weight : bold;
color : purple;
//font-style: italic; //font-style: italic;
} }
.inline-block:not(.cm-comment) { .inline-block:not(.cm-comment) {
color : red;
font-weight : bold; font-weight : bold;
color : red;
//font-style: italic; //font-style: italic;
} }
.injection:not(.cm-comment) { .injection:not(.cm-comment) {
color : green;
font-weight : bold; font-weight : bold;
color : green;
} }
} }
.brewJump { .brewJump {
position : absolute; position : absolute;
background-color : @teal; right : 20px;
cursor : pointer; bottom : 20px;
width : 30px; z-index : 1000000;
height : 30px;
display : flex; display : flex;
align-items : center; align-items : center;
bottom : 20px;
right : 20px;
z-index : 1000000;
justify-content : center; justify-content : center;
.tooltipLeft("Jump to brew page"); width : 30px;
height : 30px;
cursor : pointer;
background-color : @teal;
.tooltipLeft('Jump to brew page');
} }
.editorToolbar { .editorToolbar {
position : absolute; position : absolute;
top : 5px; top : 5px;
left : 50%; left : 50%;
color: black;
font-size: 13px;
z-index : 9; z-index : 9;
span { font-size : 13px;
padding: 2px 5px; color : black;
} span { padding : 2px 5px; }
} }
} }

View File

@@ -75,7 +75,9 @@ const errorIndex = (props)=>{
**Brew Title:** ${props.brew.brewTitle || 'Unable to show title'} **Brew Title:** ${props.brew.brewTitle || 'Unable to show title'}
**Current Authors:** ${props.brew.authors?.map((author)=>{return `${author}`;}).join(', ') || 'Unable to list authors'}`, **Current Authors:** ${props.brew.authors?.map((author)=>{return `${author}`;}).join(', ') || 'Unable to list authors'}
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
// User is not signed in; must be a user on the Authors List // User is not signed in; must be a user on the Authors List
'04' : dedent` '04' : dedent`

598
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown", "description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.9.2", "version": "3.10.0",
"engines": { "engines": {
"npm": "^10.1.x", "npm": "^10.2.x",
"node": ">=20.7.x" "node": ">=20.8.x"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -79,11 +79,11 @@
] ]
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.22.20", "@babel/core": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.22.15", "@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.22.20", "@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15", "@babel/preset-react": "^7.22.15",
"@googleapis/drive": "^8.3.1", "@googleapis/drive": "^8.4.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",
@@ -99,30 +99,30 @@
"less": "^3.13.1", "less": "^3.13.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "5.1.1", "marked": "5.1.1",
"marked-extended-tables": "^1.0.6", "marked-extended-tables": "^1.0.7",
"marked-gfm-heading-id": "^3.1.0", "marked-gfm-heading-id": "^3.1.0",
"marked-smartypants-lite": "^1.0.0", "marked-smartypants-lite": "^1.0.1",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.29.4", "moment": "^2.29.4",
"mongoose": "^7.5.2", "mongoose": "^7.6.3",
"nanoid": "3.3.4", "nanoid": "3.3.4",
"nconf": "^0.12.0", "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.16.0", "react-router-dom": "6.17.0",
"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.50.0", "eslint": "^8.52.0",
"eslint-plugin-jest": "^27.4.0", "eslint-plugin-jest": "^27.6.0",
"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",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",
"stylelint": "^15.10.3", "stylelint": "^15.11.0",
"stylelint-config-recess-order": "^4.3.0", "stylelint-config-recess-order": "^4.3.0",
"stylelint-config-recommended": "^13.0.0", "stylelint-config-recommended": "^13.0.0",
"stylelint-stylistic": "^0.4.3", "stylelint-stylistic": "^0.4.3",

View File

@@ -327,6 +327,8 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
type : 'article' type : 'article'
}; };
// increase visitor view count, do not include visits by author(s)
if(!brew.authors.includes(req.account?.username)){
if(req.params.id.length > 12 && !brew._id) { if(req.params.id.length > 12 && !brew._id) {
const googleId = brew.googleId; const googleId = brew.googleId;
const shareId = brew.shareId; const shareId = brew.shareId;
@@ -335,6 +337,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
} else { } else {
await HomebrewModel.increaseView({ shareId: brew.shareId }); await HomebrewModel.increaseView({ shareId: brew.shareId });
} }
};
sanitizeBrew(req.brew, 'share'); sanitizeBrew(req.brew, 'share');
splitTextStyleAndMetadata(req.brew); splitTextStyleAndMetadata(req.brew);
return next(); return next();

View File

@@ -79,7 +79,7 @@ const api = {
if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) { if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) {
const accessError = { name: 'Access Error', status: 401 }; const accessError = { name: 'Access Error', status: 401 };
if(req.account){ if(req.account){
throw { ...accessError, message: 'User is not an Author', HBErrorCode: '03', authors: stub.authors, brewTitle: stub.title }; throw { ...accessError, message: 'User is not an Author', HBErrorCode: '03', authors: stub.authors, brewTitle: stub.title, shareId: stub.shareId };
} }
throw { ...accessError, message: 'User is not logged in', HBErrorCode: '04', authors: stub.authors, brewTitle: stub.title }; throw { ...accessError, message: 'User is not logged in', HBErrorCode: '04', authors: stub.authors, brewTitle: stub.title };
} }