-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsetup.js
158 lines (140 loc) · 4.26 KB
/
setup.js
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
28
29
30
31
32
33
34
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
const express = require("express");
const router = express.Router();
// setupPhase is "done" if setup is finished, otherwise step in the setup process
router.get("/status", function (req, res) {
console.info(`call to ${req.originalUrl}`);
// FINAL
/* res.status(200).send(
JSON.stringify({
setupPhase: "",
state: "waitfinal",
message: "Node Running",
initialsync: "",
}),
);*/
// SETUP (combine with "setup-start-info" call)
// further these screens will be reached during the setup: FORMAT, INPUT_NODENAME, LIGHTNING, INPUT_A, INPUT_B, INPUT_C, START_DONE
/* res.status(200).send(
JSON.stringify({
setupPhase: "setup",
state: "waitsetup",
message: "Node Running",
initialsync: "",
}),
);*/
// MIGRATION (combine with "setup-start-info" call)
/* res.status(200).send(
JSON.stringify({
setupPhase: "migration",
state: "waitsetup",
message: "Node Running",
initialsync: "",
}),
);*/
// RECOVERY (combine with "setup-start-info" call)
/* res.status(200).send(
JSON.stringify({
setupPhase: "recovery",
state: "waitsetup",
message: "Node Running",
initialsync: "",
}),
);*/
// SYNC
/* res.status(200).send(
JSON.stringify({
setupPhase: "",
state: "ready",
message: "Node Running",
initialsync: "running",
}),
);*/
// WAIT
/* res.status(200).send(
JSON.stringify({
setupPhase: "setup",
state: "wait",
message: "This is a message",
initialsync: "",
}),
);*/
// Dashboard
res.status(200).send(
JSON.stringify({
setupPhase: "done",
state: "waitfinal",
message: "Node Running",
initialsync: "",
}),
);
});
router.get("/setup-start-info", function (req, res) {
console.info(`call to ${req.originalUrl}`);
// set 'setupPhase' something else than "done" to route to setup
// SETUP
res.status(200).send(
JSON.stringify({
setupPhase: "setup",
hddGotBlockchain: "0",
hddGotMigrationData: null,
migrationMode: null,
}),
);
// MIGRATION
/* res.status(200).send(
JSON.stringify({
setupPhase: "migration",
hddGotBlockchain: "1",
hddGotMigrationData: "umbrel",
migrationMode: "normal", // or "outdatedLightning" to get info-text
}),
);*/
// RECOVERY
/* res.status(200).send(
JSON.stringify({
setupPhase: "recovery",
hddGotBlockchain: "0",
hddGotMigrationData: null,
migrationMode: null,
}),
);*/
});
router.post("/setup-start-done", function (req, res) {
console.info(`call to ${req.originalUrl}`);
res.send("STATUS");
});
router.get("/setup-final-info", function (req, res) {
console.info(`call to ${req.originalUrl}`);
res.send(
JSON.stringify({
seedwordsNEW:
"Never, gonna, give, you, up, Never, gonna, let, you, down, Never, gonna, run, around, and, desert, you, Never, gonna, make, you, cry, happy, day",
}),
);
});
router.get("/setup-final-done", function (req, res) {
console.info(`call to ${req.originalUrl}`);
res.send("STATUS");
});
router.get("/shutdown", function (req, res) {
console.info(`call to ${req.originalUrl}`);
res.send("STATUS");
});
router.post("/setup-sync-info", function (req, res) {
console.info(`call to ${req.originalUrl}`);
res.status(200).send(
JSON.stringify({
initialsync: "",
btc_default: "1",
btc_default_ready: "1",
btc_default_sync_percentage: "20",
btc_default_peers: "3",
system_count_start_blockchain: "1",
ln_default: "1",
ln_default_ready: "1",
ln_default_locked: "1",
system_count_start_lightning: "3",
}),
);
});
module.exports = router;