0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-17 18:52:40 +00:00

Merge branch 'master' into google-document-stubs

# Conflicts:
#	server/homebrew.api.js
This commit is contained in:
Charlie Humphreys
2022-03-30 23:26:41 -05:00
10 changed files with 152 additions and 61 deletions

View File

@@ -2,17 +2,23 @@
# #
# Check https://circleci.com/docs/2.0/language-javascript/ for more details # Check https://circleci.com/docs/2.0/language-javascript/ for more details
# #
version: 2 version: 2.1
orbs:
node: circleci/node@3.0.0
jobs: jobs:
build: build:
docker: docker:
- image: circleci/node:16.10.0 - image: cimg/node:16.11.0
- image: circleci/mongo:4.4 - image: mongo:4.4
working_directory: ~/repo working_directory: ~/homebrewery
executor: node/default
steps: steps:
- checkout - checkout:
path: ~/homebrewery
# Download and cache dependencies # Download and cache dependencies
- restore_cache: - restore_cache:
@@ -21,12 +27,48 @@ 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: npm install - node/install-npm
- node/install-packages:
app-dir: ~/homebrewery
cache-path: node_modules
override-ci-command: npm i
- save_cache: - save_cache:
paths: paths:
- node_modules - node_modules
key: v1-dependencies-{{ checksum "package.json" }} key: v1-dependencies-{{ checksum "package.json" }}
- persist_to_workspace:
root: .
paths:
- .
test:
docker:
- image: cimg/node:16.11.0
working_directory: ~/homebrewery
parallelism: 4
steps:
- attach_workspace:
at: .
# run tests! # run tests!
- run: npm run circleci - run:
name: Test - Basic
command: npm run test:basic
- run:
name: Test - Mustache Spans
command: npm run test:mustache-span
- run:
name: Test - Routes
command: npm run test:route
workflows:
build_and_test:
jobs:
- build
- test:
requires:
- build

View File

