miolo 0.0.16 → 0.0.19

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.
@@ -22,7 +22,8 @@ module.exports = {
22
22
  /** 'session' will result in a cookie that expires when session/browser is closed */
23
23
 
24
24
  /** Warning: If a session cookie is stolen, this cookie will never expire */
25
- maxAge: 86400000,
25
+ maxAge: 10000,
26
+ //86400000,
26
27
 
27
28
  /** (boolean) automatically commit headers (default true) */
28
29
  //autoCommit: true,
@@ -39,9 +39,9 @@ function init_sys_check_and_log(logger) {
39
39
  var free = Math.round(toGB(result.free), 2);
40
40
 
41
41
  if (free < 1) {
42
- logger.error("[SERVER][".concat((0, _farrapaColors.cyan)('SysCheck'), "] DISK ").concat((0, _farrapaColors.yellow)(used), " GB used of ").concat((0, _farrapaColors.green)(total), " MB (").concat((0, _farrapaColors.yellow)(free), " GB free)"));
42
+ logger.error("[SERVER][".concat((0, _farrapaColors.cyan)('SysCheck'), "] DISK ").concat((0, _farrapaColors.yellow)(used), " GB used of ").concat((0, _farrapaColors.green)(total), " GB (").concat((0, _farrapaColors.yellow)(free), " GB free)"));
43
43
  } else {
44
- logger.info("[SERVER][".concat((0, _farrapaColors.cyan)('SysCheck'), "] DISK ").concat((0, _farrapaColors.yellow)(used), " GB used of ").concat((0, _farrapaColors.green)(total), " MB (").concat((0, _farrapaColors.yellow)(free), " GB free)"));
44
+ logger.info("[SERVER][".concat((0, _farrapaColors.cyan)('SysCheck'), "] DISK ").concat((0, _farrapaColors.yellow)(used), " GB used of ").concat((0, _farrapaColors.green)(total), " GB (").concat((0, _farrapaColors.yellow)(free), " GB free)"));
45
45
  }
46
46
  });
47
47
  }
@@ -23,9 +23,23 @@ function _init_crud_router() {
23
23
  return undefined;
24
24
  }
25
25
 
26
- var router = yield (0, _calustraRouter.default)(conn, config.routes, config.path, 'public', {
27
- body_field: undefined
28
- });
26
+ var routerOptions = {
27
+ body_field: undefined,
28
+ get_uid: ctx => {
29
+ try {
30
+ return ctx.state.user.id;
31
+ } catch (e) {}
32
+
33
+ var uid = ctx.headers['user-id'];
34
+
35
+ if (uid != undefined) {
36
+ return uid;
37
+ }
38
+
39
+ return undefined;
40
+ }
41
+ };
42
+ var router = yield (0, _calustraRouter.default)(conn, config.routes, config.path, 'public', routerOptions);
29
43
  app.use(router.routes());
30
44
  });
31
45
  return _init_crud_router.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "description": "miolo",
5
5
  "main": "lib/index.js",
6
6
  "author": "Afialapis <info@afialapis.com>",
@@ -14,8 +14,8 @@
14
14
  "assign-deep": "^1.0.1",
15
15
  "babel-plugin-module-resolver": "^4.1.0",
16
16
  "basic-auth": "^2.0.1",
17
- "calustra": "0.0.19",
18
- "calustra-router": "0.0.19",
17
+ "calustra": "0.0.23",
18
+ "calustra-router": "0.0.23",
19
19
  "cron": "^1.8.2",
20
20
  "diskspace": "^2.0.0",
21
21
  "eslint": "^8.9.0",
@@ -19,7 +19,7 @@ module.exports= {
19
19
  /** (number || 'session') maxAge in ms (default is 1 days) */
20
20
  /** 'session' will result in a cookie that expires when session/browser is closed */
21
21
  /** Warning: If a session cookie is stolen, this cookie will never expire */
22
- maxAge: 86400000,
22
+ maxAge: 10000, //86400000,
23
23
 
24
24
  /** (boolean) automatically commit headers (default true) */
25
25
  //autoCommit: true,
@@ -35,9 +35,9 @@ function init_sys_check_and_log(logger) {
35
35
  const free = Math.round(toGB(result.free), 2)
36
36
 
37
37
  if (free<1) {
38
- logger.error(`[SERVER][${cyan('SysCheck')}] DISK ${yellow(used)} GB used of ${green(total)} MB (${yellow(free)} GB free)`)
38
+ logger.error(`[SERVER][${cyan('SysCheck')}] DISK ${yellow(used)} GB used of ${green(total)} GB (${yellow(free)} GB free)`)
39
39
  } else {
40
- logger.info(`[SERVER][${cyan('SysCheck')}] DISK ${yellow(used)} GB used of ${green(total)} MB (${yellow(free)} GB free)`)
40
+ logger.info(`[SERVER][${cyan('SysCheck')}] DISK ${yellow(used)} GB used of ${green(total)} GB (${yellow(free)} GB free)`)
41
41
  }
42
42
  });
43
43
  }
@@ -5,8 +5,22 @@ async function init_crud_router (app, conn, config) {
5
5
  if (! config) {
6
6
  return undefined
7
7
  }
8
+
9
+ const routerOptions= {
10
+ body_field: undefined,
11
+ get_uid: (ctx) => {
12
+ try {
13
+ return ctx.state.user.id
14
+ } catch(e) {}
15
+ let uid= ctx.headers['user-id']
16
+ if (uid!=undefined) {
17
+ return uid
18
+ }
19
+ return undefined
20
+ }
21
+ }
8
22
 
9
- const router= await calustraRouter(conn, config.routes, config.path, 'public', {body_field: undefined})
23
+ const router= await calustraRouter(conn, config.routes, config.path, 'public', routerOptions)
10
24
  app.use(router.routes())
11
25
 
12
26
  }