diff --git a/basicauth_serve.js b/basicauth_serve.js index e6c3d8c..2a0bb8c 100644 --- a/basicauth_serve.js +++ b/basicauth_serve.js @@ -1,5 +1,6 @@ const express = require('express'); const WebSocket = require('ws'); +const os = require('os'); const { createHash } = require('crypto'); // TODO: make the code more reusable between the two endpoints @@ -96,6 +97,22 @@ const hazeTranslator = { ] }; +const deviceInfo = { + // modelname: "GeoJSON_connector" + "event": "reportDeviceInfo_request", + "body": [ + "third-party", + "Linux", + "dehaze", + "Firefox", + "154.0", + "GeoJSON_connector", + null, + "desktop", + "web" + ] +}; + // Assemble full Haze location data, can take a LONG time app.all('/locations_full.geojson', (req, res) => { // TODO: Implement 1wk caching of location data @@ -196,15 +213,7 @@ app.all('/locations_full.geojson', (req, res) => { haze_username = data['body']['username']; // TODO: add platform report haze.send(JSON.stringify({ - "event": "reportDeviceInfo_request", - "body": [ - { - "sessionType": { - "third-party": "GeoJSON_connector", - "name": "dehaze" - } - } - ], + ...deviceInfo, "socketMessageId": ++hazeSocketCounter })); } else { @@ -364,15 +373,7 @@ app.all('/locations.geojson', (req, res) => { haze_username = data['body']['username']; // TODO: add platform report haze.send(JSON.stringify({ - "event": "reportDeviceInfo_request", - "body": [ - { - "sessionType": { - "third-party": "GeoJSON_connector", - "name": "dehaze" - } - } - ], + ...deviceInfo, "socketMessageId": ++hazeSocketCounter })); } else { @@ -431,8 +432,8 @@ app.all('/locations.geojson', (req, res) => { break; default: console.dir(data); - res.status(500).send('Unexpected response from Haze API'); haze.close(); + res.status(500).send('Unexpected response from Haze API'); res.end(); } });