mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 17:52:47 +00:00
Merge branch 'master' into brew_themes_user_selection
This commit is contained in:
@@ -14,7 +14,14 @@ const NotificationPopup = require('./notificationPopup/notificationPopup.jsx');
|
|||||||
const Frame = require('react-frame-component').default;
|
const Frame = require('react-frame-component').default;
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const staticThemes = require('themes/themes.json');
|
const staticThemes = require('themes/themes.json');
|
||||||
|
=======
|
||||||
|
const DOMPurify = require('dompurify');
|
||||||
|
const purifyConfig = { FORCE_BODY: true, SANITIZE_DOM: false };
|
||||||
|
|
||||||
|
const Themes = require('themes/themes.json');
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
const PAGE_HEIGHT = 1056;
|
const PAGE_HEIGHT = 1056;
|
||||||
|
|
||||||
@@ -33,8 +40,9 @@ const BrewPage = (props)=>{
|
|||||||
index : 0,
|
index : 0,
|
||||||
...props
|
...props
|
||||||
};
|
};
|
||||||
|
const cleanText = DOMPurify.sanitize(props.contents, purifyConfig);
|
||||||
return <div className={props.className} id={`p${props.index + 1}`} >
|
return <div className={props.className} id={`p${props.index + 1}`} >
|
||||||
<div className='columnWrapper' dangerouslySetInnerHTML={{ __html: props.contents }} />
|
<div className='columnWrapper' dangerouslySetInnerHTML={{ __html: cleanText }} />
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,13 +110,6 @@ const BrewRenderer = (props)=>{
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sanitizeScriptTags = (content)=>{
|
|
||||||
return content
|
|
||||||
?.replace(/<script/ig, '<script')
|
|
||||||
.replace(/<\/script>/ig, '</script>')
|
|
||||||
|| '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderPageInfo = ()=>{
|
const renderPageInfo = ()=>{
|
||||||
return <div className='pageInfo' ref={mainRef}>
|
return <div className='pageInfo' ref={mainRef}>
|
||||||
<div>
|
<div>
|
||||||
@@ -128,19 +129,18 @@ const BrewRenderer = (props)=>{
|
|||||||
|
|
||||||
const renderStyle = ()=>{
|
const renderStyle = ()=>{
|
||||||
if(!props.style) return;
|
if(!props.style) return;
|
||||||
const cleanStyle = sanitizeScriptTags(props.style);
|
const cleanStyle = DOMPurify.sanitize(props.style, purifyConfig);
|
||||||
//return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style>@layer styleTab {\n${sanitizeScriptTags(props.style)}\n} </style>` }} />;
|
//return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style>@layer styleTab {\n${sanitizeScriptTags(props.style)}\n} </style>` }} />;
|
||||||
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${cleanStyle} </style>` }} />;
|
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${cleanStyle} </style>` }} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderPage = (pageText, index)=>{
|
const renderPage = (pageText, index)=>{
|
||||||
let cleanPageText = sanitizeScriptTags(pageText);
|
|
||||||
if(props.renderer == 'legacy') {
|
if(props.renderer == 'legacy') {
|
||||||
const html = MarkdownLegacy.render(cleanPageText);
|
const html = MarkdownLegacy.render(pageText);
|
||||||
return <BrewPage className='page phb' index={index} key={index} contents={html} />;
|
return <BrewPage className='page phb' index={index} key={index} contents={html} />;
|
||||||
} else {
|
} else {
|
||||||
cleanPageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
||||||
const html = Markdown.render(cleanPageText, index);
|
const html = Markdown.render(pageText, index);
|
||||||
return <BrewPage className='page' index={index} key={index} contents={html} />;
|
return <BrewPage className='page' index={index} key={index} contents={html} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -234,11 +234,11 @@ const BrewRenderer = (props)=>{
|
|||||||
<RenderWarnings />
|
<RenderWarnings />
|
||||||
<NotificationPopup />
|
<NotificationPopup />
|
||||||
</div>
|
</div>
|
||||||
<link href={`/css/${blankRendererPath}/Blank`} rel='stylesheet'/>
|
<link href={`/css/${blankRendererPath}/Blank`} type='text/css' rel='stylesheet'/>
|
||||||
{baseThemePath &&
|
{baseThemePath &&
|
||||||
<link href={staticOrUserParent} rel='stylesheet'/>
|
<link href={staticOrUserParent} type='text/css' rel='stylesheet'/>
|
||||||
}
|
}
|
||||||
<link href={`/css/${rendererPath}${themePath}`} rel='stylesheet'/>
|
<link href={`/css/${rendererPath}${themePath}`} type='text/css' rel='stylesheet'/>
|
||||||
|
|
||||||
{/* Apply CSS from Style tab and render pages from Markdown tab */}
|
{/* Apply CSS from Style tab and render pages from Markdown tab */}
|
||||||
{state.isMounted
|
{state.isMounted
|
||||||
|
|||||||
2289
package-lock.json
generated
2289
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -93,6 +93,7 @@
|
|||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
"create-react-class": "^15.7.0",
|
"create-react-class": "^15.7.0",
|
||||||
"dedent-tabs": "^0.10.3",
|
"dedent-tabs": "^0.10.3",
|
||||||
|
"dompurify": "^3.1.1",
|
||||||
"expr-eval": "^2.0.2",
|
"expr-eval": "^2.0.2",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"express-async-handler": "^1.2.0",
|
"express-async-handler": "^1.2.0",
|
||||||
@@ -109,7 +110,7 @@
|
|||||||
"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.3.3",
|
"mongoose": "^8.4.0",
|
||||||
"nanoid": "3.3.4",
|
"nanoid": "3.3.4",
|
||||||
"nconf": "^0.12.1",
|
"nconf": "^0.12.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ module.exports = {
|
|||||||
**Condition Immunities** :: ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}
|
**Condition Immunities** :: ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}
|
||||||
**Senses** :: darkvision 60 ft., passive Perception ${_.random(3, 20)}
|
**Senses** :: darkvision 60 ft., passive Perception ${_.random(3, 20)}
|
||||||
**Languages** :: ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}
|
**Languages** :: ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}
|
||||||
**Challenge** :: ${_.random(0, 15)} (${_.random(10, 10000)} XP)
|
**Challenge** :: ${_.random(0, 15)} (${_.random(10, 10000)} XP) {{bonus **Proficiency Bonus** +${_.random(2, 6)}}}
|
||||||
___
|
___
|
||||||
${_.times(_.random(genLines, genLines + 2), function(){return genAbilities();}).join('\n:\n')}
|
${_.times(_.random(genLines, genLines + 2), function(){return genAbilities();}).join('\n:\n')}
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -354,6 +354,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bonus {
|
||||||
|
float: right;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
// Monster Ability table
|
// Monster Ability table
|
||||||
hr + table:first-of-type {
|
hr + table:first-of-type {
|
||||||
margin : 0;
|
margin : 0;
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ const elderberryInn = {
|
|||||||
'ei_action1' : 'ei action-1',
|
'ei_action1' : 'ei action-1',
|
||||||
'ei_alter_self' : 'ei alter-self',
|
'ei_alter_self' : 'ei alter-self',
|
||||||
'ei_alter_self2' : 'ei alter-self-2',
|
'ei_alter_self2' : 'ei alter-self-2',
|
||||||
|
'ei_magic_beans' : 'ei magic-beans',
|
||||||
'ei_animal_friendship' : 'ei animal-friendship',
|
'ei_animal_friendship' : 'ei animal-friendship',
|
||||||
'ei_animate_dead' : 'ei animate-dead',
|
'ei_animate_dead' : 'ei animate-dead',
|
||||||
'ei_animate_objects' : 'ei animate-objects',
|
'ei_animate_objects' : 'ei animate-objects',
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
&.frightened::before { content : '\E922'; }
|
&.frightened::before { content : '\E922'; }
|
||||||
&.grappled::before { content : '\E923'; }
|
&.grappled::before { content : '\E923'; }
|
||||||
&.incapacitated::before { content : '\E924'; }
|
&.incapacitated::before { content : '\E924'; }
|
||||||
|
&.unconscious::before { content : '\E925'; }
|
||||||
&.invisible::before { content : '\E926'; }
|
&.invisible::before { content : '\E926'; }
|
||||||
&.paralyzed::before { content : '\E927'; }
|
&.paralyzed::before { content : '\E927'; }
|
||||||
&.petrified::before { content : '\E928'; }
|
&.petrified::before { content : '\E928'; }
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
&.prone::before { content : '\E92A'; }
|
&.prone::before { content : '\E92A'; }
|
||||||
&.restrained::before { content : '\E92B'; }
|
&.restrained::before { content : '\E92B'; }
|
||||||
&.stunned::before { content : '\E92C'; }
|
&.stunned::before { content : '\E92C'; }
|
||||||
&.unconscious::before { content : '\E925'; }
|
|
||||||
|
|
||||||
/* Character Classes and Features */
|
/* Character Classes and Features */
|
||||||
&.barbarian-rage::before { content : '\E92D'; }
|
&.barbarian-rage::before { content : '\E92D'; }
|
||||||
@@ -82,7 +83,7 @@
|
|||||||
&.monk-step-of-the-wind-2::before { content : '\E937'; }
|
&.monk-step-of-the-wind-2::before { content : '\E937'; }
|
||||||
&.monk-step-of-the-wind-3::before { content : '\E938'; }
|
&.monk-step-of-the-wind-3::before { content : '\E938'; }
|
||||||
&.monk-stunning-strike::before { content : '\E939'; }
|
&.monk-stunning-strike::before { content : '\E939'; }
|
||||||
&.monk-stunning-strike-2::before { content : '\E939'; }
|
&.monk-stunning-strike-2::before { content : '\E93A'; }
|
||||||
&.paladin-divine-smite::before { content : '\E93B'; }
|
&.paladin-divine-smite::before { content : '\E93B'; }
|
||||||
&.paladin-lay-on-hands::before { content : '\E93C'; }
|
&.paladin-lay-on-hands::before { content : '\E93C'; }
|
||||||
&.barbarian-abilities::before { content : '\E93D'; }
|
&.barbarian-abilities::before { content : '\E93D'; }
|
||||||
@@ -121,6 +122,7 @@
|
|||||||
&.action-1::before { content : '\E95A'; }
|
&.action-1::before { content : '\E95A'; }
|
||||||
&.alter-self::before { content : '\E95B'; }
|
&.alter-self::before { content : '\E95B'; }
|
||||||
&.alter-self-2::before { content : '\E95C'; }
|
&.alter-self-2::before { content : '\E95C'; }
|
||||||
|
&.magic-beans::before { content : '\E95D'; }
|
||||||
&.animal-friendship::before { content : '\E95E'; }
|
&.animal-friendship::before { content : '\E95E'; }
|
||||||
&.animate-dead::before { content : '\E95F'; }
|
&.animate-dead::before { content : '\E95F'; }
|
||||||
&.animate-objects::before { content : '\E960'; }
|
&.animate-objects::before { content : '\E960'; }
|
||||||
|
|||||||
Reference in New Issue
Block a user