feat: electron goodies
This commit is contained in:
parent
0afee09cf8
commit
f192d52345
|
@ -1,8 +0,0 @@
|
|||
require('dotenv/config');
|
||||
|
||||
module.exports = {
|
||||
options: {
|
||||
root: __dirname,
|
||||
},
|
||||
use: [],
|
||||
};
|
|
@ -109,6 +109,11 @@
|
|||
'@flecks/redux': {}
|
||||
'@flecks/repl': {}
|
||||
'@flecks/server':
|
||||
nodeArgs:
|
||||
- '--inspect'
|
||||
# - '--log-deopt'
|
||||
# - '--log-ic'
|
||||
# - '--logfile=/home/cha0s/yuge/tmp/v8.log'
|
||||
up:
|
||||
- '@flecks/docker'
|
||||
- '@flecks/db'
|
||||
|
@ -136,6 +141,7 @@
|
|||
resolution: [1600, 900]
|
||||
'@humus/combat': {}
|
||||
'@humus/core': {}
|
||||
'@humus/core/electron': {}
|
||||
'@humus/farm': {}
|
||||
'@humus/inventory': {}
|
||||
'@humus/universe':
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
},
|
||||
"files": [
|
||||
"build",
|
||||
"electron/server.js",
|
||||
"electron/server.js.map",
|
||||
"index.js",
|
||||
"index.js.map",
|
||||
"server.js",
|
||||
|
@ -44,7 +46,8 @@
|
|||
"@flecks/redux": "^1.4.1",
|
||||
"@flecks/socket": "^1.4.1",
|
||||
"@flecks/user": "^1.4.1",
|
||||
"debug": "4.3.1"
|
||||
"debug": "4.3.1",
|
||||
"is-electron": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@flecks/fleck": "^1.4.1"
|
||||
|
|
29
packages/core/src/electron/server.js
Normal file
29
packages/core/src/electron/server.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import {Hooks} from '@flecks/core';
|
||||
import isElectron from 'is-electron';
|
||||
|
||||
const {
|
||||
NODE_ENV,
|
||||
} = process.env;
|
||||
|
||||
export default {
|
||||
[Hooks]: {
|
||||
'@flecks/electron/server.window': async (win) => {
|
||||
win.removeMenu();
|
||||
if ('production' !== NODE_ENV) {
|
||||
win.openDevTools();
|
||||
}
|
||||
win.maximize();
|
||||
win.once('ready-to-show', () => {
|
||||
win.show();
|
||||
});
|
||||
},
|
||||
'@flecks/web/server.request.route': (flecks) => async (req, res, next) => {
|
||||
if (isElectron() && 0 === req.user.id) {
|
||||
const {User} = flecks.get('$flecks/db.models');
|
||||
req.logIn(await User.findByPk(1), next);
|
||||
return;
|
||||
}
|
||||
next();
|
||||
},
|
||||
},
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
import {Hooks} from '@flecks/core';
|
||||
|
||||
export default {
|
||||
[Hooks]: {
|
||||
'@flecks/electron/server.window': async (win) => {
|
||||
win.removeMenu();
|
||||
win.openDevTools();
|
||||
win.maximize();
|
||||
win.once('ready-to-show', () => {
|
||||
win.show();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user