@abtnode/blocklet-services 1.8.17 → 1.8.20
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/api/services/auth/index.js +13 -2
- package/package.json +19 -15
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const get = require('lodash/get');
|
|
3
3
|
const minimatch = require('minimatch');
|
|
4
4
|
const bearerToken = require('express-bearer-token');
|
|
5
|
+
const getBlocklet403Template = require('@abtnode/router-templates/lib/blocklet-403');
|
|
5
6
|
|
|
6
7
|
const validators = require('@blocklet/sdk/lib/validators');
|
|
7
8
|
const {
|
|
@@ -186,12 +187,22 @@ const init = ({ node, options }) => {
|
|
|
186
187
|
|
|
187
188
|
if (blocked) {
|
|
188
189
|
if (!authenticated) {
|
|
189
|
-
|
|
190
|
+
if (req.accepts(['html', 'json']) === 'html') {
|
|
191
|
+
res.redirect(getRedirectUrl({ req, pagePath: '/login' }));
|
|
192
|
+
} else {
|
|
193
|
+
res.status(401).json({ code: 401, error: 'Unauthorized' });
|
|
194
|
+
}
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
if (!authorized) {
|
|
194
|
-
|
|
199
|
+
if (req.accepts(['html', 'json']) === 'html') {
|
|
200
|
+
const nodeInfo = await req.getNodeInfo();
|
|
201
|
+
const blocklet = await req.getBlocklet();
|
|
202
|
+
res.send(getBlocklet403Template(blocklet, nodeInfo));
|
|
203
|
+
} else {
|
|
204
|
+
res.status(403).json({ code: 403, error: 'Forbidden' });
|
|
205
|
+
}
|
|
195
206
|
return;
|
|
196
207
|
}
|
|
197
208
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.20",
|
|
7
7
|
"description": "Provide unified services for every blocklet",
|
|
8
8
|
"main": "api/index.js",
|
|
9
9
|
"files": [
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@abtnode/auth": "1.8.
|
|
35
|
-
"@abtnode/client": "1.8.
|
|
36
|
-
"@abtnode/constant": "1.8.
|
|
37
|
-
"@abtnode/core": "1.8.
|
|
38
|
-
"@abtnode/cron": "1.8.
|
|
39
|
-
"@abtnode/db": "1.8.
|
|
40
|
-
"@abtnode/logger": "1.8.
|
|
41
|
-
"@abtnode/router-adapter": "1.8.
|
|
42
|
-
"@abtnode/router-templates": "1.8.
|
|
43
|
-
"@abtnode/util": "1.8.
|
|
34
|
+
"@abtnode/auth": "1.8.20",
|
|
35
|
+
"@abtnode/client": "1.8.20",
|
|
36
|
+
"@abtnode/constant": "1.8.20",
|
|
37
|
+
"@abtnode/core": "1.8.20",
|
|
38
|
+
"@abtnode/cron": "1.8.20",
|
|
39
|
+
"@abtnode/db": "1.8.20",
|
|
40
|
+
"@abtnode/logger": "1.8.20",
|
|
41
|
+
"@abtnode/router-adapter": "1.8.20",
|
|
42
|
+
"@abtnode/router-templates": "1.8.20",
|
|
43
|
+
"@abtnode/util": "1.8.20",
|
|
44
44
|
"@arcblock/did-auth": "1.17.19",
|
|
45
45
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
46
46
|
"@arcblock/event-hub": "1.17.19",
|
|
47
47
|
"@arcblock/jwt": "1.17.19",
|
|
48
48
|
"@arcblock/ws": "1.17.19",
|
|
49
|
-
"@blocklet/meta": "1.8.
|
|
50
|
-
"@blocklet/sdk": "1.8.
|
|
49
|
+
"@blocklet/meta": "1.8.20",
|
|
50
|
+
"@blocklet/sdk": "1.8.20",
|
|
51
51
|
"@did-connect/authenticator": "^2.1.13",
|
|
52
52
|
"@did-connect/relay-adapter-express": "^2.1.13",
|
|
53
53
|
"@did-connect/storage-nedb": "^2.1.13",
|
|
@@ -75,8 +75,12 @@
|
|
|
75
75
|
"serve-static": "^1.15.0",
|
|
76
76
|
"url-join": "^4.0.1"
|
|
77
77
|
},
|
|
78
|
+
"resolutions": {
|
|
79
|
+
"@nedb/core": "^2.0.4",
|
|
80
|
+
"@nedb/multi": "^2.0.4"
|
|
81
|
+
},
|
|
78
82
|
"devDependencies": {
|
|
79
|
-
"@abtnode/ux": "1.8.
|
|
83
|
+
"@abtnode/ux": "1.8.20",
|
|
80
84
|
"@arcblock/did-connect": "^2.4.23",
|
|
81
85
|
"@arcblock/icons": "^2.4.23",
|
|
82
86
|
"@arcblock/ux": "^2.4.23",
|
|
@@ -134,5 +138,5 @@
|
|
|
134
138
|
"url": "https://github.com/ArcBlock/blocklet-server/issues",
|
|
135
139
|
"email": "shijun@arcblock.io"
|
|
136
140
|
},
|
|
137
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "abe47e26c9583bfe5c4969e19cd36574f436a515"
|
|
138
142
|
}
|