0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12: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
#
version: 2
version: 2.1
orbs:
node: circleci/node@3.0.0
jobs:
build:
docker:
- image: circleci/node:16.10.0
- image: circleci/mongo:4.4
- image: cimg/node:16.11.0
- image: mongo:4.4
working_directory: ~/repo
working_directory: ~/homebrewery
executor: node/default
steps:
- checkout
- checkout:
path: ~/homebrewery
# Download and cache dependencies
- restore_cache:
@@ -21,12 +27,48 @@ jobs:
# fallback to using the latest cache if no exact match is found
- 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:
paths:
- node_modules
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: 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 {
margin-top : 0.1cm;
}
.page .openSans {
font-family: 'Open Sans';
font-size: 0.9em;
}
```
## changelog
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
{{taskList
* [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)
* [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.
}}

View File

@@ -97,7 +97,11 @@ module.exports = [
gen : dedent`/* Removes Drop Caps */
.page h1+p:first-letter {
all: unset;
}\n\n`
}\n\n
/* Removes Small-Caps in first line */
.page h1+p:first-line {
all: unset;
}`
},
{
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.account = this.props.account;
global.enable_v3 = this.props.enable_v3;
return {};
},
render : function (){
return (
<Router location={this.props.url}>

View File

@@ -23,9 +23,17 @@ const Account = createClass({
// Reset divider position
window.localStorage.removeItem('naturalcrit-pane-split');
// 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 = '/';
};
}
},
render : function(){

View File

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

View File

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

View File

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

6
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{
"name": "homebrewery",
"version": "3.0.7",
"version": "3.0.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "3.0.7",
"version": "3.0.8",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
@@ -23150,4 +23150,4 @@
"integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA=="
}
}
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.0.7",
"version": "3.0.8",
"engines": {
"node": "16.11.x"
},
@@ -20,6 +20,9 @@
"verify": "npm run lint && npm test",
"test": "jest",
"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",
"prod": "set NODE_ENV=production && npm run build",
"postinstall": "npm run buildall",
@@ -31,6 +34,7 @@
"build/*"
],
"jest": {
"testTimeout" : 15000,
"modulePaths": [
"mode_modules",
"shared",