The URL `/tracking/nolog/my_id` yields a client which doesn't send log updates.
This commit is contained in:
Sylvain Gay 2023-06-11 17:07:47 +02:00
parent 8d08faf28b
commit 8974d44267
3 changed files with 8 additions and 3 deletions

View file

@ -61,7 +61,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// GEOLOCALISATION // GEOLOCALISATION
setup_geoLoc(); if(%GPSLOG) setup_geoLoc();
</script> </script>
</body> </body>
</html> </html>

View file

@ -89,7 +89,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// GEOLOCALISATION // GEOLOCALISATION
setup_geoLoc(); if(%GPSLOG) setup_geoLoc();
</script> </script>
</body> </body>
</html> </html>

View file

@ -53,6 +53,11 @@ var server = http.createServer(option, function(req, res){
if(q.pathname.startsWith("/tracking/")){ if(q.pathname.startsWith("/tracking/")){
id = q.pathname.substring("/tracking/".length); id = q.pathname.substring("/tracking/".length);
gpslog = true;
if(id.startsWith("nolog/")){
gpslog = false;
id = id.substring("nolog/".length);
}
var end_path = ["conscrit.html", "vieux.html", "invalid.html"][config.validator(id)]; var end_path = ["conscrit.html", "vieux.html", "invalid.html"][config.validator(id)];
filename = "static/tracking/" + end_path; filename = "static/tracking/" + end_path;
return fs.readFile(filename, 'utf8', function(err, data){ return fs.readFile(filename, 'utf8', function(err, data){
@ -60,7 +65,7 @@ var server = http.createServer(option, function(req, res){
throw new Error("where " + end_path + " is !?"); throw new Error("where " + end_path + " is !?");
res.writeHead(200, {'Content-Type': 'text/html'}); res.writeHead(200, {'Content-Type': 'text/html'});
res.write(data.replaceAll("%ID", id)); res.write(data.replaceAll("%ID", id).replaceAll("%GPSLOG", gpslog));
return res.end(); return res.end();
}); });
} }