-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
217 lines (193 loc) · 4.96 KB
/
server.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
// Dependencies
var Boom = require('boom');
var Joi = require('joi');
var Path = require('path');
var Hapi = require('hapi');
var Vision = require('vision');
var Inert = require('inert');
var got = require('got');
// Template Engine
var Handlerbars = require('handlebars');
var HandlebarsLayouts = require('handlebars-layouts');
HandlebarsLayouts.register(Handlerbars);
// HTTP Server
var server = Hapi.server({
port: 8000,
routes: {
cors: {
credentials: true
}
}
});
// HTTP Server Initialization Configuration
var initialization = async function() {
// Register modules
await server.register(Vision);
await server.register(Inert);
// Setup view rendering
server.views({
engines: {
html: {
module: Handlerbars
}
},
relativeTo: Path.join(__dirname, 'public'),
path: './views',
partialsPath: './views'
});
// Base HTTP route
server.route({
method: 'GET',
path: '/',
handler: function(request, reply)
{
return reply.view('embed-base', {});
}
});
server.route({
method: 'GET',
path: '/api/status',
handler: function(request, reply)
{
return new Promise(function(accept, reject) {
got("http://insight.bithereum.network/insight-api/status").then(function(response) {
accept(response.body);
});
});
}
});
server.route({
method: 'GET',
path: '/bounty/stakes',
handler: function(request, reply)
{
return reply.redirect("https://docs.google.com/spreadsheets/d/11WZwlfSV7YpnGfDm3WWTwH61QfWtL-7cvhybzHtRGMk/edit#gid=722524947");
}
});
server.route({
method: 'GET',
path: '/bounty/check',
handler: function(request, reply)
{
return reply.redirect("https://docs.google.com/spreadsheets/d/1mVNjigrzWPM0Zw2cxMjd0QsR5CE56ti7-H6lqfWpaps/edit?usp=sharing");
}
});
server.route({
method: 'GET',
path: '/bounty/form',
handler: function(request, reply)
{
return reply.redirect("https://docs.google.com/forms/d/e/1FAIpQLSfJkmKF-5SX1dM9Ne57SETBlvhX3OWyJ6dP8mSFkkAFsI1_2Q/viewform?c=0&w=1");
}
});
server.route({
method: 'GET',
path: '/bounty/join',
handler: function(request, reply)
{
return reply.redirect("http://t.me/BithereumBountyBot?start=start");
}
});
server.route({
method: 'GET',
path: '/whitepaper',
handler: function(request, reply)
{
return reply.redirect("/storage/whitepaper.pdf");
}
});
server.route({
method: 'GET',
path: '/redeem/mew',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/how-to-redeem-your-bth-using-myetherwallet-97b6e0a0d250");
}
});
server.route({
method: 'GET',
path: '/redeem/metamask',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/eth-holders-how-to-redeem-your-bth-using-metamask-849c381da87b");
}
});
server.route({
method: 'GET',
path: '/redeem/jaxx',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/eth-holders-how-to-redeem-your-bth-using-jaxx-2dc9e9fec6de");
}
});
server.route({
method: 'GET',
path: '/redeem/ledger',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/eth-holders-how-to-redeem-your-bth-using-ledger-wallet-fb9d706485dd");
}
});
server.route({
method: 'GET',
path: '/redeem/imtoken',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/eth-holders-how-to-redeem-your-bth-using-imtoken-47b984f2cbe");
}
});
server.route({
method: 'GET',
path: '/redeem/trezor',
handler: function(request, reply)
{
return reply.redirect("https://medium.com/@dondrey.taylor/eth-holders-how-to-redeem-your-bth-using-trezor-8de9ec362e82");
}
});
server.route({
method: 'GET',
path: '/mining/form',
handler: function(request, reply)
{
return reply.redirect("https://docs.google.com/forms/d/e/1FAIpQLSfETri1L8RMeq9EWfCYTRIROu68-A1tSbQyVuKP-zbREwNvzQ/viewform");
}
});
server.route({
method: 'GET',
path: '/configurations/pool/mainnet/dc/{number}',
handler: function(request, reply)
{
var content = [
"maxgputemp 85",
"globalminer lolminer",
"stratumproxy enabled",
"proxywallet BDq64SKHij2b4Aiwpjwp72VCEoKeeVXZGP",
"proxypool1 pool.bithereum.network:3857",
"lolminer=flags --profile ETHOS --usercfg /var/run/ethos/lolminer_config.json --overwritePersonal BethdPoW --coin AUTO144_5",
"flags --cl-global-work 8192 --farm-recheck 200",
"globalfan 85"
];
return reply.response(content.join("\n")).header('Content-Type', "text/plain");
}
});
// Handles public file routing
server.route({
method: 'GET',
path: '/{param*}',
handler: {
directory: {
path: 'public',
listing: true
}
}
});
// Attempt to start the HTTP Server
try {
await server.start();
}
catch (err) {
process.exit(1);
}
};
// Initilize HTTP Server
initialization();