Prevented \n in playerCount, webinterface function to get queryString params added

This commit is contained in:
Daniel Vestøl committed 2018-06-10 09:53:22 +02:00
1 parent b98cb9def6
commit 780feb7eb8
2 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -618,7 +618,7 @@ function instanceManagement() {
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
mods:modHashes,
instanceName: instance,
playerCount,
playerCount:playerCount.replace(/(\r\n\t|\n|\r\t)/gm, ""),
}
function callback(err, mac) {
+12
View File
@@ -81,6 +81,18 @@ function djb2(str){
}
return hash;
}
// get queryString parameters
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// callback(err, json)
function getJSON(url, callback) {
return new Promise((resolve, reject) => {