-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
42 lines (34 loc) · 957 Bytes
/
main.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
const { exec } = require('child_process');
const express = require('express')
const path = require('path')
const app = express()
const port = 3000
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static('images'))
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
})
app.post('/get_toilet', function (req, res) {
filter = ""
if (req.body.put_border == "true") {
filter += " --filter border"
}
if (req.body.toilet_color == "Proud") {
filter += " --filter gay"
}
else if (req.body.toilet_color == "Metal") {
filter += " --filter metal"
}
var command = "toilet " + req.body.toilet_text + filter + " --html"
exec(command.toString('utf8'), function (err, stdout, stderr) {
if (err) {
res.send("nope...");
} else {
res.send(stdout);
}
});
})
app.listen(port, '0.0.0.0', () => {
console.log(`Listening on ${port}`)
})