Skip to content

Commit 95d3797

Browse files
committed
v1.1.3
1 parent c3b34c0 commit 95d3797

9 files changed

Lines changed: 211 additions & 11 deletions

File tree

app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,23 @@ const _cliProgress = require('cli-progress');
4545
const {
4646
response
4747
} = require('express');
48-
const version = "v1.1.2-fix";
48+
const version = "v1.1.3";
4949
const ftpd = require("./ftpd.js");
50+
const rateLimit = require('express-rate-limit');
5051
var ftpserver;
5152

5253
app.use(fileUpload());
5354
app.use(cookieParser());
5455

56+
const authLimiter = rateLimit({
57+
windowMs: 5000,
58+
max: 1,
59+
standardHeaders: true,
60+
legacyHeaders: false,
61+
})
62+
63+
app.use('/auth/login', authLimiter);
64+
5565
if (!fs.existsSync("config.json")) {
5666
fs.writeFileSync("config.json", '{"lang":"en", "ftpd":false,"ftpd-user":"kubek","ftpd-password":"kubek","auth":false,"auth-user":"kubek","auth-password":"kubek"}');
5767
}

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"express": "^4.17.1",
1515
"express-file-manager": "^1.1.0",
1616
"express-fileupload": "^1.3.1",
17+
"express-rate-limit": "^6.3.0",
1718
"external-ip": "^2.3.1",
1819
"file-dialog": "0.0.8",
1920
"fmgr-express": "^1.0.1",

translations/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@
5353
"{{auth}}": "Authorization",
5454
"{{signin}}": "Sign in",
5555
"{{signinbtn}}": "Sign in",
56-
"{{autherror}}": "Invalid username or password"
56+
"{{autherror}}": "Invalid username or password",
57+
"{{passgen}}": "Password generator",
58+
"{{passgenDesc}}": "After pressing the Start button, move the mouse across the page to generate a password",
59+
"{{passgenLength}}": "Password length",
60+
"{{passgenNL}}": "Not limited",
61+
"{{passgenYC}}": "Your code is: "
5762
}

translations/ru.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@
5353
"{{auth}}": "Авторизация",
5454
"{{signin}}": "Вход в систему",
5555
"{{signinbtn}}": "Войти",
56-
"{{autherror}}": "Неверный логин или пароль"
56+
"{{autherror}}": "Неверный логин или пароль",
57+
"{{passgen}}": "Генератор паролей",
58+
"{{passgenDesc}}": "После нажатия кнопки Запустить двигайте мышью по странице для генерации пароля",
59+
"{{passgenLength}}": "Длинна пароля",
60+
"{{passgenNL}}": "Не ограничена",
61+
"{{passgenYC}}": "Ваш код: "
5762
}

www/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ <h5 class="modal-title" id="createServerModalLabel">{{creatingserver}}</h5>
120120
<li class="nav-item">
121121
<a class="nav-link" href="/settings.html">{{settings}}</a>
122122
</li>
123+
<li class="nav-item">
124+
<a class="nav-link" href="/passgen-tool.html">{{passgen}}</a>
125+
</li>
123126
</ul>
124127
</div>
125128

www/login.html

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ <h1 class="h3 mb-3 fw-normal">{{signin}}</h1><br>
3030
<input type="password" class="form-control" id="floatingPassword" placeholder="{{password}}">
3131
</div><br>
3232

33-
<center><span id="autherror" style='display: none; color: red; text-align: center;'>{{autherror}}</span></center><br>
33+
<center><span id="autherror" style='display: none; color: red; text-align: center;'>{{autherror}}</span></center>
34+
<br>
3435
<button class="w-100 btn btn-lg btn-primary">{{signinbtn}}</button>
3536
</main>
3637
</body>
@@ -82,13 +83,25 @@ <h1 class="h3 mb-3 fw-normal">{{signin}}</h1><br>
8283
$(".btn").click(function () {
8384
login = $("#floatingInput").val();
8485
password = $("#floatingPassword").val();
85-
$.get("/auth/login?login=" + login + "&password=" + password, function (data) {
86-
if(data == "Wrong credetinals!"){
87-
$("#autherror").show();
88-
} else {
89-
$("#autherror").hide();
90-
window.location = "/";
91-
}
86+
87+
$.ajax("/auth/login?login=" + login + "&password=" + password, {
88+
type: "GET",
89+
statusCode: {
90+
200: function (response) {
91+
console.log(response);
92+
if (response == "Wrong credetinals!") {
93+
$("#autherror").show();
94+
$("#autherror").html("Ошибка авторизации. Неверные данные");
95+
} else {
96+
$("#autherror").hide();
97+
window.location = "/";
98+
}
99+
},
100+
429: function (response) {
101+
$("#autherror").show();
102+
$("#autherror").html("Слишком много запросов, попробуйте повторить через 5 секунд");
103+
}
104+
},
92105
});
93106
});
94107
});