@@ -29,11 +29,43 @@ pre {
.page p + pre { .page p + pre {
margin-top : 0.1cm; margin-top : 0.1cm;
} }
.page .openSans {
font-family: 'Open Sans';
font-size: 0.9em;
}
``` ```
## 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).
### Wednesday 27/03/2022 - v3.0.8
{{taskList
* [x] Style updates to user page.
* [x] Added a logout button (finally)! You can find it under {{openSans **USERNAME {{fa,fa-user}} → LOGOUT {{fas,fa-power-off}}**}}
Fixes issues: [#303](https://github.com/naturalcrit/homebrewery/issues/303)
* [x] Clarified the default text when submitting an issue via Reddit post.
* [x] Fixed broken Table of Contents links in PDFs. (Thanks lucastucious!)
Fixes issues: [#1749](https://github.com/naturalcrit/homebrewery/issues/1749)
* [x] Fixed window resizing causing the edit page divider to get lost off of the edge of the page.
Fixes issues: [#2053](https://github.com/naturalcrit/homebrewery/issues/2053)
* [x] Fixed Class Table decorations overlapping main text.
Fixes issues: [#1985](https://github.com/naturalcrit/homebrewery/issues/1985)
* [x] Updated {{openSans **STYLE EDITOR {{fa,fa-pencil-alt}} → REMOVE DROP CAP {{fas,fa-remove-format}}**}} snippet to also remove small-caps first line font.
* [x] Background work in preparation for brew themes.
}}
### Wednesday 02/02/2022 - v3.0.7 ### Wednesday 02/02/2022 - v3.0.7
{{taskList {{taskList
* [x] Revert active line highlighting. * [x] Revert active line highlighting.
@@ -50,7 +82,7 @@ For a full record of development, visit our [Github Page](https://github.com/nat
Fixes issues: [#1943](https://github.com/naturalcrit/homebrewery/issues/1943) Fixes issues: [#1943](https://github.com/naturalcrit/homebrewery/issues/1943)
* [x] Added a Legacy to V3 migration guide under **NEED HELP? {{fa,fa-question-circle}} → MIGRATE {{fas,fa-file-import}}** * [x] Added a Legacy to V3 migration guide under {{openSans **NEED HELP? {{fa,fa-question-circle}} → MIGRATE {{fas,fa-file-import}}**}}
* [x] Background refactoring and unit tests. * [x] Background refactoring and unit tests.
}} }}

View File

@@ -97,7 +97,11 @@ module.exports = [
gen : dedent`/* Removes Drop Caps */ gen : dedent`/* Removes Drop Caps */
.page h1+p:first-letter { .page h1+p:first-letter {
all: unset; all: unset;
}\n\n` }\n\n
/* Removes Small-Caps in first line */
.page h1+p:first-line {
all: unset;
}`
}, },
{ {
name : 'Tweak Drop Cap', name : 'Tweak Drop Cap',

View File

@@ -32,11 +32,14 @@ const Homebrew = createClass({
} }
}; };
}, },
componentWillMount : function() {
global.account = this.props.account; getInitialState : function(){
global.version = this.props.version; global.version = this.props.version;
global.account = this.props.account;
global.enable_v3 = this.props.enable_v3; global.enable_v3 = this.props.enable_v3;
return {};
}, },
render : function (){ render : function (){
return ( return (
<Router location={this.props.url}> <Router location={this.props.url}>

View File

@@ -23,9 +23,17 @@ const Account = createClass({
// Reset divider position // Reset divider position
window.localStorage.removeItem('naturalcrit-pane-split'); window.localStorage.removeItem('naturalcrit-pane-split');
// Clear login cookie // Clear login cookie
document.cookie = `nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;samesite=lax;${window.domain ? `domain=${window.domain}` : ''}`; let domain = '';
if(window.location?.hostname) {
let domainArray = window.location.hostname.split('.');
if(domainArray.length > 2){
domainArray = [''].concat(domainArray.slice(-2));
}
domain = domainArray.join('.');
}
document.cookie = `nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;samesite=lax;${domain ? `domain=${domain}` : ''}`;
window.location = '/'; window.location = '/';
}; }
}, },
render : function(){ render : function(){

View File

@@ -14,12 +14,10 @@ const Navbar = createClass({
}; };
}, },
componentDidMount : function() { getInitialState : function() {
//const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); return {
this.setState({ ver : global.version
//showNonChromeWarning : !isChrome, };
ver : window.version
});
}, },
/* /*

View File

@@ -276,26 +276,26 @@ const EditPage = createClass({
console.log(errMsg); console.log(errMsg);
} catch (e){} } catch (e){}
if(this.state.errors.status == '401'){ // if(this.state.errors.status == '401'){
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={this.clearErrors}> // <div className='errorContainer' onClick={this.clearErrors}>
You must be signed in to a Google account // You must be signed in to a Google account
to save this to<br />Google Drive!<br /> // to save this to<br />Google Drive!<br />
<a target='_blank' rel='noopener noreferrer' // <a target='_blank' rel='noopener noreferrer'
href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`}> // href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`}>
<div className='confirm'> // <div className='confirm'>
Sign In // Sign In
</div> // </div>
</a> // </a>
<div className='deny'> // <div className='deny'>
Not Now // Not Now
</div> // </div>
</div> // </div>
</Nav.item>; // </Nav.item>;
} // }
if(this.state.errors.response.req.url.match(/^\/api\/.*Google.*$/m)){ if(this.state.errors.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'>
Oops! Oops!
<div className='errorContainer' onClick={this.clearErrors}> <div className='errorContainer' onClick={this.clearErrors}>

View File

@@ -187,26 +187,26 @@ const NewPage = createClass({
console.log(errMsg); console.log(errMsg);
} catch (e){} } catch (e){}
if(this.state.errors.status == '401'){ // if(this.state.errors.status == '401'){
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={this.clearErrors}> // <div className='errorContainer' onClick={this.clearErrors}>
You must be signed in to a Google account // You must be signed in to a Google account
to save this to<br />Google Drive!<br /> // to save this to<br />Google Drive!<br />
<a target='_blank' rel='noopener noreferrer' // <a target='_blank' rel='noopener noreferrer'
href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`}> // href={`https://www.naturalcrit.com/login?redirect=${this.state.url}`}>
<div className='confirm'> // <div className='confirm'>
Sign In // Sign In
</div> // </div>
</a> // </a>
<div className='deny'> // <div className='deny'>
Not Now // Not Now
</div> // </div>
</div> // </div>
</Nav.item>; // </Nav.item>;
} // }
if(this.state.errors.response.req.url.match(/^\/api\/.*Google.*$/m)){ if(this.state.errors.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'>
Oops! Oops!
<div className='errorContainer' onClick={this.clearErrors}> <div className='errorContainer' onClick={this.clearErrors}>

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"version": "3.0.7", "version": "3.0.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "3.0.7", "version": "3.0.8",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@@ -1,7 +1,7 @@
{ {
"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.0.7", "version": "3.0.8",
"engines": { "engines": {
"node": "16.11.x" "node": "16.11.x"
}, },
@@ -20,6 +20,9 @@
"verify": "npm run lint && npm test", "verify": "npm run lint && npm test",
"test": "jest", "test": "jest",
"test:dev": "jest --verbose --watch", "test:dev": "jest --verbose --watch",
"test:basic": "jest tests/markdown/basic.test.js --verbose",
"test:mustache-span": "jest tests/markdown/mustache-span.test.js --verbose",
"test:route": "jest tests/routes/static-pages.test.js --verbose",
"phb": "node scripts/phb.js", "phb": "node scripts/phb.js",
"prod": "set NODE_ENV=production && npm run build", "prod": "set NODE_ENV=production && npm run build",
"postinstall": "npm run buildall", "postinstall": "npm run buildall",
@@ -31,6 +34,7 @@
"build/*" "build/*"
], ],
"jest": { "jest": {
"testTimeout" : 15000,
"modulePaths": [ "modulePaths": [
"mode_modules", "mode_modules",
"shared", "shared",