Skip to content

Commit 869b274

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 6cbe49c + 82c7bda commit 869b274

56 files changed

Lines changed: 665 additions & 409 deletions

Some content is hidden

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

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"plugins": [
88
"transform-runtime",
99
"add-module-exports",
10-
"transform-decorators-legacy",
11-
"flow-runtime"
10+
"transform-decorators-legacy"
1211
],
1312
"env": {
1413
"development": {

.bootstraprc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
"loglevel": "disabled",
66
"env": {
77
"development": {
8-
"styleLoaders": ["style-loader", "css-loader", "resolve-url-loader", "sass-loader"],
8+
"styleLoaders": [
9+
"style-loader?sourceMap",
10+
"css-loader?sourceMap&importLoaders=2",
11+
"resolve-url-loader",
12+
"sass-loader?sourceMap"
13+
],
914
"extractStyles": false
1015
},
1116
"production": {
12-
"styleLoaders": ["style-loader", "css-loader", "sass-loader"],
17+
"styleLoaders": [
18+
"style-loader",
19+
"css-loader?importLoaders=1",
20+
"sass-loader?sourceMap"
21+
],
1322
"extractStyles": true
1423
}
1524
},

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
node_modules/
44
yarn.lock
55
static/dist/
6-
static/service-worker.js
76
*.iml
87
webpack-assets.json
98
webpack-stats.json

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
node_modules/
33
yarn.lock
44
static/dist/
5-
static/service-worker.js
65
*.iml
76
webpack-assets.json
87
webpack-stats.json

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ dist: trusty
33
language: node_js
44

55
node_js:
6-
- "4.0"
76
- "4"
87
- "5"
8+
- "6"
99
- "stable"
1010

1111
addons:

api/api.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import rest from 'feathers-rest';
88
import socketio from 'feathers-socketio';
99
import isPromise from 'is-promise';
1010
import PrettyError from 'pretty-error';
11-
import publicConfig from '../src/config';
1211
import config from './config';
1312
import middleware from './middleware';
1413
import services from './services';
@@ -35,16 +34,15 @@ app.set('config', config)
3534

3635
const actionsHandler = (req, res, next) => {
3736
const splittedUrlPath = req.url.split('?')[0].split('/').slice(1);
38-
3937
const { action, params } = mapUrl(actions, splittedUrlPath);
4038

39+
req.app = app;
40+
4141
const catchError = error => {
4242
console.error('API ERROR:', pretty.render(error));
4343
res.status(error.status || 500).json(error);
4444
};
4545

46-
req.app = app;
47-
4846
if (action) {
4947
try {
5048
const handle = action(req, params);
@@ -79,13 +77,13 @@ app.configure(hooks())
7977
.configure(services)
8078
.configure(middleware);
8179

82-
if (publicConfig.apiPort) {
83-
app.listen(publicConfig.apiPort, err => {
80+
if (process.env.APIPORT) {
81+
app.listen(process.env.APIPORT, err => {
8482
if (err) {
8583
console.error(err);
8684
}
87-
console.info('----\n==> 🌎 API is running on port %s', publicConfig.apiPort);
88-
console.info('==> 💻 Send requests to http://%s:%s', publicConfig.apiHost, publicConfig.apiPort);
85+
console.info('----\n==> 🌎 API is running on port %s', process.env.APIPORT);
86+
console.info('==> 💻 Send requests to http://localhost:%s', process.env.APIPORT);
8987
});
9088
} else {
9189
console.error('==> ERROR: No APIPORT environment variable has been specified');

api/hooks/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export restrictToOwner from './restrictToOwner';
21
export validateHook from './validateHook';

api/hooks/restrictToOwner.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

api/services/authentication/index.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,18 @@ import local from 'feathers-authentication-local';
44
// import oauth1 from 'feathers-authentication-oauth1';
55
import oauth2 from 'feathers-authentication-oauth2';
66
import FacebookTokenStrategy from 'passport-facebook-token';
7-
import hooks from 'feathers-hooks-common';
8-
import { verifyJWT } from 'feathers-authentication/lib/utils';
7+
import { discard } from 'feathers-hooks-common';
98

109
export socketAuth from './socketAuth';
1110

1211
function populateUser(authConfig) {
13-
return hook => verifyJWT(hook.result.accessToken, authConfig)
12+
return hook => hook.app.passport.verifyJWT(hook.result.accessToken, authConfig)
1413
.then(payload => hook.app.service('users').get(payload.userId))
1514
.then(user => {
1615
hook.result.user = user;
1716
});
1817
}
1918

20-
function addTokenExpiration() {
21-
return hook => {
22-
if (hook.result.accessToken) {
23-
hook.result.expires = hook.app.get('auth').cookie.maxAge || null;
24-
}
25-
return hook;
26-
};
27-
}
28-
2919
function restToSocketAuth() {
3020
return hook => {
3121
if (hook.params.provider !== 'rest') return hook;
@@ -70,8 +60,7 @@ export default function authenticationService() {
7060
after: {
7161
create: [
7262
populateUser(config),
73-
hooks.remove('user.password'),
74-
addTokenExpiration(),
63+
discard('user.password'),
7564
restToSocketAuth()
7665
]
7766
}

api/services/authentication/socketAuth.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { verifyJWT } from 'feathers-authentication/lib/utils';
2-
31
export default function socketAuth(app) {
42
return (socket, next) => {
53
const { cookie } = socket.request.headers;
@@ -18,7 +16,7 @@ export default function socketAuth(app) {
1816

1917
if (!accessToken) return next();
2018

21-
verifyJWT(accessToken, app.get('auth'))
19+
app.passport.verifyJWT(accessToken, app.get('auth'))
2220
.then(payload => app.service('users').get(payload.userId))
2321
.then(user => {
2422
Object.assign(socket.feathers, {

0 commit comments

Comments
 (0)