@abtnode/router-templates 1.6.14 → 1.6.18
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/404.js +0 -1
- package/lib/502.js +0 -1
- package/lib/5xx.js +1 -2
- package/lib/blocklet-maintenance.js +11 -0
- package/lib/blocklet-not-running.js +3 -3
- package/lib/common.js +55 -61
- package/lib/welcome.js +25 -42
- package/package.json +4 -3
package/lib/404.js
CHANGED
package/lib/502.js
CHANGED
package/lib/5xx.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const getCommonTemplate = require('./common');
|
|
2
|
+
|
|
3
|
+
module.exports = (blocklet, nodeInfo) => {
|
|
4
|
+
return getCommonTemplate({
|
|
5
|
+
status: 'info',
|
|
6
|
+
title: 'Blocklet is under maintenance',
|
|
7
|
+
pageTitle: 'Maintenance - Blocklet Server',
|
|
8
|
+
content: 'Please come back later',
|
|
9
|
+
nodeInfo,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -2,9 +2,9 @@ const getCommonTemplate = require('./common');
|
|
|
2
2
|
|
|
3
3
|
module.exports = (blocklet, nodeInfo) => {
|
|
4
4
|
return getCommonTemplate({
|
|
5
|
-
title: '
|
|
6
|
-
pageTitle: '
|
|
7
|
-
content: '
|
|
5
|
+
title: 'Blocklet is not running',
|
|
6
|
+
pageTitle: 'Error - Blocklet Server',
|
|
7
|
+
content: 'Please come back later',
|
|
8
8
|
nodeInfo,
|
|
9
9
|
});
|
|
10
10
|
};
|
package/lib/common.js
CHANGED
|
@@ -1,64 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
const button = refreshButton
|
|
3
|
-
? '<div>Please click me to <button onclick="javascript:window.location.reload(true)">Refresh</button><div>'
|
|
4
|
-
: '';
|
|
5
|
-
|
|
6
|
-
return `<!DOCTYPE html>
|
|
7
|
-
<html lang="en">
|
|
8
|
-
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="UTF-8">
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
12
|
-
<title>${title} - Blocklet Server</title>
|
|
13
|
-
<style>
|
|
14
|
-
html {
|
|
15
|
-
font-size: 16px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
h1 {
|
|
19
|
-
color: #00c2c4;
|
|
20
|
-
font-size: 3.8rem;
|
|
21
|
-
}
|
|
1
|
+
const { render } = require('@arcblock/result-html-pages');
|
|
22
2
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
background-color: #4E6AF6;
|
|
28
|
-
padding: 8px 22px;
|
|
29
|
-
box-shadow: none;
|
|
30
|
-
text-transform: capitalize;
|
|
31
|
-
border: 0;
|
|
32
|
-
outline: 0;
|
|
33
|
-
cursor: pointer;
|
|
3
|
+
const filterNullOrUndefined = (obj) =>
|
|
4
|
+
Object.keys(obj).reduce((res, key) => {
|
|
5
|
+
if (obj[key] !== undefined && obj[key] !== null) {
|
|
6
|
+
res[key] = obj[key];
|
|
34
7
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
8
|
+
return res;
|
|
9
|
+
}, {});
|
|
10
|
+
|
|
11
|
+
module.exports = ({
|
|
12
|
+
status: inputStatus,
|
|
13
|
+
icon,
|
|
14
|
+
title = '',
|
|
15
|
+
pageTitle = '',
|
|
16
|
+
content = '',
|
|
17
|
+
nodeInfo = {},
|
|
18
|
+
refreshButton = false,
|
|
19
|
+
extra,
|
|
20
|
+
}) => {
|
|
21
|
+
const button = refreshButton
|
|
22
|
+
? `
|
|
23
|
+
<style>
|
|
24
|
+
button {
|
|
25
|
+
font-size: 0.9375rem;
|
|
26
|
+
border-radius: 20px;
|
|
27
|
+
color: #FFFFFF;
|
|
28
|
+
background-color: #4E6AF6;
|
|
29
|
+
padding: 8px 22px;
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
text-transform: capitalize;
|
|
32
|
+
border: 0;
|
|
33
|
+
outline: 0;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
button:hover {
|
|
37
|
+
background-color: rgb(54, 74, 172);
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
40
|
+
<div>Please click me to <button onclick="javascript:window.location.reload(true)">Refresh</button><div>
|
|
41
|
+
`
|
|
42
|
+
: '';
|
|
43
|
+
const hiddenText = `Blocklet Server version: ${nodeInfo.version}, mode: ${nodeInfo.mode}`;
|
|
44
|
+
|
|
45
|
+
const status = inputStatus === undefined ? 'error' : inputStatus;
|
|
46
|
+
|
|
47
|
+
return render(
|
|
48
|
+
filterNullOrUndefined({
|
|
49
|
+
status,
|
|
50
|
+
icon,
|
|
51
|
+
pageTitle,
|
|
52
|
+
title,
|
|
53
|
+
description: content,
|
|
54
|
+
hiddenText,
|
|
55
|
+
extra: extra || button,
|
|
56
|
+
})
|
|
57
|
+
);
|
|
64
58
|
};
|
package/lib/welcome.js
CHANGED
|
@@ -1,42 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<center>
|
|
31
|
-
<h1>Congratulations!</h1>
|
|
32
|
-
<h2>Your Blocklet Server is up and running!</h2>
|
|
33
|
-
<div>
|
|
34
|
-
<a href="/${(nodeInfo.routing.adminPath || '').replace(/^\//, '')}">Node Dashboard</a>
|
|
35
|
-
<a href="https://docs.arcblock.io/en/abtnode/">Documentation</a>
|
|
36
|
-
</div>
|
|
37
|
-
<div style="margin-top: 100px;font-size: 12px;color: #fff;line-height: 1.4;">
|
|
38
|
-
<div>Blocklet Server version: ${nodeInfo.version}, mode: ${nodeInfo.mode}</div>
|
|
39
|
-
</div>
|
|
40
|
-
</center>
|
|
41
|
-
</body>
|
|
42
|
-
</html>`;
|
|
1
|
+
const common = require('./common');
|
|
2
|
+
|
|
3
|
+
module.exports = (nodeInfo = {}) => {
|
|
4
|
+
const adminPath = nodeInfo.routing ? nodeInfo.routing.adminPath : '';
|
|
5
|
+
const extra = `
|
|
6
|
+
<div style="margin-top: 3rem;">
|
|
7
|
+
<a href="/${(adminPath || '').replace(/^\//, '')}" style="color: #47494E; margin-right: 2rem;">Dashboard</a>
|
|
8
|
+
<a href="https://docs.arcblock.io/en/abtnode/" style="color: #47494E;">Document</a>
|
|
9
|
+
</div>
|
|
10
|
+
`;
|
|
11
|
+
return common({
|
|
12
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" style="width: 45px; height: 52px;" viewBox="0 0 45 52">
|
|
13
|
+
<g fill="none" fill-rule="evenodd" stroke="#000">
|
|
14
|
+
<path d="M.5 13.077L22.15.577l21.651 12.5v25l-21.65 12.5L.5 38.077zM22.15.577v50M.5 13.077l43.301 25M.5 38.077l43.301-25"/>
|
|
15
|
+
<path d="M22.15 38.077l10.826-6.25-10.825-18.75-10.825 18.75z"/>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>`,
|
|
18
|
+
pageTitle: 'Welcome - Blocklet Server',
|
|
19
|
+
title: 'Congratulations!',
|
|
20
|
+
content: 'Your Blocklet Server is up and running!',
|
|
21
|
+
status: null,
|
|
22
|
+
nodeInfo,
|
|
23
|
+
extra,
|
|
24
|
+
});
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.18",
|
|
7
7
|
"description": "Provide page templates for ABT Node router",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@
|
|
22
|
+
"@arcblock/result-html-pages": "^1.6.20",
|
|
23
|
+
"@blocklet/meta": "1.6.18"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"jest": "^27.4.5"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "2f02f166869d8ebedc0466068f6ed90ab3e07b87"
|
|
28
29
|
}
|