mirror of
https://github.com/FAUSheppy/tmnf-replay-server.git
synced 2025-12-06 07:01:37 +01:00
add: render condition to filter local names
This commit is contained in:
@@ -25,6 +25,21 @@
|
||||
"render": function ( data, type, full, meta ) {
|
||||
return '<a href=\"/static/'+data+'\" download>Download</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": 0,
|
||||
"render": function ( data, type, full, meta ) {
|
||||
const regex = /^([^/]+)/;
|
||||
const match = data.match(regex);
|
||||
const prefix = match ? match[1] : '';
|
||||
const ip4regex = /\b(?:\d{1,3}\.){3}\d{1,3}(?::\d+)?\b/;
|
||||
const containsIPv4 = ip4regex.test(data);
|
||||
if(containsIPv4){
|
||||
return prefix
|
||||
}else{
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user