@abtnode/router-templates 1.5.6
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/README.md +3 -0
- package/lib/404.js +10 -0
- package/lib/502.js +9 -0
- package/lib/5xx.js +4 -0
- package/lib/blocklet-not-running.js +12 -0
- package/lib/common.js +64 -0
- package/lib/index.js +11 -0
- package/package.json +28 -0
package/README.md
ADDED
package/lib/404.js
ADDED
package/lib/502.js
ADDED
package/lib/5xx.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { fromBlockletStatus } = require('@blocklet/meta/lib/constants');
|
|
2
|
+
const getCommonTemplate = require('./common');
|
|
3
|
+
|
|
4
|
+
module.exports = (blocklet, nodeInfo) => {
|
|
5
|
+
const status = fromBlockletStatus(blocklet.status);
|
|
6
|
+
return getCommonTemplate({
|
|
7
|
+
title: status,
|
|
8
|
+
pageTitle: 'Please come back later',
|
|
9
|
+
content: `Blocklet has ${status}.`,
|
|
10
|
+
nodeInfo,
|
|
11
|
+
});
|
|
12
|
+
};
|
package/lib/common.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module.exports = ({ title = '', pageTitle = '', content = '', nodeInfo = {}, refreshButton = true }) => {
|
|
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} - ABT Node</title>
|
|
13
|
+
<style>
|
|
14
|
+
html {
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
h1 {
|
|
19
|
+
color: #00c2c4;
|
|
20
|
+
font-size: 3.8rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
button {
|
|
24
|
+
font-size: 0.9375rem;
|
|
25
|
+
border-radius: 20px;
|
|
26
|
+
color: #FFFFFF;
|
|
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;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
button:hover {
|
|
37
|
+
background-color: rgb(54, 74, 172);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.documentation {
|
|
41
|
+
margin-top: 10px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
|
|
46
|
+
<body>
|
|
47
|
+
<center>
|
|
48
|
+
<h1>${pageTitle}</h1>
|
|
49
|
+
<h2>
|
|
50
|
+
${content}
|
|
51
|
+
</h2>
|
|
52
|
+
${button}
|
|
53
|
+
<div class="documentation">
|
|
54
|
+
Checkout ABT Node Documentation: <a
|
|
55
|
+
href="https://docs.arcblock.io/en/abtnode/">https://docs.arcblock.io/en/abtnode/</a>
|
|
56
|
+
</div>
|
|
57
|
+
<div style="margin-top: 100px;font-size: 12px;color: #fff;line-height: 1.4;">
|
|
58
|
+
<div>ABT Node version: ${nodeInfo.version}, mode: ${nodeInfo.mode}</div>
|
|
59
|
+
</div>
|
|
60
|
+
</center>
|
|
61
|
+
</body>
|
|
62
|
+
|
|
63
|
+
</html>`;
|
|
64
|
+
};
|
package/lib/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@abtnode/router-templates",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "1.5.6",
|
|
7
|
+
"description": "Provide page templates for ABT Node router",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint tests lib",
|
|
14
|
+
"lint:fix": "eslint --fix tests lib",
|
|
15
|
+
"test": "node tools/jest.js",
|
|
16
|
+
"coverage": "npm run test -- --coverage"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@blocklet/meta": "1.5.6"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"jest": "^26.4.2"
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "76046db0352fdd475736c86a225c3928b0954db2"
|
|
28
|
+
}
|