miolo 0.0.40 → 0.0.43
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/lib/config/defaults.js +14 -3
- package/lib/server/index.js +7 -2
- package/package.json +4 -4
- package/src/config/defaults.js +14 -5
- package/src/server/index.js +5 -2
package/lib/config/defaults.js
CHANGED
|
@@ -78,10 +78,20 @@ module.exports = {
|
|
|
78
78
|
} catch (e) {}
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
var
|
|
81
|
+
var from_basic_auth = ctx.user.id;
|
|
82
82
|
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
83
|
+
if (from_basic_auth != undefined) {
|
|
84
|
+
return from_basic_auth;
|
|
85
|
+
}
|
|
86
|
+
} catch (e) {}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
if (ctx.user.name == 'guest') {
|
|
90
|
+
var from_guest_auth = ctx.user.token;
|
|
91
|
+
|
|
92
|
+
if (from_guest_auth != undefined) {
|
|
93
|
+
return from_guest_auth;
|
|
94
|
+
}
|
|
85
95
|
}
|
|
86
96
|
} catch (e) {}
|
|
87
97
|
|
|
@@ -105,6 +115,7 @@ module.exports = {
|
|
|
105
115
|
},
|
|
106
116
|
queries: undefined
|
|
107
117
|
},
|
|
118
|
+
catcher: '/sys/jserror',
|
|
108
119
|
cacher: {
|
|
109
120
|
redis: {
|
|
110
121
|
host: '127.0.0.1',
|
package/lib/server/index.js
CHANGED
|
@@ -83,9 +83,14 @@ function _miolo() {
|
|
|
83
83
|
|
|
84
84
|
(0, _session.init_session_middleware)(app, config === null || config === void 0 ? void 0 : config.session); // attach the default robots.txt
|
|
85
85
|
|
|
86
|
-
(0, _robots.init_route_robots)(app); // Middleware for
|
|
86
|
+
(0, _robots.init_route_robots)(app); // Middleware for catching and logging JS errors
|
|
87
|
+
|
|
88
|
+
var catcher_url = config === null || config === void 0 ? void 0 : config.catcher;
|
|
89
|
+
|
|
90
|
+
if (catcher_url) {
|
|
91
|
+
(0, _catch_js_error.init_route_catch_js_error)(app, catcher_url);
|
|
92
|
+
} // auth middleware
|
|
87
93
|
|
|
88
|
-
(0, _catch_js_error.init_route_catch_js_error)(app, '/sys/jserror'); // auth middleware
|
|
89
94
|
|
|
90
95
|
if (config !== null && config !== void 0 && (_config$auth = config.auth) !== null && _config$auth !== void 0 && _config$auth.guest) {
|
|
91
96
|
var {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miolo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.43",
|
|
4
4
|
"description": "miolo",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Afialapis <info@afialapis.com>",
|
|
@@ -14,9 +14,9 @@
|
|
|
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.
|
|
18
|
-
"calustra-orm": "0.0.
|
|
19
|
-
"calustra-router": "0.0.
|
|
17
|
+
"calustra": "0.0.37",
|
|
18
|
+
"calustra-orm": "0.0.37",
|
|
19
|
+
"calustra-router": "0.0.37",
|
|
20
20
|
"cron": "^1.8.2",
|
|
21
21
|
"diskspace": "^2.0.0",
|
|
22
22
|
"eslint": "^8.9.0",
|
package/src/config/defaults.js
CHANGED
|
@@ -71,15 +71,23 @@ module.exports= {
|
|
|
71
71
|
}
|
|
72
72
|
} catch(e) {}
|
|
73
73
|
try {
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
74
|
+
const from_basic_auth= ctx.user.id
|
|
75
|
+
if (from_basic_auth!=undefined) {
|
|
76
|
+
return from_basic_auth
|
|
77
77
|
}
|
|
78
|
-
} catch(e) {}
|
|
78
|
+
} catch(e) {}
|
|
79
|
+
try {
|
|
80
|
+
if (ctx.user.name == 'guest') {
|
|
81
|
+
const from_guest_auth= ctx.user.token
|
|
82
|
+
if (from_guest_auth!=undefined) {
|
|
83
|
+
return from_guest_auth
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} catch(e) {}
|
|
79
87
|
let uid= ctx.headers['user-id']
|
|
80
88
|
if (uid!=undefined) {
|
|
81
89
|
return uid
|
|
82
|
-
}
|
|
90
|
+
}
|
|
83
91
|
return undefined
|
|
84
92
|
},
|
|
85
93
|
|
|
@@ -96,6 +104,7 @@ module.exports= {
|
|
|
96
104
|
},
|
|
97
105
|
queries: undefined
|
|
98
106
|
},
|
|
107
|
+
catcher: '/sys/jserror',
|
|
99
108
|
cacher: {
|
|
100
109
|
redis: {
|
|
101
110
|
host: '127.0.0.1',
|
package/src/server/index.js
CHANGED
|
@@ -58,8 +58,11 @@ async function miolo(sconfig, render, callback) {
|
|
|
58
58
|
// attach the default robots.txt
|
|
59
59
|
init_route_robots(app)
|
|
60
60
|
|
|
61
|
-
// Middleware for
|
|
62
|
-
|
|
61
|
+
// Middleware for catching and logging JS errors
|
|
62
|
+
const catcher_url= config?.catcher
|
|
63
|
+
if (catcher_url) {
|
|
64
|
+
init_route_catch_js_error(app, catcher_url)
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
// auth middleware
|
|
65
68
|
if (config?.auth?.guest) {
|