www/passgen-tool.html

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<head>
2+
<meta charset="utf-8">
3+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
4+
<title>Kubek - Minecraft Servers</title>
5+
<link rel="stylesheet" href="css/bootstrap.min.css">
6+
<script src="js/jquery-3.6.0.min.js"></script>
7+
<script src="js/popper.min.js"></script>
8+
<script src="js/bootstrap.min.js"></script>
9+
<link rel="stylesheet" href="css/animate.min.css" />
10+
<script src="js/shards.min.js"></script>
11+
<link rel="stylesheet" type="text/css" href="css/toastify.min.css">
12+
<script type="text/javascript" src="js/toastify-js.js"></script>
13+
<script src="js/app.js"></script>
14+
<link rel="stylesheet" href="css/shards.min.css">
15+
<link rel="stylesheet" href="css/styles.css">
16+
<script src="js/sweetalert2.all.min.js"></script>
17+
<script src="js/progressbar.min.js"></script>
18+
19+
<link rel="preconnect" href="https://fonts.googleapis.com">
20+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
21+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
22+
rel="stylesheet">
23+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
24+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap" rel="stylesheet">
25+
</head>
26+
27+
<body>
28+
<div class="mainLayout">
29+
<div class="menu">
30+
<div class="fc">
31+
<img src="assets/logo.svg" width="200px">
32+
<center>
33+
<p style="margin-top: 4px; width: max-content; height: min-content;" class="kubekVersion"></p>
34+
</center>
35+
36+
<ul class="nav flex-column nav-pills nav-justified">
37+
<li class="nav-item">
38+
<a class="nav-link" href="/">{{servers}}</a>
39+
</li>
40+
<li class="nav-item">
41+
<a class="nav-link" href="/settings.html">{{settings}}</a>
42+
</li>
43+
<li class="nav-item">
44+
<a class="nav-link active" href="/passgen-tool.html">{{passgen}}</a>
45+
</li>
46+
</ul>
47+
</div>
48+
49+
<div class="fc">
50+
51+
</div>
52+
</div>
53+
<div class="layout" style="padding: 16px;">
54+
<p style="font-size: 28pt; font-weight: 700;">{{passgen}}</p>
55+
<p style="font-size: 18pt;">{{passgenDesc}}</p>
56+
<span id="pgl">{{passgenLength}}</span>
57+
<select class="custom-select passlength">
58+
<option value=8>8</option>
59+
<option value=16>16</option>
60+
<option value=24>24</option>
61+
<option value=32>32</option>
62+
<option value=64>64</option>
63+
<option value=128>128</option>
64+
<option value=256>256</option>
65+
<option value=512>512</option>
66+
<option value=4096>{{passgenNL}}</option>
67+
</select>
68+
<button class="btn btn-primary btn-lg" style="margin-top: 8px;">{{start}}</button>
69+
<progress min=0 max=100 value=0 style="display: none;"></progress>
70+
</div>
71+
</div>
72+
</body>
73+
74+
<script>
75+
var mx = getRandomInt(2000);
76+
var my = getRandomInt(2000);
77+
var code = "";
78+
var maxcodelength;
79+
var specialSymbols = ["*", "&", "_", "-", "#", "$", "@", "?", "."];
80+
81+
function getRandomInt(max) {
82+
return Math.floor(Math.random() * max);
83+
}
84+
85+
String.prototype.replaceAt = function (index, replacement) {
86+
return this.substr(0, index) + replacement + this.substr(index + replacement.length);
87+
}
88+
89+
$(document).ready(function () {
90+
$(".kubekVersion").load("/kubek/version");
91+
$(".btn").click(function () {
92+
maxcodelength = $(".passlength option:selected").val();
93+
$("progress").show();
94+
$(".passlength").hide();
95+
$(".btn").hide();
96+
$("#pgl").hide();
97+
var imint = setInterval(function () {
98+
if ($("progress").val() == 100) {
99+
basecode = btoa(code).substr(0, maxcodelength);
100+
for (var i = 0; i < basecode.length; i++) {
101+
rnd = getRandomInt(20);
102+
if (rnd <= 2) {
103+
basecode = basecode.replaceAt(i, specialSymbols[getRandomInt(specialSymbols.length)]);
104+
}
105+
}
106+
$("progress").hide();
107+
$(".layout").append(
108+
'<span style="font-size: 16pt; font-weight: 500;">{{passgenYC}}</span>'
109+
);
110+
$(".layout").append("<textarea style='width: 100%;' autofocus readonly wrap='hard'>" + basecode + "</textarea>");
111+
clearInterval(imint);
112+
} else {
113+
if (Math.random() == 0) {
114+
code = code + my + getRandomInt(2593) + mx;
115+
} else {
116+
code = code + mx + getRandomInt(1414) + my;
117+
}
118+
$("progress").val($("progress").val() + 1);
119+
}
120+
}, 50);
121+
});
122+
123+
$(document).mousemove(function (event) {
124+
mx = event.pageX;
125+
my = event.pageY;
126+
});
127+
});
128+
</script>
129+
130+
<style>
131+
select, textarea {
132+
background: rgb(43, 53, 63) !important;
133+
border: none !important;
134+
outline: none !important;
135+
color: white !important;
136+
}
137+
138+
textarea {
139+
border-radius: 4px;
140+
height: 50%;
141+
}
142+
</style>

www/settings.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
<li class="nav-item">
4141
<a class="nav-link active" href="/settings.html">{{settings}}</a>
4242
</li>
43+
<li class="nav-item">
44+
<a class="nav-link" href="/passgen-tool.html">{{passgen}}</a>
45+
</li>
4346
</ul>
4447
</div>
4548

0 commit comments

Comments
 (0)