add: render condition to filter local names

This commit is contained in:
2023-06-16 14:53:43 +02:00
parent b4f12985d5
commit a8dffc3e47

View File

@@ -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
}
}
}
]
});