diff --git a/expressApp.js b/expressApp.js index 9d23dae..8d6f628 100644 --- a/expressApp.js +++ b/expressApp.js @@ -25,6 +25,10 @@ const expressApp = express(); expressApp.use(cors()); +expressApp.get('/time', (req, res) => { + res.send(`${Math.floor(Date.now() / 1000)}`); +}); + expressApp.get('/syncing', async (req, res) => { //await syncing.resetTx404(); //await syncing.deleteBlackTxsAndAddress(); diff --git a/src/syncing.js b/src/syncing.js index 3301ae8..bf69178 100644 --- a/src/syncing.js +++ b/src/syncing.js @@ -137,6 +137,7 @@ location TEXT not null, area_code TEXT not null, country_code TEXT not null, + mining_address TEXT, status INTEGER DEFAULT 0 ); `); @@ -4297,6 +4298,15 @@ } }; + async function getTime() { + try { + const response = await axios.get("http://"+Item.ip+"/time"); + console.log(`Unix Timestamp: ${response.data}`); + } catch (error) { + console.error('Error fetching time:', error); + } + }; + export default { initChivesLightNode, initChivesLightNodeSql, @@ -4390,5 +4400,6 @@ mkdirForData, deleteBlackTxsAndAddress, restrictToLocalhost, - closeDb - }; \ No newline at end of file + closeDb, + getTime + };