mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Prevented \n in playerCount, webinterface function to get queryString params added
This commit is contained in:
1 parent
b98cb9def6
commit
780feb7eb8
2 files changed
+13
-1
No files matched your search
@@ -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
|
publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config
|
||||||
mods:modHashes,
|
mods:modHashes,
|
||||||
instanceName: instance,
|
instanceName: instance,
|
||||||
playerCount,
|
playerCount:playerCount.replace(/(\r\n\t|\n|\r\t)/gm, ""),
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback(err, mac) {
|
function callback(err, mac) {
|
||||||
|
|||||||
@@ -81,6 +81,18 @@ function djb2(str){
|
|||||||
}
|
}
|
||||||
return hash;
|
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)
|
// callback(err, json)
|
||||||
function getJSON(url, callback) {
|
function getJSON(url, callback) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in new issue
Block a user