Skip to content

Commit 4a2591c

Browse files
committed
1.2.10
1 parent 803066b commit 4a2591c

5 files changed

Lines changed: 150 additions & 13 deletions

File tree

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const {
6262
} = require('express');
6363

6464
// Kubek version
65-
const version = "v1.2.9";
65+
const version = "v1.2.10";
6666

6767
const rateLimit = require('express-rate-limit');
6868
const authLimiter = rateLimit({

my_modules/servers.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ exports.saveStartScript = (name, script) => {
4444
}
4545

4646
exports.getServerProperties = (name) => {
47-
data = fs.readFileSync("./servers/" + name + "/server.properties");
48-
return spParser.parse(data.toString());
47+
if(typeof name !== "undefined" && fs.existsSync("./servers/" + name + "/server.properties")){
48+
data = fs.readFileSync("./servers/" + name + "/server.properties");
49+
return spParser.parse(data.toString());
50+
} else{
51+
return false;
52+
}
4953
}
5054

5155
exports.saveServerProperties = (name, doc) => {

www/console.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<script src="js/socket.io.min.js"></script>
1616
<script src="js/toastify-js.js"></script>
1717
<script src="js/sweetalert2.all.min.js"></script>
18+
<script src="js/MinecraftColorCodes.min.3.7.js"></script>
1819

1920
<!-- Own -->
2021
<link rel="stylesheet" href="css/globals.css" />
@@ -72,6 +73,7 @@
7273

7374
<script>
7475
var socket;
76+
var vv;
7577
$(document).ready(function () {
7678
loadTemplate(function () {
7779
// wait
@@ -94,16 +96,14 @@
9496
if (data.server == currentServer && $("#update-console-checkbox").is(":checked")) {
9597
split = data.data.split(/\r?\n/);
9698
$(".console").html("");
99+
97100
split.forEach(function (line) {
98-
if (line.search("ERROR") != -1) {
99-
$(".console").append("<span style='background: rgba(249, 49, 84, 0.1); color: #F93154;'>" +
100-
line + "</span><br>");
101-
} else if (line.search("WARN") != -1) {
102-
$(".console").append("<span style='background: rgba(255, 169, 0, 0.1); color: #FFA900;'>" +
103-
line + "</span><br>");
104-
} else {
105-
$(".console").append("<span>" + line + "</span><br>");
106-
}
101+
ln = "";
102+
$(line.replaceColorCodes()).children().each(function () {
103+
ln = ln + this.outerHTML;
104+
});
105+
line = ln;
106+
$(".console").append(line + "<br>");
107107
});
108108
if ($("#autoscroll-checkbox").is(":checked")) {
109109
$(".console").scrollTop($(".console")[0].scrollHeight);

www/file-manager.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,16 @@ <h5 class="modal-title" id="feModalLabel">Modal title</h5>
213213
data.forEach(function (file) {
214214
size = 0;
215215
if (file.size < 1024 * 1024) {
216-
size = file.size * 1024 + " Kb";
216+
size = Math.round(file.size / 1024 * 10) / 10 + " Kb";
217217
}
218218
if (file.size < 1024) {
219219
size = file.size + " B";
220220
}
221221
if (file.size >= 1024 * 1024) {
222222
size = Math.round(file.size / 1024 / 1024 * 10) / 10 + " Mb";
223+
}
224+
if (file.size >= 1024 * 1024 * 1024) {
225+
size = Math.round(file.size / 1024 / 1024 / 1024 * 10) / 10 + " Gb";
223226
}
224227
if (file.type == "directory") {
225228
act =
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
2+
var obfuscators = [];
3+
var styleMap = {
4+
'§4': 'font-weight:normal;text-decoration:none;color:#be0000',
5+
'§c': 'font-weight:normal;text-decoration:none;color:#fe3f3f',
6+
'§6': 'font-weight:normal;text-decoration:none;color:#d9a334',
7+
'§e': 'font-weight:normal;text-decoration:none;color:#fefe3f',
8+
'§2': 'font-weight:normal;text-decoration:none;color:#00be00',
9+
'§a': 'font-weight:normal;text-decoration:none;color:#3ffe3f',
10+
'§b': 'font-weight:normal;text-decoration:none;color:#3ffefe',
11+
'§3': 'font-weight:normal;text-decoration:none;color:#00bebe',
12+
'§1': 'font-weight:normal;text-decoration:none;color:#0000be',
13+
'§9': 'font-weight:normal;text-decoration:none;color:#3f3ffe',
14+
'§d': 'font-weight:normal;text-decoration:none;color:#fe3ffe',
15+
'§5': 'font-weight:normal;text-decoration:none;color:#be00be',
16+
'§f': 'font-weight:normal;text-decoration:none;color:#ffffff',
17+
'§7': 'font-weight:normal;text-decoration:none;color:#bebebe',
18+
'§8': 'font-weight:normal;text-decoration:none;color:#3f3f3f',
19+
'§0': 'font-weight:normal;text-decoration:none;color:#000000',
20+
'§l': 'font-weight:bold',
21+
'§n': 'text-decoration:underline;text-decoration-skip:spaces',
22+
'§o': 'font-style:italic',
23+
'§m': 'text-decoration:line-through;text-decoration-skip:spaces',
24+
};
25+
function obfuscate(string, elem) {
26+
var magicSpan,
27+
currNode,
28+
len = elem.childNodes.length;
29+
if(string.indexOf('<br>') > -1) {
30+
elem.innerHTML = string;
31+
for(var j = 0; j < len; j++) {
32+
currNode = elem.childNodes[j];
33+
if(currNode.nodeType === 3) {
34+
magicSpan = document.createElement('span');
35+
magicSpan.innerHTML = currNode.nodeValue;
36+
elem.replaceChild(magicSpan, currNode);
37+
init(magicSpan);
38+
}
39+
}
40+
} else {
41+
init(elem, string);
42+
}
43+
function init(el, str) {
44+
var i = 0,
45+
obsStr = str || el.innerHTML,
46+
len = obsStr.length;
47+
obfuscators.push( window.setInterval(function () {
48+
if(i >= len) i = 0;
49+
obsStr = replaceRand(obsStr, i);
50+
el.innerHTML = obsStr;
51+
i++;
52+
}, 0) );
53+
}
54+
function randInt(min, max) {
55+
return Math.floor( Math.random() * (max - min + 1) ) + min;
56+
}
57+
function replaceRand(string, i) {
58+
var randChar = String.fromCharCode( randInt(64,90) ); /*Numbers: 48-57 Al:64-90*/
59+
return string.substr(0, i) + randChar + string.substr(i + 1, string.length);
60+
}
61+
}
62+
function applyCode(string, codes) {
63+
var len = codes.length;
64+
var elem = document.createElement('span'),
65+
obfuscated = false;
66+
for(var i = 0; i < len; i++) {
67+
elem.style.cssText += styleMap[codes[i]] + ';';
68+
if(codes[i] === '§k') {
69+
obfuscate(string, elem);
70+
obfuscated = true;
71+
}
72+
}
73+
if(!obfuscated) elem.innerHTML = string;
74+
return elem;
75+
}
76+
function parseStyle(string) {
77+
var codes = string.match(/§.{1}/g) || [],
78+
indexes = [],
79+
apply = [],
80+
tmpStr,
81+
indexDelta,
82+
noCode,
83+
final = document.createDocumentFragment(),
84+
len = codes.length,
85+
string = string.replace(/\n|\\n/g, '<br>');
86+
87+
for(var i = 0; i < len; i++) {
88+
indexes.push( string.indexOf(codes[i]) );
89+
string = string.replace(codes[i], '\x00\x00');
90+
}
91+
if(indexes[0] !== 0) {
92+
final.appendChild( applyCode( string.substring(0, indexes[0]), [] ) );
93+
}
94+
for(var i = 0; i < len; i++) {
95+
indexDelta = indexes[i + 1] - indexes[i];
96+
if(indexDelta === 2) {
97+
while(indexDelta === 2) {
98+
apply.push ( codes[i] );
99+
i++;
100+
indexDelta = indexes[i + 1] - indexes[i];
101+
}
102+
apply.push ( codes[i] );
103+
} else {
104+
apply.push( codes[i] );
105+
}
106+
if( apply.lastIndexOf('§r') > -1) {
107+
apply = apply.slice( apply.lastIndexOf('§r') + 1 );
108+
}
109+
tmpStr = string.substring( indexes[i], indexes[i + 1] );
110+
final.appendChild( applyCode(tmpStr, apply) );
111+
}
112+
return final;
113+
}
114+
function clearObfuscators() {
115+
var i = obfuscators.length;
116+
for(;i--;) {
117+
clearInterval(obfuscators[i]);
118+
}
119+
obfuscators = [];
120+
}
121+
String.prototype.replaceColorCodes = function() {
122+
clearObfuscators();
123+
var outputString = parseStyle(String(this));
124+
return outputString;
125+
};
126+
127+
/////////////////////////////////////////////////
128+
function cutString(str, cutStart, cutEnd){
129+
return str.substr(0,cutStart) + str.substr(cutEnd+1);
130+
}

0 commit comments

Comments
 (0)