Skip to content

Commit 930ea07

Browse files
authored
Merge pull request #61 from neonexus/master
Fixed Webpack dev server's reloading issue (pages wouldn't render on reload). Updated dependencies. Updated all "substr" usages to "substring".
2 parents 0636858 + fccf723 commit 930ea07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+9222
-10077
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [v3.0.3](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.0.2...v3.0.3) (2022-08-18)
4+
5+
### Features
6+
7+
* Fixed an issue with `webpack-dev-server`'s reload issue with complex routes (/admin/dashboard would fail to render properly on reload).
8+
* Updated usage of `substr` -> `substring` throughout the project.
9+
* Updated dependencies (except Bootstrap v5.1.3 -> v5.2.0, because it fails to compile with SASS).
10+
311
## [v3.0.2](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.0.1...v3.0.2) (2022-04-23)
412

513
### Features

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.14
1+
FROM node:16.17
22
MAINTAINER NeoNexus DeMortis
33

44
RUN apt-get update && apt-get upgrade -y
@@ -8,7 +8,7 @@ WORKDIR /var/www/myapp
88

99
EXPOSE 1337
1010
# REMEMBER! NEVER STORE SECRETS, DEK's, PASSWORDS, OR ANYTHING OF A SENSITIVE NATURE IN SOURCE CONTROL (INCLUDING THIS FILE)! USE ENVIRONMENT VARIABLES!
11-
ENV PORT=1337 DB_HOSTNAME=localhost DB_USERNAME=root DB_PASSWORD=mypass DB_NAME=myapp DB_PORT=3306 DB_SSL=true DATA_ENCRYPTION_KEY=1234abcd4321asdf0987lkjh SESSION_SECRET=0987poiuqwer1234zxcvmnbv
11+
ENV PORT=1337 DB_HOSTNAME=dockerdb DB_USERNAME=dockeruser DB_PASSWORD=dockerpass DB_NAME=docker DB_PORT=3306 DB_SSL=true DATA_ENCRYPTION_KEY=1234abcd4321asdf0987lkjh SESSION_SECRET=0987poiuqwer1234zxcvmnbv
1212

1313
# This keeps builds more efficient, because we can use Docker cache more effectively.
1414
COPY package.json /var/www/myapp/package.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Sails, by default, has middleware (akin to [Express.js Middleware](https://expre
5656
| npm run debug | Alias for `node --inspect app.js`. |
5757
| npm run build | Will run `npm run clean`, then will build production-ready files with Webpack in the `.tmp/public` folder. |
5858
| npm run build:dev | Same thing as `npm run build`, except that it will not optimize the files, retaining newlines and empty spaces. |
59-
| npm run clean | Will basically delete everything in the `.tmp` folder. |
59+
| npm run clean | Will delete everything in the `.tmp` folder. |
6060
| npm run lines | Will count the lines of code in the project, minus `.gitignore`'d files, for funzies. There are currently about 7k custom lines in this repo (views, controllers, helpers, hooks, etc). |
6161
| npm run test | Run [Mocha](https://mochajs.org/) tests. Everything starts in the [`test/hooks.js`](test/hooks.js) file. |
6262
| npm run coverage | Runs [NYC](https://www.npmjs.com/package/nyc) coverage reporting of the Mocha tests, which generates HTML in `test/coverage`. |

api/helpers/finalize-request-log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
success: {}
3131
},
3232

33-
fn: async function(inputs, exits){
33+
fn: async function(inputs, exits) {
3434
if (inputs.req.requestId) {
3535
let out = _.merge({}, inputs.body),
3636
headers = _.merge({}, inputs.res._headers), // copy the object

api/helpers/generate-token.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ module.exports = {
2020

2121
fn: function(inputs, exits) {
2222
return exits.success(
23-
crypto.createHmac('sha256', sails.config.session.secret)
24-
.update(
23+
crypto.createHmac('sha256', sails.config.session.secret).update(
2524
crypto.randomBytes(21) // cryptographically-secure random characters
2625
+ moment(new Date()).format() // throw in the current time stamp
2726
+ 'I am a tea pot' // the best HTTP status code
2827
+ inputs.extra // an optional way to add a bit more randomness to the mix
2928
+ crypto.randomBytes(21)
30-
)
31-
.digest('hex')
29+
).digest('hex')
3230
);
3331
}
3432
};

api/helpers/get-error-messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212

1313
exits: {},
1414

15-
fn: async function(inputs, exits){
15+
fn: async function(inputs, exits) {
1616
let errors = [],
1717
err = inputs.err;
1818

api/helpers/is-password-valid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
friendlyName: 'Is password valid',
33

4-
description: 'Does the provided password conform to the given standards?',
4+
description: 'Does the provided password conform to the given standards? Returns true, or an array of errors.',
55

66
inputs: {
77
password: {
@@ -25,7 +25,7 @@ module.exports = {
2525
}
2626

2727
if (inputs.password.length > 70) {
28-
// this 70 character limit is not arbitrary, it is the max size of MySQL utf8mb4 encoding
28+
// this 70-character limit is not arbitrary, it is the max size of MySQL utf8mb4 encoding
2929
// (71 characters balloons past the 191 character limit of utf8mb4 varchar columns after hashing)
3030
errors.push('WOW. Password length is TOO good. Max is 70 characters. Sorry.');
3131
}

api/helpers/simplify-errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212

1313
exits: {},
1414

15-
fn: async function(inputs, exits){
15+
fn: async function(inputs, exits) {
1616
let errors = {},
1717
err = inputs.err;
1818

api/models/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function hashPassword(pass) {
1010
async function updatePassword(password) {
1111
// "binary to ASCII" aka base64
1212
// btoa('scrypt') = c2NyeXB0
13-
if (password && password.length > 1 && password.substr(0, 8) !== 'c2NyeXB0') {
13+
if (password && password.length > 1 && password.substring(0, 8) !== 'c2NyeXB0') {
1414
password = await hashPassword(password);
1515
}
1616

api/policies/isAdmin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This policy requires the isLoggedIn policy run beforehand, as it is where the custom session handling lives.
22

3-
module.exports = function(req, res, next){
3+
module.exports = function(req, res, next) {
44
if (req.session && req.session.user && req.session.user.role && req.session.user.role === 'admin') {
55
return next();
66
}

0 commit comments

Comments
 (0)