not-node 6.1.1 → 6.1.2

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.
Files changed (36) hide show
  1. package/.env +2 -2
  2. package/bin/not-cli.mjs +53 -12
  3. package/package.json +1 -1
  4. package/playground/app/front/build/admin.css +2 -0
  5. package/playground/app/front/build/admin.js +52427 -0
  6. package/playground/app/front/build/client.css +2 -0
  7. package/playground/app/front/build/client.js +52427 -0
  8. package/playground/app/front/build/guest.css +2 -0
  9. package/playground/app/front/build/guest.js +50907 -0
  10. package/playground/app/front/build/root.css +2 -0
  11. package/playground/app/front/build/root.js +60023 -0
  12. package/playground/app/front/build/user.css +2 -0
  13. package/playground/app/front/build/user.js +52425 -0
  14. package/playground/app/front/index.admin.js +160 -0
  15. package/playground/app/front/index.client.js +160 -0
  16. package/playground/app/front/index.guest.js +160 -0
  17. package/playground/app/front/index.root.js +224 -0
  18. package/playground/app/front/index.user.js +160 -0
  19. package/playground/app/front/rollup.admin.js +70 -0
  20. package/playground/app/front/rollup.client.js +70 -0
  21. package/playground/app/front/rollup.guest.js +70 -0
  22. package/playground/app/front/rollup.root.js +70 -0
  23. package/playground/app/front/rollup.user.js +70 -0
  24. package/playground/app/server/config/common.json +4 -4
  25. package/playground/app/server/config/development.json +31 -32
  26. package/playground/app/server/config/production.json +31 -32
  27. package/playground/app/server/config/stage.json +31 -32
  28. package/playground/app/server/routes/index.js +29 -31
  29. package/playground/app/server/views/parts/header.android.pug +6 -7
  30. package/playground/app/server/views/parts/header.ios.pug +5 -5
  31. package/src/metas.js +4 -3
  32. package/tmpl/files/app/routes/index.ejs +29 -31
  33. package/tmpl/files/app/views/parts/header.android.ejs +6 -7
  34. package/tmpl/files/app/views/parts/header.ios.ejs +5 -5
  35. package/tmpl/files/app/views/parts/menu.ejs +1 -1
  36. package/tmpl/files/app/views/parts/overview.ejs +1 -1
@@ -1,34 +1,33 @@
1
1
  {
2
- "hostname":"https://localhost",
3
- "CSP": {
4
- "connect": [
5
- "'self'",
6
- "*",
7
- "wss:",
8
- "https:",
9
- "'unsafe-inline'"
10
- ],
11
- "default": [
12
- "'self'",
13
- "*",
14
- "wss:",
15
- "https:",
16
- "'unsafe-inline'"
17
- ],
18
- "img": [
19
- "'self'",
20
- "data:"
21
- ],
22
- "script": [
23
- "'self'",
24
- "'unsafe-eval'",
25
- "'unsafe-inline'"
26
- ],
27
- "style": [
28
- "'self'",
29
- "'unsafe-inline'",
30
- "'unsafe-eval'"
31
- ]
32
- }
2
+ "hostname": "localhost",
3
+ "CSP": {
4
+ "connect": [
5
+ "'self'",
6
+ "*",
7
+ "wss:",
8
+ "https:",
9
+ "'unsafe-inline'"
10
+ ],
11
+ "default": [
12
+ "'self'",
13
+ "*",
14
+ "wss:",
15
+ "https:",
16
+ "'unsafe-inline'"
17
+ ],
18
+ "img": [
19
+ "'self'",
20
+ "data:"
21
+ ],
22
+ "script": [
23
+ "'self'",
24
+ "'unsafe-eval'",
25
+ "'unsafe-inline'"
26
+ ],
27
+ "style": [
28
+ "'self'",
29
+ "'unsafe-inline'",
30
+ "'unsafe-eval'"
31
+ ]
33
32
  }
34
-
33
+ }
@@ -1,36 +1,34 @@
1
- const
2
- notNode = require('not-node'),
3
- Auth = require('not-node').Auth,
4
- siteRouter = require('./site');
1
+ const notNode = require("not-node"),
2
+ { Auth, notAppIdentity } = require("not-node"),
3
+ siteRouter = require("./site");
5
4
 
6
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
+ });
7
10
 
8
- web.get('/api/manifest', function(req, res) {
9
- notNode.notHeadersStyler.get()(req,res);
10
- res.status(200).json(notNode.Application.getManifest(req));
11
- });
12
-
13
-
14
- web.get('/', (req, res, next) => {
15
- if (Auth.isUser(req)) {
16
- res.redirect('/dashboard');
17
- }else{
18
- next();
19
- }
20
- },
21
- siteRouter.index
22
- );
23
-
24
-
25
- web.get('/dashboard*',
26
- (req, res, next) => {
27
- if (Auth.isUser(req)) {
28
- next();
29
- } else {
30
- res.redirect('/login');
31
- }
32
- },
33
- siteRouter.dashboard
34
- );
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
+ );
35
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
+ );
36
34
  };
