create-blocklet 0.9.9 → 0.9.11
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/package.json +1 -1
- package/templates/did-connect-dapp/api/routes/auth/request-digest-signature.js +9 -7
- package/templates/did-connect-dapp/api/routes/auth/request-multiple-claims.js +22 -20
- package/templates/did-connect-dapp/api/routes/auth/request-multiple-steps.js +19 -17
- package/templates/did-connect-dapp/api/routes/auth/request-nft.js +17 -15
- package/templates/did-connect-dapp/api/routes/auth/request-payment.js +23 -21
- package/templates/did-connect-dapp/api/routes/auth/request-profile.js +7 -5
- package/templates/did-connect-dapp/api/routes/auth/request-text-signature.js +11 -9
- package/templates/did-connect-dapp/api/routes/auth/request-transaction-signature.js +29 -27
- package/templates/did-connect-dapp/package.json +4 -3
- package/templates/did-wallet-dapp/api/routes/user.js +2 -2
- package/templates/did-wallet-dapp/package.json +3 -3
- package/templates/express-api/package.json +1 -1
- package/templates/html-static/package.json +1 -1
- package/templates/monorepo/package.json +1 -1
- package/templates/nestjs-api/package.json +1 -1
- package/templates/nextjs-dapp/api/routes/index.js +2 -2
- package/templates/nextjs-dapp/package.json +1 -1
- package/templates/react-dapp/api/routes/index.js +2 -2
- package/templates/react-dapp/package.json +3 -3
- package/templates/react-dapp-ts/api/src/routes/index.ts +2 -2
- package/templates/react-dapp-ts/package.json +3 -3
- package/templates/react-gun-dapp/api/routes/index.js +2 -2
- package/templates/react-gun-dapp/package.json +3 -3
- package/templates/react-static/package.json +3 -3
- package/templates/solidjs-dapp/api/routes/index.js +2 -2
- package/templates/solidjs-dapp/package.json +2 -2
- package/templates/solidjs-static/package.json +2 -2
- package/templates/svelte-dapp/api/routes/index.js +2 -2
- package/templates/svelte-dapp/package.json +2 -2
- package/templates/svelte-static/package.json +2 -2
- package/templates/todo-list-example/api/src/routes/index.ts +3 -3
- package/templates/todo-list-example/api/src/routes/todo-list/index.ts +3 -3
- package/templates/todo-list-example/package.json +3 -3
- package/templates/vue-dapp/api/routes/index.js +2 -2
- package/templates/vue-dapp/package.json +2 -2
- package/templates/vue-static/package.json +2 -2
- package/templates/vue-ts-static/package.json +2 -2
- package/templates/vue2-dapp/api/routes/index.js +2 -2
- package/templates/vue2-dapp/package.json +2 -2
- package/templates/vue2-static/package.json +2 -2
package/package.json
CHANGED
|
@@ -12,13 +12,15 @@ const action = 'request-digest-signature';
|
|
|
12
12
|
|
|
13
13
|
module.exports = {
|
|
14
14
|
action,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
onConnect() {
|
|
16
|
+
return {
|
|
17
|
+
signature: () => {
|
|
18
|
+
return {
|
|
19
|
+
description: 'Please sign the digest',
|
|
20
|
+
digest: toBase58(hasher(data, 1)),
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -11,26 +11,28 @@ const action = 'request-multiple-claims';
|
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
action,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
onConnect() {
|
|
15
|
+
return {
|
|
16
|
+
signText: [
|
|
17
|
+
'signature',
|
|
18
|
+
() => {
|
|
19
|
+
return {
|
|
20
|
+
type: 'mime:text/plain',
|
|
21
|
+
data: getRandomMessage(),
|
|
22
|
+
description: 'Please sign the text',
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
signDigest: [
|
|
27
|
+
'signature',
|
|
28
|
+
() => {
|
|
29
|
+
return {
|
|
30
|
+
description: 'Please sign the digest',
|
|
31
|
+
digest: toBase58(hasher(data, 1)),
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
34
36
|
},
|
|
35
37
|
|
|
36
38
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -11,25 +11,27 @@ const action = 'request-multiple-steps';
|
|
|
11
11
|
|
|
12
12
|
module.exports = {
|
|
13
13
|
action,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
onConnect() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
signature: () => {
|
|
18
|
+
return {
|
|
19
|
+
type: 'mime:text/plain',
|
|
20
|
+
data: getRandomMessage(),
|
|
21
|
+
description: 'Please sign the text',
|
|
22
|
+
};
|
|
23
|
+
},
|
|
22
24
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
{
|
|
26
|
+
signature: () => {
|
|
27
|
+
return {
|
|
28
|
+
description: 'Please sign the digest',
|
|
29
|
+
digest: toBase58(hasher(data, 1)),
|
|
30
|
+
};
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
];
|
|
34
|
+
},
|
|
33
35
|
|
|
34
36
|
onAuth: ({ userDid, userPk, claims, step, req, updateSession }) => {
|
|
35
37
|
logger.info(`${action}.onAuth`, { step, userPk, userDid, claims });
|
|
@@ -46,21 +46,23 @@ const action = 'request-nft';
|
|
|
46
46
|
|
|
47
47
|
module.exports = {
|
|
48
48
|
action,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
onConnect() {
|
|
50
|
+
return {
|
|
51
|
+
assetOrVC: () => {
|
|
52
|
+
return {
|
|
53
|
+
description: 'Please provide NFT or VC to continue',
|
|
54
|
+
filters: [
|
|
55
|
+
{
|
|
56
|
+
type: ['NFTBadge', 'NFTCertificate'],
|
|
57
|
+
trustedIssuers: [
|
|
58
|
+
// wallet.address,
|
|
59
|
+
'zNKXAEjKYXEnf2hf18NjTQsa1JajA9gJ3haY',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
};
|
|
64
66
|
},
|
|
65
67
|
onAuth: async ({ claims, challenge, updateSession }) => {
|
|
66
68
|
const asset = claims.find((x) => x.type === 'asset');
|
|
@@ -10,29 +10,31 @@ const logger = require('../../libs/logger');
|
|
|
10
10
|
const action = 'request-payment';
|
|
11
11
|
module.exports = {
|
|
12
12
|
action,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
onConnect() {
|
|
14
|
+
return {
|
|
15
|
+
signature: async ({ userDid, userPk }) => {
|
|
16
|
+
const amount = 1;
|
|
17
|
+
const token = await getTokenInfo();
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
return {
|
|
20
|
+
type: 'TransferV2Tx',
|
|
21
|
+
data: {
|
|
22
|
+
from: userDid,
|
|
23
|
+
pk: userPk,
|
|
24
|
+
itx: {
|
|
25
|
+
to: wallet.address,
|
|
26
|
+
tokens: [
|
|
27
|
+
{
|
|
28
|
+
address: env.localTokenId,
|
|
29
|
+
value: fromTokenToUnit(amount, token.decimal).toString(),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
34
|
+
description: `Please pay ${amount} ${token.symbol} to application`,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
36
38
|
},
|
|
37
39
|
onAuth: async ({ req, claims, userDid, updateSession }) => {
|
|
38
40
|
try {
|
|
@@ -4,11 +4,13 @@ const logger = require('../../libs/logger');
|
|
|
4
4
|
const action = 'request-profile';
|
|
5
5
|
module.exports = {
|
|
6
6
|
action,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
onConnect() {
|
|
8
|
+
return {
|
|
9
|
+
profile: () => ({
|
|
10
|
+
description: 'Please provide your full profile',
|
|
11
|
+
fields: ['fullName', 'email', 'phone', 'signature', 'avatar', 'birthday'],
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
12
14
|
},
|
|
13
15
|
|
|
14
16
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -9,16 +9,18 @@ const { getRandomMessage } = require('../../libs/utils');
|
|
|
9
9
|
const action = 'request-text-signature';
|
|
10
10
|
module.exports = {
|
|
11
11
|
action,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onConnect() {
|
|
13
|
+
return {
|
|
14
|
+
signature: () => {
|
|
15
|
+
const data = getRandomMessage();
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return {
|
|
18
|
+
description: 'Please sign the text',
|
|
19
|
+
type: 'mime:text/plain',
|
|
20
|
+
data,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -12,34 +12,36 @@ const action = 'request-transaction-signature';
|
|
|
12
12
|
|
|
13
13
|
module.exports = {
|
|
14
14
|
action,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
onConnect() {
|
|
16
|
+
return {
|
|
17
|
+
signature: async ({ userPk, userDid }) => {
|
|
18
|
+
const value = await client.fromTokenToUnit(1);
|
|
19
|
+
const type = toTypeInfo(userDid);
|
|
20
|
+
|
|
21
|
+
const encoded = await client.encodeTransferV2Tx({
|
|
22
|
+
tx: {
|
|
23
|
+
itx: {
|
|
24
|
+
to: wallet.address,
|
|
25
|
+
tokens: [
|
|
26
|
+
{
|
|
27
|
+
address: env.localTokenId,
|
|
28
|
+
value: value.toString(),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
33
|
+
wallet: fromPublicKey(userPk, type),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const origin = toBase58(encoded.buffer);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
description: 'Please sign the transaction',
|
|
40
|
+
type: 'fg:t:transaction',
|
|
41
|
+
data: origin,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
};
|
|
43
45
|
},
|
|
44
46
|
|
|
45
47
|
onAuth: ({ userDid, userPk, claims, updateSession }) => {
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@iconify/react": "^5.0.2",
|
|
64
64
|
"@mui/material": "^5.16.7",
|
|
65
65
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
66
|
-
"@vitejs/plugin-react": "^4.3.
|
|
67
|
-
"bumpp": "^9.
|
|
66
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
67
|
+
"bumpp": "^9.6.1",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
69
|
"eslint": "^8.57.1",
|
|
70
70
|
"flat": "^6.0.1",
|
|
@@ -75,8 +75,9 @@
|
|
|
75
75
|
"react": "~18.2.0",
|
|
76
76
|
"react-dom": "~18.2.0",
|
|
77
77
|
"rimraf": "^5.0.10",
|
|
78
|
+
"simple-git-hooks": "^2.11.1",
|
|
78
79
|
"vite": "^5.4.8",
|
|
79
|
-
"vite-plugin-blocklet": "^0.9.
|
|
80
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
80
81
|
"vite-plugin-svgr": "^4.2.0",
|
|
81
82
|
"zx": "^8.1.8"
|
|
82
83
|
},
|
|
@@ -5,8 +5,8 @@ const authClient = new AuthService();
|
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
init(app) {
|
|
8
|
-
//
|
|
9
|
-
app.get('/api/user', middlewares.
|
|
8
|
+
// middlewares.session() is used to get the user info from the session, see more: https://www.arcblock.io/docs/blocklet-developer/blocklet-sdk#session
|
|
9
|
+
app.get('/api/user', middlewares.session(), async (req, res) => {
|
|
10
10
|
if (!req.user) {
|
|
11
11
|
res.json({ user: null });
|
|
12
12
|
return;
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@emotion/styled": "^11.13.0",
|
|
40
40
|
"@mui/icons-material": "^5.16.7",
|
|
41
41
|
"@mui/material": "^5.16.7",
|
|
42
|
-
"@vitejs/plugin-react": "^4.3.
|
|
43
|
-
"bumpp": "^9.
|
|
42
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
43
|
+
"bumpp": "^9.6.1",
|
|
44
44
|
"dayjs": "^1.11.13",
|
|
45
45
|
"dotenv-flow": "^4.1.0",
|
|
46
46
|
"flat": "^6.0.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"simple-git-hooks": "^2.11.1",
|
|
53
53
|
"vite": "^5.4.8",
|
|
54
54
|
"vite-node": "^2.1.1",
|
|
55
|
-
"vite-plugin-blocklet": "^0.9.
|
|
55
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
56
56
|
"vite-plugin-require": "^1.2.14",
|
|
57
57
|
"vite-plugin-svgr": "^4.2.0",
|
|
58
58
|
"zx": "^8.1.8"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewaress');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
router.use('/data', (req, res) =>
|
|
7
7
|
res.json({
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@arcblock/eslint-config": "^0.3.2",
|
|
58
58
|
"@blocklet/js-sdk": "^1.16.32",
|
|
59
59
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
60
|
-
"@vitejs/plugin-react": "^4.3.
|
|
61
|
-
"bumpp": "^9.
|
|
60
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
61
|
+
"bumpp": "^9.6.1",
|
|
62
62
|
"cross-env": "^7.0.3",
|
|
63
63
|
"eslint": "^8.57.1",
|
|
64
64
|
"lint-staged": "^15.2.10",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"rimraf": "^5.0.10",
|
|
72
72
|
"simple-git-hooks": "^2.11.1",
|
|
73
73
|
"vite": "^5.4.8",
|
|
74
|
-
"vite-plugin-blocklet": "^0.9.
|
|
74
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
75
75
|
"vite-plugin-svgr": "^4.2.0",
|
|
76
76
|
"zx": "^8.1.8"
|
|
77
77
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import middlewares from '@blocklet/sdk/lib/middlewares';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
|
|
4
4
|
const router = Router();
|
|
5
5
|
|
|
6
|
-
router.use('/user',
|
|
6
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
7
7
|
|
|
8
8
|
router.use('/data', (_, res) =>
|
|
9
9
|
res.json({
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@types/node": "^20.16.10",
|
|
64
64
|
"@types/react": "^18.3.10",
|
|
65
65
|
"@types/react-dom": "^18.3.0",
|
|
66
|
-
"@vitejs/plugin-react": "^4.3.
|
|
67
|
-
"bumpp": "^9.
|
|
66
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
67
|
+
"bumpp": "^9.6.1",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
69
|
"eslint": "^8.57.1",
|
|
70
70
|
"import-sort-style-module": "^6.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"ts-node": "^10.9.2",
|
|
82
82
|
"typescript": "^5.6.2",
|
|
83
83
|
"vite": "^5.4.8",
|
|
84
|
-
"vite-plugin-blocklet": "^0.9.
|
|
84
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
85
85
|
"vite-plugin-svgr": "^4.2.0",
|
|
86
86
|
"zx": "^8.1.8"
|
|
87
87
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewaress');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@arcblock/eslint-config": "^0.3.2",
|
|
59
59
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
60
|
-
"@vitejs/plugin-react": "^4.3.
|
|
61
|
-
"bumpp": "^9.
|
|
60
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
61
|
+
"bumpp": "^9.6.1",
|
|
62
62
|
"cross-env": "^7.0.3",
|
|
63
63
|
"eslint": "^8.57.1",
|
|
64
64
|
"lint-staged": "^15.2.10",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"rimraf": "^5.0.10",
|
|
72
72
|
"simple-git-hooks": "^2.11.1",
|
|
73
73
|
"vite": "^5.4.8",
|
|
74
|
-
"vite-plugin-blocklet": "^0.9.
|
|
74
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
75
75
|
"vite-plugin-svgr": "^4.2.0",
|
|
76
76
|
"zx": "^8.1.8"
|
|
77
77
|
},
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@arcblock/eslint-config": "^0.3.2",
|
|
43
43
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
44
|
-
"@vitejs/plugin-react": "^4.3.
|
|
45
|
-
"bumpp": "^9.
|
|
44
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
45
|
+
"bumpp": "^9.6.1",
|
|
46
46
|
"eslint": "^8.57.1",
|
|
47
47
|
"lint-staged": "^15.2.10",
|
|
48
48
|
"prettier": "^3.3.3",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"rimraf": "^5.0.10",
|
|
53
53
|
"simple-git-hooks": "^2.11.1",
|
|
54
54
|
"vite": "^5.4.8",
|
|
55
|
-
"vite-plugin-blocklet": "^0.9.
|
|
55
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
56
56
|
"vite-plugin-svgr": "^4.2.0",
|
|
57
57
|
"zx": "^8.1.8"
|
|
58
58
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
router.use('/data', (req, res) =>
|
|
7
7
|
res.json({
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@blocklet/js-sdk": "^1.16.32",
|
|
25
25
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
26
|
-
"bumpp": "^9.
|
|
26
|
+
"bumpp": "^9.6.1",
|
|
27
27
|
"cross-env": "^7.0.3",
|
|
28
28
|
"eslint": "^8.57.1",
|
|
29
29
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"rimraf": "^5.0.10",
|
|
37
37
|
"simple-git-hooks": "^2.11.1",
|
|
38
38
|
"vite": "^5.4.8",
|
|
39
|
-
"vite-plugin-blocklet": "^0.9.
|
|
39
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
40
40
|
"vite-plugin-solid": "^2.10.2",
|
|
41
41
|
"zx": "^8.1.8"
|
|
42
42
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
24
|
-
"bumpp": "^9.
|
|
24
|
+
"bumpp": "^9.6.1",
|
|
25
25
|
"eslint": "^8.57.1",
|
|
26
26
|
"eslint-config-prettier": "^9.1.0",
|
|
27
27
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"simple-git-hooks": "^2.11.1",
|
|
33
33
|
"solid-js": "^1.9.1",
|
|
34
34
|
"vite": "^5.4.8",
|
|
35
|
-
"vite-plugin-blocklet": "^0.9.
|
|
35
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
36
36
|
"vite-plugin-solid": "^2.10.2",
|
|
37
37
|
"zx": "^8.1.8"
|
|
38
38
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
router.use('/data', (req, res) =>
|
|
7
7
|
res.json({
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@blocklet/js-sdk": "^1.16.32",
|
|
35
35
|
"@sveltejs/vite-plugin-svelte": "3.1.1",
|
|
36
36
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
37
|
-
"bumpp": "^9.
|
|
37
|
+
"bumpp": "^9.6.1",
|
|
38
38
|
"cross-env": "^7.0.3",
|
|
39
39
|
"lint-staged": "^15.2.10",
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"simple-git-hooks": "^2.11.1",
|
|
45
45
|
"svelte": "^4.2.19",
|
|
46
46
|
"vite": "^5.4.8",
|
|
47
|
-
"vite-plugin-blocklet": "^0.9.
|
|
47
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
48
48
|
"zx": "^8.1.8"
|
|
49
49
|
},
|
|
50
50
|
"lint-staged": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
20
|
-
"bumpp": "^9.
|
|
20
|
+
"bumpp": "^9.6.1",
|
|
21
21
|
"lint-staged": "^15.2.10",
|
|
22
22
|
"prettier": "^3.3.3",
|
|
23
23
|
"prettier-plugin-svelte": "^3.2.7",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"simple-git-hooks": "^2.11.1",
|
|
26
26
|
"svelte": "^4.2.19",
|
|
27
27
|
"vite": "^5.4.8",
|
|
28
|
-
"vite-plugin-blocklet": "^0.9.
|
|
28
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
29
29
|
"zx": "^8.1.8"
|
|
30
30
|
},
|
|
31
31
|
"lint-staged": {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import middlewares from '@blocklet/sdk/lib/middlewares';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
|
|
4
4
|
import todoListRouter from './todo-list';
|
|
5
5
|
|
|
6
6
|
const router = Router();
|
|
7
7
|
|
|
8
|
-
router.use('/user',
|
|
9
|
-
router.use('/todo-list',
|
|
8
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
9
|
+
router.use('/todo-list', middlewares.session(), todoListRouter);
|
|
10
10
|
|
|
11
11
|
export default router;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import middlewares from '@blocklet/sdk/lib/middlewares';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
|
|
4
4
|
import $get from './$get';
|
|
@@ -7,7 +7,7 @@ import $put from './$put';
|
|
|
7
7
|
const todoListRouter = Router();
|
|
8
8
|
|
|
9
9
|
// Step 2: the function of reading and writing DID Space is implemented
|
|
10
|
-
todoListRouter.get('/',
|
|
11
|
-
todoListRouter.put('/',
|
|
10
|
+
todoListRouter.get('/', middlewares.session(), $get);
|
|
11
|
+
todoListRouter.put('/', middlewares.session(), $put);
|
|
12
12
|
|
|
13
13
|
export default todoListRouter;
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@types/react": "^18.3.10",
|
|
77
77
|
"@types/react-dom": "^18.3.0",
|
|
78
78
|
"@types/react-toastify": "^4.1.0",
|
|
79
|
-
"@vitejs/plugin-react": "^4.3.
|
|
80
|
-
"bumpp": "^9.
|
|
79
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
80
|
+
"bumpp": "^9.6.1",
|
|
81
81
|
"cross-env": "^7.0.3",
|
|
82
82
|
"eslint": "^8.57.1",
|
|
83
83
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"ts-node": "^10.9.2",
|
|
97
97
|
"typescript": "^5.6.2",
|
|
98
98
|
"vite": "^5.4.8",
|
|
99
|
-
"vite-plugin-blocklet": "^0.9.
|
|
99
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
100
100
|
"vite-plugin-svgr": "^4.2.0",
|
|
101
101
|
"zx": "^8.1.8"
|
|
102
102
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
router.use('/data', (req, res) =>
|
|
7
7
|
res.json({
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@blocklet/js-sdk": "^1.16.32",
|
|
37
37
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
38
38
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
39
|
-
"bumpp": "^9.
|
|
39
|
+
"bumpp": "^9.6.1",
|
|
40
40
|
"cross-env": "^7.0.3",
|
|
41
41
|
"eslint": "^8.57.1",
|
|
42
42
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"rimraf": "^5.0.10",
|
|
50
50
|
"simple-git-hooks": "^2.11.1",
|
|
51
51
|
"vite": "^5.4.8",
|
|
52
|
-
"vite-plugin-blocklet": "^0.9.
|
|
52
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
53
53
|
"vue": "^3.5.10",
|
|
54
54
|
"zx": "^8.1.8"
|
|
55
55
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
22
22
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
23
|
-
"bumpp": "^9.
|
|
23
|
+
"bumpp": "^9.6.1",
|
|
24
24
|
"eslint": "^8.57.1",
|
|
25
25
|
"eslint-config-prettier": "^9.1.0",
|
|
26
26
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"rimraf": "^5.0.10",
|
|
31
31
|
"simple-git-hooks": "^2.11.1",
|
|
32
32
|
"vite": "^5.4.8",
|
|
33
|
-
"vite-plugin-blocklet": "^0.9.
|
|
33
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
34
34
|
"vue": "^3.5.10",
|
|
35
35
|
"zx": "^8.1.8"
|
|
36
36
|
},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@antfu/eslint-config": "^2.27.3",
|
|
31
31
|
"@blocklet/cli": "^1.16.32",
|
|
32
32
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
33
|
-
"bumpp": "^9.
|
|
33
|
+
"bumpp": "^9.6.1",
|
|
34
34
|
"eslint": "9.5.0",
|
|
35
35
|
"eslint-plugin-format": "^0.1.2",
|
|
36
36
|
"lint-staged": "^15.2.10",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"taze": "^0.16.9",
|
|
40
40
|
"typescript": "^5.6.2",
|
|
41
41
|
"vite": "^5.4.8",
|
|
42
|
-
"vite-plugin-blocklet": "^0.9.
|
|
42
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
43
43
|
"vue-tsc": "^2.1.6",
|
|
44
44
|
"zx": "^8.1.8"
|
|
45
45
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const middlewares = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user',
|
|
4
|
+
router.use('/user', middlewares.session(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
37
37
|
"@vitejs/plugin-vue2": "^2.3.1",
|
|
38
|
-
"bumpp": "^9.
|
|
38
|
+
"bumpp": "^9.6.1",
|
|
39
39
|
"cross-env": "^7.0.3",
|
|
40
40
|
"eslint": "^8.57.1",
|
|
41
41
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"rimraf": "^5.0.10",
|
|
49
49
|
"simple-git-hooks": "^2.11.1",
|
|
50
50
|
"vite": "^5.4.8",
|
|
51
|
-
"vite-plugin-blocklet": "^0.9.
|
|
51
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
52
52
|
"vue": "^2.7.16",
|
|
53
53
|
"zx": "^8.1.8"
|
|
54
54
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
22
22
|
"@vitejs/plugin-vue2": "^2.3.1",
|
|
23
|
-
"bumpp": "^9.
|
|
23
|
+
"bumpp": "^9.6.1",
|
|
24
24
|
"eslint": "^8.57.1",
|
|
25
25
|
"eslint-config-prettier": "^9.1.0",
|
|
26
26
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"rimraf": "^5.0.10",
|
|
31
31
|
"simple-git-hooks": "^2.11.1",
|
|
32
32
|
"vite": "^5.4.8",
|
|
33
|
-
"vite-plugin-blocklet": "^0.9.
|
|
33
|
+
"vite-plugin-blocklet": "^0.9.11",
|
|
34
34
|
"vue": "^2.7.16",
|
|
35
35
|
"zx": "^8.1.8"
|
|
36
36
|
},
|