Skip to content

Commit d1d92bd

Browse files
authored
Merge pull request #94 from neonexus/master
v4.2.0
2 parents 8b29941 + 734aefb commit d1d92bd

File tree

150 files changed

+8492
-1553
lines changed

Some content is hidden

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

150 files changed

+8492
-1553
lines changed

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ config/local.js
77
.editorconfig
88
.eslintignore
99
.eslintrc
10-
.mocharc.yaml
10+
.mocharc.yml
1111
.nycrc
1212
.tmp
1313
.travis.yml
1414
test
1515

16-
README.md
16+
**/README*
1717
CHANGELOG.md
1818
LICENSE

.idea/dictionaries/neonexusdemortis.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Start_Ngrok.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ loglevel=error
99

1010
# Make "npm audit" an opt-in thing for subsequent installs within this app:
1111
audit=true
12+
13+
# Don't install optional dependencies automatically (which is a weird default NPM...):
14+
omit=optional

CHANGELOG.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
# Changelog
22

3+
## [v4.2.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v4.1.1...v4.2.0) (2023-04-20)
4+
### Features
5+
6+
* Built a script for [`Ngrok`](https://www.npmjs.com/package/ngrok), which will build assets, start Sails, and create an Ngrok tunnel (to the configured PORT).
7+
* Built 2FA (2-Factor Authentication) capabilities.
8+
* Added `appName` as a config option.
9+
* Added `createdBy` to the [`User`](api/models/User.js) model.
10+
* Added [`sails-hook-autoreload`](https://www.npmjs.com/package/sails-hook-autoreload) support (must manually install).
11+
* Built session expiration handling.
12+
* Built password changing modal / API.
13+
* Made session data saving automatic, and work with both sessions / API tokens.
14+
* Fixed some README quirks.
15+
* Removed unneeded React imports (because of the Babel transform). For more info, [read this announcement (from 2020...)](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
16+
* Updated React links to use their new domain.
17+
* Removed `serve-static` in favor of `express.static`.
18+
* Updated dependencies.
19+
20+
### Breaking Changes
21+
22+
* Moved CSRF secret storage from the `data` column, to its own column, so it can easily be encrypted/decrypted in the [`Session`](api/models/Session.js) model.
23+
* Changed how API tokens are handled. So now, when using an API token, the ID must be given first, then the token, seperated by a colon.<br />Example: `Authorization` header is: `tokenID:apiToken` (or `Bearer tokenID:apiToken`). This is because `token` is now an encrypted column.
24+
* Renamed `sails.helpers.updateCsrf` -> `sails.helpers.updateCsrfAndExpiry` to reflect the session expiry update.
25+
* Renamed `req.requestId`/`env.req.requestId` -> `req.id`/`env.req.id` to better match general convention.
26+
* Renamed `process.env` -> `appConfig` in the Webpack config (a variable used to pass data down to the frontend). What was I doing?!...
27+
328
## [v4.1.1](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v4.1.0...v4.1.1) (2023-03-14)
429
### Features
530

6-
* Fixed a stupid mistake in `api/controllers/get-users.js`.
31+
* Fixed a stupid mistake in [`api/controllers/admin/get-users.js`](api/controllers/admin/get-users.js).
732
* Updated dependencies.
833

934
## [v4.1.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v4.0.1...v4.1.0) (2023-03-13)
35+
1036
### Features
1137

1238
* Alphabetized the scripts in `package.json`.
@@ -48,7 +74,7 @@
4874

4975
### Breaking Changes
5076

51-
* Renamed tests entry point (`hooks.js` -> `startTests.js`).
77+
* Renamed tests entry point (`test/hooks.js` -> `test/startTests.js`).
5278

5379
## [v3.2.1](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.2.0...v3.2.1) (2022-11-16)
5480

@@ -119,7 +145,7 @@
119145

120146
### Breaking Changes
121147

122-
* Updated to React v18. See: [the upgrade guide to React 18](https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html).
148+
* Updated to React v18. See: [the upgrade guide to React 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide).
123149
* Updated to React Router DOM v6. See: [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5). This requires a **MAJOR** overhaul of how routes are handled.
124150
* Moved some controllers into a "common" folder, instead of the "admin" folder (as they could be used outside of admin controls).
125151

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18.15
1+
FROM node:18.16
22
MAINTAINER NeoNexus DeMortis
33

44
RUN mkdir /var/www && mkdir /var/www/myapp

README.md

Lines changed: 117 additions & 29 deletions
Large diffs are not rendered by default.

api/controllers/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Controllers
2+
3+
Here is where all of our API actions live. A controller in this context is a folder, and an action of the controller is an individual file. Each action is using the new "actions2" style, as opposed to the classic.
4+
5+
See: https://sailsjs.com/documentation/concepts/actions-and-controllers
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
friendlyName: 'Create API Token',
33

4-
description: 'Get an API token, which replaces CSRF token / session cookie usage.',
4+
description: 'Create an API token, which replaces CSRF token / session cookie usage.',
55

66
inputs: {},
77

@@ -14,12 +14,16 @@ module.exports = {
1414
fn: async (inputs, exits, env) => {
1515
const newToken = await sails.models.apitoken.create({
1616
id: 'c', // required, auto-generated
17-
user: env.req.session.user.id
18-
}).fetch();
17+
user: env.req.session.user.id,
18+
token: sails.helpers.generateToken(),
19+
data: {} // Used to store things that are temporary, or only apply to this session.
20+
}).fetch().decrypt();
21+
22+
const outToken = newToken.id + ':' + newToken.token;
1923

2024
return exits.created({
21-
token: newToken.token,
22-
__skipCSRF: true // this tells our "created" response to ignore the CSRF token update
25+
token: outToken,
26+
header: 'Bearer ' + outToken
2327
});
2428
}
2529
};

0 commit comments

Comments
 (0)