@@ -1,7 +1,6 @@
1
-
2
- <!-- Android -->
3
- meta(name="theme-color" content="#48c774")
4
- meta(name="color-scheme" content="light")
5
- meta(name="mobile-web-app-capable" content="yes")
6
- link(rel="stylesheet" href=host+"/front/"+role+".css")
7
- link(rel="stylesheet" href=host+"/assets/font-awesome.min.css")
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")
@@ -1,5 +1,5 @@
1
- <!-- iOS -->
2
- meta(name="apple-mobile-web-app-title" content=title)
3
- meta(name="apple-mobile-web-app-capable" content="yes")
4
- meta(name="apple-mobile-web-app-status-bar-style" content="#48c774")
5
- link(rel="apple-touch-icon" href="./img/icons/icon-512.png")
1
+ <!-- iOS -->
2
+ meta(name="apple-mobile-web-app-title" content=title)
3
+ meta(name="apple-mobile-web-app-capable" content="yes")
4
+ meta(name="apple-mobile-web-app-status-bar-style" content="#48c774")
5
+ link(rel="apple-touch-icon" href="./img/icons/icon-512.png")
package/src/metas.js CHANGED
@@ -1,11 +1,12 @@
1
1
  const Auth = require("./auth"),
2
- Env = require("./env"),
2
+ notAppIdentity = require("./identity"),
3
3
  notStyler = require("./styler"),
4
4
  config = require("not-config").createReader();
5
5
 
6
6
  function getRole(req) {
7
- if (Auth.isUser(req) && req.user) {
8
- return req.user.getPrimaryRole(Env.getEnv("rolesPriority"));
7
+ const identity = new notAppIdentity(req);
8
+ if (identity.isUser()) {
9
+ return identity.getRole();
9
10
  } else {
10
11
  return Auth.DEFAULT_USER_ROLE_FOR_GUEST;
11
12
  }
@@ -1,36 +1,34 @@
1
- const
2
- notNode = require('not-node'),
3
- Auth = require('not-node').Auth,
4
- siteRouter = require('./site');
1
+ const notNode = require("not-node"),
2
+ { Auth, notAppIdentity } = require("not-node"),
3
+ siteRouter = require("./site");
5
4
 
6
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
+ });
7
10
 
8
- web.get('/api/manifest', function(req, res) {
9
- notNode.notHeadersStyler.get()(req,res);
10
- res.status(200).json(notNode.Application.getManifest(req));
11
- });
12
-
13
-
14
- web.get('/', (req, res, next) => {
15
- if (Auth.isUser(req)) {
16
- res.redirect('/dashboard');
17
- }else{
18
- next();
19
- }
20
- },
21
- siteRouter.index
22
- );
23
-
24
-
25
- web.get('/dashboard*',
26
- (req, res, next) => {
27
- if (Auth.isUser(req)) {
28
- next();
29
- } else {
30
- res.redirect('/login');
31
- }
32
- },
33
- siteRouter.dashboard
34
- );
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
+ );
35
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
+ );
36
34
  };
@@ -1,7 +1,6 @@
1
-
2
- <!-- Android -->
3
- meta(name="theme-color" content="#48c774")
4
- meta(name="color-scheme" content="light")
5
- meta(name="mobile-web-app-capable" content="yes")
6
- link(rel="stylesheet" href=host+"/front/"+role+".css")
7
- link(rel="stylesheet" href=host+"/assets/font-awesome.min.css")
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")
@@ -1,5 +1,5 @@
1
- <!-- iOS -->
2
- meta(name="apple-mobile-web-app-title" content=title)
3
- meta(name="apple-mobile-web-app-capable" content="yes")
4
- meta(name="apple-mobile-web-app-status-bar-style" content="#48c774")
5
- link(rel="apple-touch-icon" href="./img/icons/icon-512.png")
1
+ <!-- iOS -->
2
+ meta(name="apple-mobile-web-app-title" content=title)
3
+ meta(name="apple-mobile-web-app-capable" content="yes")
4
+ meta(name="apple-mobile-web-app-status-bar-style" content="#48c774")
5
+ link(rel="apple-touch-icon" href="./img/icons/icon-512.png")
@@ -1 +1 @@
1
- nav(class="navbar is-success" role="navigation" aria-label="dropdown navigation" id="top-menu")
1
+ nav(class="navbar is-success" role="navigation" aria-label="dropdown navigation" id="top-menu")
@@ -1,2 +1,2 @@
1
1
  div(class="is-success is-fullheight")
2
- p Story of another little side project.
2
+ p Story of another little side project.