-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
96 lines (89 loc) · 2.61 KB
/
main.js
File metadata and controls
96 lines (89 loc) · 2.61 KB
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
const express = require('express');
const app = express();
const path = require('path');
const router = express.Router();
const readline = require("readline");
const ver = "1.0"
const cmd = "ver - Show Current Version\nexit - Exit The Progrem And Stop Host\ncls - Clear The Screen\nport - Show The Current Port\nurl - Show The URL Of The Site\nautor - Show The Owner Of Tool"
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const dotenv = require('dotenv').config( {
path: path.join(__dirname, '.env')
});
router.get('/',function(req,res){
res.sendFile(path.join(__dirname+'/index.html'));
//res.send('<style>* {font-family: Arial;}</style><title>Error</title><center><h1>Error</h1>Hello, if you are owner of this website then please create index.html file in files folder.<br><b><h3>Why i See This</h3></b>This website does not have a index.html inside files folder. If you are owner of it then code the .html file and move it to files folder with name index<div class="pow"><h5>Powered By HTTP</h5></div></center>')
});
app.use('/', router);
if(process.env.port == null || process.env.port == "") {
app.listen(8080);
}
else
{
app.listen(process.env.port)
}
if(process.env.port == 80) {
console.clear()
console.log("Running at localhost");
}
else
{
console.clear()
console.log('Running at Port ' + process.env.port);
}
if(process.env.port == null || process.env.port == "") {
console.clear()
process.env.port = 8080
console.log('Running at Port 8080');
}
input()
function input() {
const input = rl.question(">", function(put) {
if(put == "ver") {
console.log('HTTP ' + ver)
startinput()
}
if(put == "exit" || put == "quit") {
process.exit(0)
}
if(put == "cls") {
console.clear();
startinput()
}
if(put == "port") {
console.log('Current port is ' + process.env.port)
startinput()
}
if(put == "help") {
console.log(cmd)
startinput()
}
if(put == "hostname" || put == "domain" || put == "href" || put == "url" || put == "adress") {
if(process.env.port == 80) {
console.log('The current hostname is http://localhost')
startinput()
}
else
{
console.log('The current hostname is http://localhost:' + process.env.port)
startinput()
}
if(process.env.port == 443) {
console.log('The current hostname is https://localhost')
startinput()
}
}
if(put == "") {
startinput()
}
if(put == "autor" || put == "developer") {
console.log('This tool was created by Kuba')
startinput()
}
});
}
function startinput() {
input()
}