refactor: priority
This commit is contained in:
parent
fb77faa719
commit
a04aca5951
|
@ -48,15 +48,9 @@
|
||||||
browserWindowOptions:
|
browserWindowOptions:
|
||||||
backgroundColor: '#212121'
|
backgroundColor: '#212121'
|
||||||
show: false
|
show: false
|
||||||
window:
|
installExtensions: false
|
||||||
- '@humus/core'
|
|
||||||
- '...'
|
|
||||||
'@flecks/governor': {}
|
'@flecks/governor': {}
|
||||||
'@flecks/react':
|
'@flecks/react': {}
|
||||||
providers:
|
|
||||||
- '@flecks/redux'
|
|
||||||
- '@flecks/react/router'
|
|
||||||
- '...'
|
|
||||||
'@flecks/react/router': {}
|
'@flecks/react/router': {}
|
||||||
'@flecks/redis': {}
|
'@flecks/redis': {}
|
||||||
'@flecks/redis/server':
|
'@flecks/redis/server':
|
||||||
|
@ -66,41 +60,13 @@
|
||||||
'@flecks/repl': {}
|
'@flecks/repl': {}
|
||||||
'@flecks/server':
|
'@flecks/server':
|
||||||
nodeArgs:
|
nodeArgs:
|
||||||
|
- '--stack-trace-limit=30'
|
||||||
- '--inspect'
|
- '--inspect'
|
||||||
# - '--log-deopt'
|
|
||||||
# - '--log-ic'
|
|
||||||
# - '--logfile=/home/cha0s/yuge/tmp/v8.log'
|
|
||||||
up:
|
|
||||||
- '@flecks/docker'
|
|
||||||
- '@flecks/db'
|
|
||||||
- '@flecks/redis'
|
|
||||||
- '@flecks/user/session'
|
|
||||||
- '@flecks/user'
|
|
||||||
- '@flecks/user/local'
|
|
||||||
- '@flecks/governor'
|
|
||||||
- '...'
|
|
||||||
- '@humus/bootstrap'
|
|
||||||
- '@humus/universe'
|
|
||||||
- '@flecks/web'
|
|
||||||
- '@flecks/electron'
|
|
||||||
- '@flecks/repl'
|
|
||||||
'@flecks/socket': {}
|
'@flecks/socket': {}
|
||||||
'@flecks/socket/server':
|
|
||||||
'request.socket':
|
|
||||||
- '@flecks/user/session'
|
|
||||||
- '@flecks/user'
|
|
||||||
- '@flecks/governor'
|
|
||||||
- '@humus/universe'
|
|
||||||
'@flecks/user': {}
|
'@flecks/user': {}
|
||||||
'@flecks/user/local': {}
|
'@flecks/user/local': {}
|
||||||
'@flecks/user/session': {}
|
'@flecks/user/session': {}
|
||||||
'@flecks/web': {}
|
'@flecks/web': {}
|
||||||
'@flecks/web/client':
|
|
||||||
up:
|
|
||||||
- '@flecks/socket'
|
|
||||||
- '@humus/app'
|
|
||||||
- '@flecks/react'
|
|
||||||
- '...'
|
|
||||||
'@flecks/web/server':
|
'@flecks/web/server':
|
||||||
devDisableHostCheck: true
|
devDisableHostCheck: true
|
||||||
dll:
|
dll:
|
||||||
|
@ -129,17 +95,9 @@
|
||||||
- 'react-window'
|
- 'react-window'
|
||||||
port: 32350
|
port: 32350
|
||||||
public: 'humus.localhost'
|
public: 'humus.localhost'
|
||||||
'request.route':
|
|
||||||
- '@flecks/user/session'
|
|
||||||
- '@flecks/user'
|
|
||||||
- '@humus/core/electron'
|
|
||||||
- '...'
|
|
||||||
'request.socket':
|
'request.socket':
|
||||||
- '@humus/universe/server'
|
- '@humus/universe/server'
|
||||||
- '...'
|
- '...'
|
||||||
'stream.html':
|
|
||||||
- '@flecks/react'
|
|
||||||
- '...'
|
|
||||||
'@humus/app':
|
'@humus/app':
|
||||||
resolution: [1600, 900]
|
resolution: [1600, 900]
|
||||||
'@humus/bootstrap': {}
|
'@humus/bootstrap': {}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {Flecks} from '@flecks/core';
|
||||||
|
|
||||||
import Receiver from './receiver';
|
import Receiver from './receiver';
|
||||||
|
|
||||||
export const hooks = {
|
export const hooks = {
|
||||||
|
@ -19,11 +21,14 @@ export const hooks = {
|
||||||
|
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'@flecks/web/client.up': (flecks) => {
|
'@flecks/web/client.up': Flecks.priority(
|
||||||
window.flecks = flecks;
|
(flecks) => {
|
||||||
const Synchronizer = Receiver(flecks);
|
window.flecks = flecks;
|
||||||
const synchronizer = new Synchronizer();
|
const Synchronizer = Receiver(flecks);
|
||||||
flecks.humus.app.synchronizer = synchronizer;
|
const synchronizer = new Synchronizer();
|
||||||
synchronizer.listenTo(flecks.socket.client);
|
flecks.humus.app.synchronizer = synchronizer;
|
||||||
},
|
synchronizer.listenTo(flecks.socket.client);
|
||||||
|
},
|
||||||
|
{after: '@flecks/socket/client'},
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
|
import {Flecks} from '@flecks/core';
|
||||||
|
|
||||||
export const hooks = {
|
export const hooks = {
|
||||||
'@flecks/server.up': async (flecks) => {
|
'@flecks/server.up': Flecks.priority(
|
||||||
// if ('production' === NODE_ENV) {
|
async (flecks) => {
|
||||||
// return;
|
const {User} = flecks.db.Models;
|
||||||
// }
|
if (!await User.findOne({where: {email: 'humus@cha0s.io'}})) {
|
||||||
const {User} = flecks.db.Models;
|
const user = await User.create({
|
||||||
if (!await User.findOne({where: {email: 'humus@cha0s.io'}})) {
|
email: 'humus@cha0s.io',
|
||||||
const user = await User.create({
|
isAdmin: true,
|
||||||
email: 'humus@cha0s.io',
|
});
|
||||||
isAdmin: true,
|
await user.addHashedPassword('foobar');
|
||||||
});
|
await user.save();
|
||||||
await user.addHashedPassword('foobar');
|
}
|
||||||
await user.save();
|
},
|
||||||
}
|
{after: '@flecks/user/local/server'},
|
||||||
},
|
),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Flecks} from '@flecks/core';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -5,22 +6,28 @@ const {
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
export const hooks = {
|
export const hooks = {
|
||||||
'@flecks/electron/server.window': async (win) => {
|
'@flecks/electron/server.window': Flecks.priority(
|
||||||
// win.removeMenu();
|
async (win) => {
|
||||||
if ('production' !== NODE_ENV) {
|
// win.removeMenu();
|
||||||
win.openDevTools();
|
if ('production' !== NODE_ENV) {
|
||||||
}
|
win.openDevTools();
|
||||||
win.maximize();
|
}
|
||||||
win.once('ready-to-show', () => {
|
win.maximize();
|
||||||
win.show();
|
win.once('ready-to-show', () => {
|
||||||
});
|
win.show();
|
||||||
},
|
});
|
||||||
'@flecks/web/server.request.route': (flecks) => async (req, res, next) => {
|
},
|
||||||
if (isElectron() && 0 === req.user.id) {
|
{after: '@flecks/electron/server'},
|
||||||
const {User} = flecks.db.Models;
|
),
|
||||||
req.logIn(await User.findByPk(1), next);
|
'@flecks/web/server.request.route': Flecks.priority(
|
||||||
return;
|
(flecks) => async (req, res, next) => {
|
||||||
}
|
if (isElectron() && 0 === req.user.id) {
|
||||||
next();
|
const {User} = flecks.db.Models;
|
||||||
},
|
req.logIn(await User.findByPk(1), next);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
},
|
||||||
|
{after: '@flecks/user/server'},
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,12 +64,15 @@ export const hooks = {
|
||||||
'@flecks/socket.packets.decorate': (
|
'@flecks/socket.packets.decorate': (
|
||||||
Flecks.decorate(require.context('./packets/decorators', false, /\.js$/))
|
Flecks.decorate(require.context('./packets/decorators', false, /\.js$/))
|
||||||
),
|
),
|
||||||
'@flecks/socket/server.request.socket': (flecks) => async ({handshake}, next) => {
|
'@flecks/socket/server.request.socket': Flecks.priority(
|
||||||
const {universe} = flecks.humus.universe;
|
(flecks) => async ({handshake}, next) => {
|
||||||
const {user} = handshake;
|
const {universe} = flecks.humus.universe;
|
||||||
if (0 !== user.id) {
|
const {user} = handshake;
|
||||||
handshake.entity = await universe.loadOrCreateEntity(user);
|
if (0 !== user.id) {
|
||||||
}
|
handshake.entity = await universe.loadOrCreateEntity(user);
|
||||||
next();
|
}
|
||||||
},
|
next();
|
||||||
|
},
|
||||||
|
{after: '@flecks/governor/server'},
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user