not-node 6.1.3 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/not-cli.mjs +3 -3
- package/package.json +1 -1
- package/playground/.babelrc +11 -0
- package/playground/.eslintignore +4 -0
- package/playground/.eslintrc.json +23 -0
- package/playground/app/front/build/admin.css +2 -0
- package/playground/app/front/build/admin.js +52419 -0
- package/playground/app/front/build/client.css +2 -0
- package/playground/app/front/build/client.js +52419 -0
- package/playground/app/front/build/guest.css +2 -0
- package/playground/app/front/build/guest.js +50915 -0
- package/playground/app/front/build/root.css +2 -0
- package/playground/app/front/build/root.js +60015 -0
- package/playground/app/front/build/user.css +2 -0
- package/playground/app/front/build/user.js +52417 -0
- package/playground/app/front/build.env.js +15 -0
- package/playground/app/front/index.!.js +64 -0
- package/playground/app/front/index.admin.js +160 -0
- package/playground/app/front/index.client.js +160 -0
- package/playground/app/front/index.guest.js +160 -0
- package/playground/app/front/index.root.js +224 -0
- package/playground/app/front/index.user.js +160 -0
- package/playground/app/front/rollup.!.js +70 -0
- package/playground/app/front/rollup.admin.js +70 -0
- package/playground/app/front/rollup.client.js +70 -0
- package/playground/app/front/rollup.guest.js +70 -0
- package/playground/app/front/rollup.root.js +70 -0
- package/playground/app/front/rollup.user.js +70 -0
- package/playground/app/front/src/admin/main/index.js +34 -0
- package/playground/app/front/src/client/main/index.js +34 -0
- package/playground/app/front/src/common/index.js +40 -0
- package/playground/app/front/src/common/ncInit.js +18 -0
- package/playground/app/front/src/common/ws.client.main.js +34 -0
- package/playground/app/front/src/guest/main/index.js +45 -0
- package/playground/app/front/src/root/main/index.js +34 -0
- package/playground/app/front/src/user/main/index.js +34 -0
- package/playground/app/server/app.js +25 -0
- package/playground/app/server/config/common.json +106 -0
- package/playground/app/server/config/development.json +34 -0
- package/playground/app/server/config/production.json +34 -0
- package/playground/app/server/config/stage.json +34 -0
- package/playground/app/server/index.js +20 -0
- package/playground/app/server/routes/index.js +34 -0
- package/playground/app/server/routes/site.js +71 -0
- package/playground/app/server/views/admin/foot.pug +1 -0
- package/playground/app/server/views/admin/head.pug +7 -0
- package/playground/app/server/views/admin/menu.pug +2 -0
- package/playground/app/server/views/admin.pug +19 -0
- package/playground/app/server/views/dashboard.pug +20 -0
- package/playground/app/server/views/index.pug +15 -0
- package/playground/app/server/views/parts/header.android.pug +6 -0
- package/playground/app/server/views/parts/header.ios.pug +5 -0
- package/playground/app/server/views/parts/header.pug +18 -0
- package/playground/app/server/views/parts/menu.pug +1 -0
- package/playground/app/server/views/parts/overview.pug +2 -0
- package/playground/app/server/ws/auth.js +41 -0
- package/playground/app/server/ws/index.js +84 -0
- package/playground/bin/build.sh +8 -0
- package/playground/package.json +85 -0
- package/playground/project.manifest.json +37 -0
- package/src/cli/readers/ws.mjs +12 -0
- package/src/cli/renderers/controllers.mjs +1 -0
- package/tmpl/dirs/module.front.mjs +1 -1
- package/tmpl/files/module.front/common/index.ejs +7 -6
- package/tmpl/files/module.front/common/ws.client.main.ejs +2 -3
- package/tmpl/files/module.front/role/index.ejs +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const notNode = require("not-node"),
|
|
2
|
+
{ Auth, notAppIdentity } = require("not-node"),
|
|
3
|
+
siteRouter = require("./site");
|
|
4
|
+
|
|
5
|
+
module.exports = (web) => {
|
|
6
|
+
web.get("/api/manifest", function (req, res) {
|
|
7
|
+
notNode.notHeadersStyler.get()(req, res);
|
|
8
|
+
res.status(200).json(notNode.Application.getManifest(req));
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
web.get(
|
|
12
|
+
"/",
|
|
13
|
+
(req, res, next) => {
|
|
14
|
+
if (new notAppIdentity(req).isUser()) {
|
|
15
|
+
res.redirect("/dashboard");
|
|
16
|
+
} else {
|
|
17
|
+
next();
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
siteRouter.index
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
web.get(
|
|
24
|
+
"/dashboard*",
|
|
25
|
+
(req, res, next) => {
|
|
26
|
+
if (new notAppIdentity(req).isUser()) {
|
|
27
|
+
next();
|
|
28
|
+
} else {
|
|
29
|
+
res.redirect("/login");
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
siteRouter.dashboard
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const
|
|
2
|
+
notError = require('not-error').notError,
|
|
3
|
+
notNode = require('not-node');
|
|
4
|
+
|
|
5
|
+
const METAS_OVERRIDES = {
|
|
6
|
+
title: "notNodeApplication",
|
|
7
|
+
desription: "notNodeApplication",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function getMetas(req, res){
|
|
11
|
+
const styler = notNode.notMetasStyler.get();
|
|
12
|
+
return {...styler(req, res), ...METAS_OVERRIDES};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports.index = function (req, res, next) {
|
|
16
|
+
notNode.Application.logger.debug('index '+ notNode.Auth.getIP(req) + ' : ' + req.originalUrl);
|
|
17
|
+
if (req.originalUrl.indexOf('/api/') == 0) {
|
|
18
|
+
return next();
|
|
19
|
+
}
|
|
20
|
+
notNode.notHeadersStyler.get()(req, res)
|
|
21
|
+
const layout = 'index';
|
|
22
|
+
try {
|
|
23
|
+
const metas = getMetas(req, res);
|
|
24
|
+
res.render(layout, metas, (err, html) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
notNode.Application.logger.error(['rendering error', err]);
|
|
27
|
+
notNode.Application.report(new notError('rendering error', {
|
|
28
|
+
...metas,
|
|
29
|
+
session: req.session.id
|
|
30
|
+
}, err));
|
|
31
|
+
res.status(500).end();
|
|
32
|
+
} else {
|
|
33
|
+
res.status(200).send(html).end();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
let err = new notError('Index page generation error', {}, e);
|
|
38
|
+
notNode.Application.logger.error(err);
|
|
39
|
+
notNode.Application.report(err);
|
|
40
|
+
res.status(500).end();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports.dashboard = (req, res, next) => {
|
|
45
|
+
try {
|
|
46
|
+
notNode.Application.logger.debug(notNode.Auth.getIP(req), 'dashboard');
|
|
47
|
+
if (req.originalUrl.indexOf('/api/') == 0) {
|
|
48
|
+
return next();
|
|
49
|
+
}
|
|
50
|
+
const layout = 'dashboard';
|
|
51
|
+
const metas = getMetas(req, res);
|
|
52
|
+
res.render(layout, metas, (err, html) => {
|
|
53
|
+
if (err) {
|
|
54
|
+
notNode.Application.logger.error(['rendering error', err]);
|
|
55
|
+
notNode.Application.report(new notError('rendering error', {
|
|
56
|
+
...metas,
|
|
57
|
+
session: req.session.id
|
|
58
|
+
}, err));
|
|
59
|
+
res.status(500).end();
|
|
60
|
+
} else {
|
|
61
|
+
res.status(200).send(html).end();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
} catch (e) {
|
|
66
|
+
let err = new notError('Dashboard page generation error', {}, e);
|
|
67
|
+
notNode.Application.logger.error(err);
|
|
68
|
+
notNode.Application.report(err);
|
|
69
|
+
res.status(500).end();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
script(src=host+"/front/root.js")
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
meta(charset="utf-8")
|
|
2
|
+
meta(http-equiv="x-ua-compatible" content="ie=edge")
|
|
3
|
+
meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no")
|
|
4
|
+
link(rel="manifest" href="/site.webmanifest")
|
|
5
|
+
link(rel="apple-touch-icon" href="/icon.png")
|
|
6
|
+
link(rel="stylesheet" href="css/style.css")
|
|
7
|
+
link(rel="stylesheet" href=host+"/front/root.css")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html.no-js(lang="ru-RU")
|
|
3
|
+
head
|
|
4
|
+
title Administration system
|
|
5
|
+
meta(name="keywords" content="")
|
|
6
|
+
meta(name="description" content="")
|
|
7
|
+
meta(name="author" content="")
|
|
8
|
+
include admin/head.pug
|
|
9
|
+
body
|
|
10
|
+
nav(class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0")
|
|
11
|
+
a(class="navbar-brand col-sm-3 col-md-2 mr-0" href="/dashboard")
|
|
12
|
+
ul(class="navbar-nav px-3")
|
|
13
|
+
li(class="nav-item text-nowrap")
|
|
14
|
+
a(class="nav-link" n-href="/logout") Logout
|
|
15
|
+
div.container-fluid
|
|
16
|
+
div.row
|
|
17
|
+
include admin/menu.pug
|
|
18
|
+
main(role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4 main-container")
|
|
19
|
+
include admin/foot.pug
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html.no-js(lang="")
|
|
3
|
+
head
|
|
4
|
+
meta(charset="utf-8")
|
|
5
|
+
meta(http-equiv="x-ua-compatible" content="ie=edge")
|
|
6
|
+
title= title
|
|
7
|
+
meta(name="description" content=description)
|
|
8
|
+
meta(name="viewport" content="width=device-width, initial-scale=1")
|
|
9
|
+
link(rel="apple-touch-icon" href="apple-touch-icon.png")
|
|
10
|
+
link(rel="stylesheet" href=host+"/assets/font-awasome-5.13.1-all.min.css")
|
|
11
|
+
link(rel="stylesheet" href=host+"/front/"+role+".css")
|
|
12
|
+
body
|
|
13
|
+
nav(id="top-menu" class="navbar is-success" role="navigation" aria-label="dropdown navigation")
|
|
14
|
+
aside(class="menu main-menu" id="side-menu")
|
|
15
|
+
main
|
|
16
|
+
section(class="section main-container")
|
|
17
|
+
footer(class="footer")
|
|
18
|
+
div(class="content has-text-centered")
|
|
19
|
+
p footer
|
|
20
|
+
script(src="/front/"+role+".js")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html.no-js(lang="")
|
|
3
|
+
head
|
|
4
|
+
|
|
5
|
+
include ./parts/header.pug
|
|
6
|
+
|
|
7
|
+
body
|
|
8
|
+
section(class="hero is-success is-fullheight")
|
|
9
|
+
include ./parts/menu.pug
|
|
10
|
+
div(class="hero-body")
|
|
11
|
+
div(class="container has-text-centered")
|
|
12
|
+
h1(class="title") Hello world
|
|
13
|
+
h2(class="subtitle") and so it begins
|
|
14
|
+
include ./parts/overview.pug
|
|
15
|
+
script(src=host+"/front/"+role+".js")
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!-- Android -->
|
|
2
|
+
meta(name="theme-color" content="#48c774")
|
|
3
|
+
meta(name="color-scheme" content="light")
|
|
4
|
+
meta(name="mobile-web-app-capable" content="yes")
|
|
5
|
+
link(rel="stylesheet" href=host+"/front/"+role+".css")
|
|
6
|
+
link(rel="stylesheet" href=host+"/assets/font-awesome.min.css")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
meta(charset="utf-8")
|
|
2
|
+
meta(http-equiv="x-ua-compatible" content="ie=edge")
|
|
3
|
+
meta(name="viewport" content="width=device-width, initial-scale=1")
|
|
4
|
+
title= title
|
|
5
|
+
link(rel="icon" type="image/png" href="/img/icons/icon-64.png")
|
|
6
|
+
link(rel="manifest" href="/manifest.json")
|
|
7
|
+
link(rel="canonical" href=canonical)
|
|
8
|
+
|
|
9
|
+
meta(name="description" content=description)
|
|
10
|
+
meta(name="application-name" content=title)
|
|
11
|
+
meta(name="author" content="" )
|
|
12
|
+
meta(name="referrer" content="strict-origin")
|
|
13
|
+
meta(itemprop="name" content=title)
|
|
14
|
+
meta(itemprop="description" content=description)
|
|
15
|
+
meta(itemprop="image" content="./img/icons/icon-128.png")
|
|
16
|
+
|
|
17
|
+
include ./header.ios.pug
|
|
18
|
+
include ./header.android.pug
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nav(class="navbar is-success" role="navigation" aria-label="dropdown navigation" id="top-menu")
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const Log = require("not-log")(module, "WS::Auth");
|
|
2
|
+
const notNode = require("not-node");
|
|
3
|
+
const ObjectId = require("mongoose").Types.ObjectId;
|
|
4
|
+
|
|
5
|
+
function isRoot(token) {
|
|
6
|
+
return token.role ? token.role.indexOf("root") > -1 : false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isAuth(_id) {
|
|
10
|
+
try {
|
|
11
|
+
return !!ObjectId(_id);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = ({ serviceData, cred }) => {
|
|
18
|
+
//Log.log(serviceData, cred);
|
|
19
|
+
const [model, action] = serviceData.name.split("//");
|
|
20
|
+
//Log.log(model, action);
|
|
21
|
+
let user = {
|
|
22
|
+
auth: isAuth(cred._id),
|
|
23
|
+
role: cred.role,
|
|
24
|
+
root: isRoot(cred),
|
|
25
|
+
username: cred.username,
|
|
26
|
+
email: cred.email,
|
|
27
|
+
emailConfirmed: cred.emailConfirmed,
|
|
28
|
+
};
|
|
29
|
+
//Log.log(user);
|
|
30
|
+
let actionManifest = notNode.Application.getActionManifestForUser(
|
|
31
|
+
model,
|
|
32
|
+
action,
|
|
33
|
+
user
|
|
34
|
+
);
|
|
35
|
+
Log.log(model, action, user.username, user.role, !!actionManifest);
|
|
36
|
+
if (actionManifest) {
|
|
37
|
+
return true;
|
|
38
|
+
} else {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const jwt = require("jsonwebtoken"),
|
|
2
|
+
config = require("not-config").createReader(),
|
|
3
|
+
log = require("not-log")(module, "WS"),
|
|
4
|
+
authRoute = require("./auth.js");
|
|
5
|
+
|
|
6
|
+
const { notWSMessenger } = require("not-ws");
|
|
7
|
+
const { notRequestError, notValidationError } = require("not-error");
|
|
8
|
+
|
|
9
|
+
const mainValidators = {
|
|
10
|
+
credentials(credentials, serviceData) {
|
|
11
|
+
try {
|
|
12
|
+
log.log(serviceData.type, serviceData.name);
|
|
13
|
+
let cred = jwt.verify(
|
|
14
|
+
credentials,
|
|
15
|
+
config.get("modules:user:secret")
|
|
16
|
+
);
|
|
17
|
+
if (cred) {
|
|
18
|
+
return authRoute({ serviceData, cred });
|
|
19
|
+
} else {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {
|
|
23
|
+
log.error(e);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function wrapError(data, serviceData, error) {
|
|
30
|
+
if (error instanceof notRequestError) {
|
|
31
|
+
return {
|
|
32
|
+
status: "error",
|
|
33
|
+
message: error.getResult().message,
|
|
34
|
+
errors: error.getResult().errors,
|
|
35
|
+
};
|
|
36
|
+
} else if (error instanceof notValidationError) {
|
|
37
|
+
return {
|
|
38
|
+
status: "error",
|
|
39
|
+
message: error.message,
|
|
40
|
+
errors: error.getFieldsErrors(),
|
|
41
|
+
};
|
|
42
|
+
} else {
|
|
43
|
+
return {
|
|
44
|
+
status: "error",
|
|
45
|
+
message: error.message,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function wrapOk(result) {
|
|
51
|
+
return {
|
|
52
|
+
status: "ok",
|
|
53
|
+
result,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
servers: {
|
|
59
|
+
main: {
|
|
60
|
+
logger: log,
|
|
61
|
+
jwt: {
|
|
62
|
+
key: config.get("modules:user:secret"),
|
|
63
|
+
},
|
|
64
|
+
getMessenger() {
|
|
65
|
+
return new notWSMessenger({
|
|
66
|
+
logger: log,
|
|
67
|
+
secure: true,
|
|
68
|
+
validateTypeAndName: false,
|
|
69
|
+
validators: mainValidators,
|
|
70
|
+
wrap: {
|
|
71
|
+
ok: wrapOk,
|
|
72
|
+
error: wrapError,
|
|
73
|
+
},
|
|
74
|
+
types: {
|
|
75
|
+
request: [],
|
|
76
|
+
response: [],
|
|
77
|
+
event: [],
|
|
78
|
+
__service: [],
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
echo 'building for' $ENV 'environment'
|
|
3
|
+
rm -rf ./app/front/build/${TARGET_ROLE}.min.js
|
|
4
|
+
rm -rf ./app/front/build/${TARGET_ROLE}.js
|
|
5
|
+
rm -rf ./app/front/build/${TARGET_ROLE}.css
|
|
6
|
+
NODE_ENV=$ENV ./node_modules/.bin/eslint ./src/controllers
|
|
7
|
+
NODE_ENV=$ENV ./node_modules/.bin/rollup -c ./rollup/${TARGET_ROLE}.js --environment ENV:$ENV
|
|
8
|
+
NODE_ENV=$ENV ./node_modules/.bin/terser --compress --mangle -- build/${TARGET_ROLE}.js > ./build/${TARGET_ROLE}.min.js
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "not-node-application",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "notNodeApplication",
|
|
5
|
+
"main": "app/server/index.js",
|
|
6
|
+
"private": true,
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">14.9"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start":"node ./app/server/index.js",
|
|
12
|
+
"test": "./node_modules/.bin/mocha --reporter spec ./tests/**.js",
|
|
13
|
+
"lint": "./node_modules/.bin/eslint ./app/**/**.js ./app/server/**/**/**.js ./app/server/**/**/**/**.js ./app/server/**/**/**/**/**.js --fix",
|
|
14
|
+
"docs": "./node_modules/.bin/jsdoc -c jsdoc.json",
|
|
15
|
+
"cover": "nyc npm test",
|
|
16
|
+
"build:dev:guest:watch": "watch 'npm run build:dev:guest' ./app/front/src --interval=5",
|
|
17
|
+
"build": "./node_modules/.bin/not-builder --config='./project.manifest.json'",
|
|
18
|
+
"build:dev": "npm run development",
|
|
19
|
+
"build:dev:guest": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=guest --environment=development",
|
|
20
|
+
"build:dev:user": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=user --environment=development",
|
|
21
|
+
"build:dev:client": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=client --environment=development",
|
|
22
|
+
"build:dev:admin": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=admin --environment=development",
|
|
23
|
+
"build:dev:root": "./node_modules/.bin/not-builder --config='./project.manifest.json' --role=root --environment=development",
|
|
24
|
+
"archive": "./bin/archive.sh",
|
|
25
|
+
"production": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=production",
|
|
26
|
+
"development": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=development",
|
|
27
|
+
"stage": "./node_modules/.bin/not-builder --config='./project.manifest.json' --environment=stage",
|
|
28
|
+
"update": "ncu -u -x escape-string-regexp && npm i",
|
|
29
|
+
"urd:dev": "npm run update && npm run build:dev && pm2 restart not-node-application.dev"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"redis": "*",
|
|
33
|
+
"pug":"*",
|
|
34
|
+
"not-node": "*",
|
|
35
|
+
"not-options":"*",
|
|
36
|
+
"not-filter":"*",
|
|
37
|
+
"not-notification":"*",
|
|
38
|
+
"not-locale":"*",
|
|
39
|
+
"not-inform":"*",
|
|
40
|
+
"not-inform-rule-tag":"*",
|
|
41
|
+
"not-inform-sink-email":"*",
|
|
42
|
+
"not-inform-sink-notification":"*",
|
|
43
|
+
"not-inform-sink-ws":"*",
|
|
44
|
+
"not-key":"*",
|
|
45
|
+
"not-ws":"*",
|
|
46
|
+
"not-store":"*",
|
|
47
|
+
"not-dbdump":"*",
|
|
48
|
+
"not-user":"*",
|
|
49
|
+
"not-error":"*",
|
|
50
|
+
|
|
51
|
+
"dotenv": "*"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/core": "^7.18.9",
|
|
55
|
+
"@babel/polyfill": "^7.12.1",
|
|
56
|
+
"@babel/preset-env": "^7.18.9",
|
|
57
|
+
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
|
58
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
59
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
60
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
61
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
62
|
+
"babel-core": "*",
|
|
63
|
+
"babel-polyfill": "*",
|
|
64
|
+
"babel-preset-es2015-rollup": "*",
|
|
65
|
+
"babel-runtime": "*",
|
|
66
|
+
"chai": "^4.3.6",
|
|
67
|
+
"eslint": "^8.20.0",
|
|
68
|
+
"ink-docstrap": "^1.3.2",
|
|
69
|
+
"jsdoc": "^3.6.11",
|
|
70
|
+
"mocha": "^10.0.0",
|
|
71
|
+
"ndb": "^1.1.5",
|
|
72
|
+
"nyc": "^15.1.0",
|
|
73
|
+
"rollup": "^2.77.2",
|
|
74
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
75
|
+
"rollup-plugin-sass": "^1.2.13",
|
|
76
|
+
"rollup-plugin-svelte": "^7.1.0",
|
|
77
|
+
"rollup-plugin-eslint": "^7.0.0",
|
|
78
|
+
"rollup-plugin-filesize": "^9.1.2",
|
|
79
|
+
"rollup-plugin-sizes": "^1.0.4",
|
|
80
|
+
"rollup-watch": "*",
|
|
81
|
+
"should": "^13.2.3",
|
|
82
|
+
"svelte": "*",
|
|
83
|
+
"yargs": "^17.5.1"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "notNodeApplication",
|
|
3
|
+
"targets": {
|
|
4
|
+
"server": {
|
|
5
|
+
"name": "notNodeApplication",
|
|
6
|
+
"roles": ["root","admin","client","user","guest"],
|
|
7
|
+
"builder": "server",
|
|
8
|
+
"root": "app/front/",
|
|
9
|
+
"src": "app/front/",
|
|
10
|
+
"build": "app/front/build/",
|
|
11
|
+
"index": "app/front/index.!.js",
|
|
12
|
+
"rollup": "app/front/rollup.!.js",
|
|
13
|
+
"modules": {
|
|
14
|
+
"serverModulesDir": "app/server/modules",
|
|
15
|
+
"frontModulesDir": "app/front/src",
|
|
16
|
+
"npm": {
|
|
17
|
+
"not-options": {},
|
|
18
|
+
"not-filter": {},
|
|
19
|
+
"not-notification": {},
|
|
20
|
+
"not-locale": {},
|
|
21
|
+
"not-inform": {},
|
|
22
|
+
"not-inform-rule-tag": {},
|
|
23
|
+
"not-inform-sink-email": {},
|
|
24
|
+
"not-inform-sink-notification": {},
|
|
25
|
+
"not-inform-sink-ws": {},
|
|
26
|
+
"not-key": {},
|
|
27
|
+
"not-ws": {},
|
|
28
|
+
"not-store": {},
|
|
29
|
+
"not-dbdump": {},
|
|
30
|
+
"not-user": {},
|
|
31
|
+
"not-error": {}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/cli/readers/ws.mjs
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
function collectData(inquirer) {
|
|
2
2
|
return inquirer.prompt([
|
|
3
|
+
{
|
|
4
|
+
type: "input",
|
|
5
|
+
name: "hostname",
|
|
6
|
+
message: "WS hostname (default: window.location.hostname)",
|
|
7
|
+
default: "",
|
|
8
|
+
},
|
|
3
9
|
{
|
|
4
10
|
type: "input",
|
|
5
11
|
name: "port",
|
|
6
12
|
message: "WS port number",
|
|
7
13
|
default: 33000,
|
|
8
14
|
},
|
|
15
|
+
{
|
|
16
|
+
type: "input",
|
|
17
|
+
name: "path",
|
|
18
|
+
message: "WS path ",
|
|
19
|
+
default: "websocket",
|
|
20
|
+
},
|
|
9
21
|
{
|
|
10
22
|
type: "config",
|
|
11
23
|
name: "secure",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if(modules.includes('not-ws')){ %>
|
|
1
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
2
2
|
import main from './ws.client.main.js';
|
|
3
3
|
<% } %>
|
|
4
4
|
|
|
@@ -13,15 +13,16 @@ let manifest = {
|
|
|
13
13
|
url: '/'
|
|
14
14
|
},
|
|
15
15
|
modules:{
|
|
16
|
-
<% if(modules.includes('not-ws')){ %>
|
|
16
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
17
17
|
ws:{
|
|
18
18
|
clients:{
|
|
19
19
|
//options for ws client here
|
|
20
20
|
main: {
|
|
21
|
-
host: window.location.hostname,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
host: '<%- ws.hostname %>' || window.location.hostname,
|
|
22
|
+
port: <%- ws.port %>,
|
|
23
|
+
path: '<%- ws.path %>',
|
|
24
|
+
secure: <%- ws.secure %>,
|
|
25
|
+
ssl: <%- !!ssl %>
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -6,9 +6,8 @@ const main = {
|
|
|
6
6
|
getToken: () => {
|
|
7
7
|
return notCommon.getApp().getModel('user', {}).$token({})
|
|
8
8
|
.then((res) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return res.result.token;
|
|
9
|
+
notCommon.getApp().setWorking('token', res.result);
|
|
10
|
+
return res.result;
|
|
12
11
|
});
|
|
13
12
|
},
|
|
14
13
|
messenger: {
|