0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 08:02:42 +00:00

Merge branch 'master' into migration-guide

# Conflicts:
#	package-lock.json
This commit is contained in:
Charlie Humphreys
2022-01-26 08:43:17 -06:00
12 changed files with 420 additions and 524 deletions

View File

@@ -34,6 +34,36 @@ pre {
## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Saturday 18/12/2021 - v3.0.6
{{taskList
* [x] Fixed text wrapping for long strings in code blocks.
Fixes issues: [#1736](https://github.com/naturalcrit/homebrewery/issues/1736)
* [x] Code search/replace `CTRL F / CTRL SHIFT F`
Fixes issues: [#1201](https://github.com/naturalcrit/homebrewery/issues/1201)
* [x] Auto-closing HTML tags and curly braces `{{ }}`
* [x] Highlight current active line
Fixes issues: [#1202](https://github.com/naturalcrit/homebrewery/issues/1202)
* [x] Display tabs and trailing spaces
Fixes issues: [#1622](https://github.com/naturalcrit/homebrewery/issues/1622)
* [x] Make columns even in V3 Table of Contents.
Fixes issues: [#1671](https://github.com/naturalcrit/homebrewery/issues/1671)
* [x] Fix `CTRL P` failing to print from `/new` pages.
Fixes issues: [#1815](https://github.com/naturalcrit/homebrewery/issues/1815)
}}
\page
### Tuesday 07/12/2021 - v3.0.5
{{taskList
* [x] Fixed paragraph spacing for **note** and **descriptive** boxes in V3.
@@ -98,6 +128,12 @@ For a full record of development, visit our [Github Page](https://github.com/nat
* [x] Added {{fa,fa-undo}} **Undo** and {{fa,fa-redo}} **Redo** buttons to the snippet bar.
}}
\column
{{taskList
* [x] Switching between the {{fa,fa-beer}} **Brew** and {{fa,fa-paint-brush}} **Style** tabs no longer loses your scroll position or undo history.
Fixes issues: [#1735](https://github.com/naturalcrit/homebrewery/issues/1735)

View File

@@ -208,6 +208,7 @@ const Editor = createClass({
view={this.state.view}
value={this.props.brew.style ?? DEFAULT_STYLE_TEXT}
onChange={this.props.onStyleChange}
enableFolding={false}
rerenderParent={this.rerenderParent} />
</>;
}

View File

@@ -10,7 +10,7 @@ These instructions assume that you are installing to a completely new, fresh Fre
2. Install wget (`pkg install -y wget`). On a fresh jail, you will be prompted to press 'Y' to set up `pkg`.
3. Download the installation script (`wget --no-check-certificate https://raw.githubusercontent.com/naturalcrit/homebrewery/master/freebsd/install.sh`). The parameter `--no-check-certificate` is required as we haven't set up any trusted certificates/authorities yet.
3. Download the installation script (`wget --no-check-certificate https://raw.githubusercontent.com/naturalcrit/homebrewery/master/install/freebsd/install.sh`). The parameter `--no-check-certificate` is required as we haven't set up any trusted certificates/authorities yet.
4. Make the downloaded file executable (`chmod +x install.sh`).

35
install/README.UBUNTU.md Normal file
View File

@@ -0,0 +1,35 @@
# Ubuntu Installation Instructions
## Before Installing
These instructions assume that you are installing to a completely new, fresh Ubuntu installation. As such, some steps will not be necessary if you are installing to an existing Ubuntu instance.
## Installation instructions
1. Install Ubuntu.
2. Install wget (`apt install -y wget`). This may already be installed, depending on your exact Ubuntu version.
3. Download the installation script (`wget https://raw.githubusercontent.com/naturalcrit/homebrewery/master/install/ubuntu/install.sh`).
4. Make the downloaded file executable (`chmod +x install.sh`).
5. Run the script (`sudo ./install.sh`). This will automatically download all of the required packages, install both them and HomeBrewery, configure the system and finally start HomeBrewery.
**NOTE:** At this time, the script **ONLY** installs HomeBrewery. It does **NOT** install the NaturalCrit login system, as that is currently a completely separate project.
---
### Testing
These installation instructions have been tested on the following Ubuntu releases:
- *ubuntu-20.04.3-desktop-amd64*
## Final Notes
While this installation process works successfully at the time of writing (December 19, 2021), it relies on all of the Node.JS packages used in the HomeBrewery project retaining their cross-platform capabilities to continue to function. This is one of the inherent advantages of Node.JS, but it is by no means guaranteed and as such, functionality or even installation may fail without warning at some point in the future.
Regards,
G
December 19, 2021

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Homebrewery Web Server
[Service]
User=root
After=mongodb
Environment=NODE_ENV=local
WorkingDirectory=/usr/local/homebrewery
ExecStart=node server.js
Restart=always
[Install]
WantedBy=multi-user.target

34
install/ubuntu/install.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/sh
# Install CURL and add required NodeJS source to package repo
echo ::Install CURL
apt install -y curl
echo ::Add NodeJS source to package repo
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
# Install required packages
echo ::Install Homebrewery requirements
apt satisfy -y git nodejs npm mongodb
# Clone Homebrewery repo
echo ::Get Homebrewery files
cd /usr/local/
git clone https://github.com/naturalcrit/homebrewery.git
# Install Homebrewery
echo ::Install Homebrewery
cd homebrewery
npm install
npm audit fix
npm run postinstall
# Create Homebrewery service
echo ::Create Homebrewery service
ln -s /usr/local/homebrewery/install/ubuntu/etc/systemd/system/homebrewery.service /etc/systemd/system/homebrewery.service
systemctl daemon-reload
echo ::Set Homebrewery to start automatically
systemctl enable homebrewery
# Start Homebrewery
echo ::Start Homebrewery
systemctl start homebrewery

700
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.0.5",
"version": "3.0.6",
"engines": {
"node": "16.11.x"
},
@@ -46,11 +46,11 @@
"@babel/preset-react": "^7.16.5",
"body-parser": "^1.19.1",
"classnames": "^2.3.1",
"codemirror": "^5.64.0",
"codemirror": "^5.65.0",
"cookie-parser": "^1.4.6",
"create-react-class": "^15.7.0",
"dedent-tabs": "^0.10.1",
"express": "^4.17.1",
"express": "^4.17.2",
"express-async-handler": "^1.2.0",
"express-static-gzip": "2.1.1",
"fs-extra": "10.0.0",
@@ -59,14 +59,14 @@
"jwt-simple": "^0.5.6",
"less": "^3.13.1",
"lodash": "^4.17.21",
"marked": "4.0.7",
"marked": "4.0.8",
"marked-extended-tables": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.29.1",
"mongoose": "^6.1.2",
"mongoose": "^6.1.3",
"nanoid": "3.1.30",
"nconf": "^0.11.3",
"prop-types": "15.7.2",
"prop-types": "15.8.0",
"query-string": "7.0.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
@@ -77,8 +77,8 @@
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git"
},
"devDependencies": {
"eslint": "^8.4.1",
"eslint-plugin-react": "^7.27.1",
"pico-check": "^2.1.3"
"eslint": "^8.5.0",
"eslint-plugin-react": "^7.28.0",
"pico-check": "^2.2.0"
}
}

View File

@@ -27,9 +27,9 @@ if(typeof navigator !== 'undefined'){
require('codemirror/addon/search/matchesonscrollbar.js');
require('codemirror/addon/dialog/dialog.js');
//Trailing space highlighting
require('codemirror/addon/edit/trailingspace.js');
// require('codemirror/addon/edit/trailingspace.js');
//Active line highlighting
require('codemirror/addon/selection/active-line.js');
// require('codemirror/addon/selection/active-line.js');
//Auto-closing
//XML code folding is a requirement of the auto-closing tag feature and is not enabled
require('codemirror/addon/fold/xml-fold.js');
@@ -42,10 +42,11 @@ if(typeof navigator !== 'undefined'){
const CodeEditor = createClass({
getDefaultProps : function() {
return {
language : '',
value : '',
wrap : true,
onChange : ()=>{}
language : '',
value : '',
wrap : true,
onChange : ()=>{},
enableFolding : true
};
},
@@ -81,6 +82,12 @@ const CodeEditor = createClass({
} else if(this.codeMirror?.getValue() != this.props.value) { //update editor contents if brew.text is changed from outside
this.codeMirror.setValue(this.props.value);
}
if(this.props.enableFolding) {
this.codeMirror.setOption('foldOptions', this.foldOptions(this.codeMirror));
} else {
this.codeMirror.setOption('foldOptions', false);
}
},
buildEditor : function() {
@@ -139,39 +146,19 @@ const CodeEditor = createClass({
'Ctrl-]' : this.unfoldAllCode,
'Cmd-]' : this.unfoldAllCode
},
foldGutter : true,
foldOptions : {
scanUp : true,
rangeFinder : CodeMirror.fold.homebrewery,
widget : (from, to)=>{
let text = '';
let currentLine = from.line;
const maxLength = 50;
while (currentLine <= to.line && text.length <= maxLength) {
text += this.codeMirror.getLine(currentLine);
if(currentLine < to.line)
text += ' ';
currentLine += 1;
}
text = text.trim();
if(text.length > maxLength)
text = `${text.substr(0, maxLength)}...`;
return `\u21A4 ${text} \u21A6`;
}
},
gutters : ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
autoCloseTags : true,
styleActiveLine : true,
showTrailingSpace : true,
specialChars : / /,
specialCharPlaceholder : function(char) {
const el = document.createElement('span');
el.className = 'cm-space';
el.innerHTML = ' ';
return el;
}
foldGutter : true,
foldOptions : this.foldOptions(this.codeMirror),
gutters : ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
autoCloseTags : true,
styleActiveLine : true,
showTrailingSpace : false,
// specialChars : / /,
// specialCharPlaceholder : function(char) {
// const el = document.createElement('span');
// el.className = 'cm-space';
// el.innerHTML = ' ';
// return el;
// }
});
closeTag.autoCloseCurlyBraces(CodeMirror, this.codeMirror);
@@ -355,6 +342,30 @@ const CodeEditor = createClass({
historySize : function(){
return this.codeMirror.doc.historySize();
},
foldOptions : function(cm){
return {
scanUp : true,
rangeFinder : CodeMirror.fold.homebrewery,
widget : (from, to)=>{
let text = '';
let currentLine = from.line;
const maxLength = 50;
while (currentLine <= to.line && text.length <= maxLength) {
text += this.codeMirror.getLine(currentLine);
if(currentLine < to.line)
text += ' ';
currentLine += 1;
}
text = text.trim();
if(text.length > maxLength)
text = `${text.substr(0, maxLength)}...`;
return `\u21A4 ${text} \u21A6`;
}
};
},
//----------------------//
render : function(){

View File

@@ -10,13 +10,13 @@
font-weight: 600;
}
.cm-tab {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAQAAACOs/baAAAARUlEQVR4nGJgIAG8JkXxUAcCtDWemcGR1lY4MvgzCEKY7jSBjgxBDAG09UEQzAe0AMwMHrSOAwEGRtpaMIwAAAAA//8DAG4ID9EKs6YqAAAAAElFTkSuQmCC) no-repeat right;
}
//.cm-tab {
// background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAQAAACOs/baAAAARUlEQVR4nGJgIAG8JkXxUAcCtDWemcGR1lY4MvgzCEKY7jSBjgxBDAG09UEQzAe0AMwMHrSOAwEGRtpaMIwAAAAA//8DAG4ID9EKs6YqAAAAAElFTkSuQmCC) no-repeat right;
//}
.cm-trailingspace {
.cm-space {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAQAgMAAABW5NbuAAAACVBMVEVHcEwAAAAAAAAWawmTAAAAA3RSTlMAPBJ6PMxpAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAFUlEQVQI12NgwACcCQysASAEZGAAACMuAX06aCQUAAAAAElFTkSuQmCC) no-repeat right;
}
}
//.cm-trailingspace {
// .cm-space {
// background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAQAgMAAABW5NbuAAAACVBMVEVHcEwAAAAAAAAWawmTAAAAA3RSTlMAPBJ6PMxpAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAFUlEQVQI12NgwACcCQysASAEZGAAACMuAX06aCQUAAAAAElFTkSuQmCC) no-repeat right;
// }
//}
}