ilhamdev commited on
Commit
8227301
·
verified ·
1 Parent(s): 03c65d6

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -4
index.js CHANGED
@@ -390,8 +390,9 @@ app.use(morgan('dev'));
390
  app.use(express.json());
391
 
392
  const v8 = require('v8');
 
393
 
394
- app.all('/', (req, res) => {
395
  const status = {}
396
  status['diskUsage'] = cp.execSync('du -sh').toString().split('M')[0] + ' MB'
397
 
@@ -408,19 +409,21 @@ app.all('/', (req, res) => {
408
 
409
  // Menambahkan semua properti dan metode dari v8
410
  for (let x in v8) {
411
- if (typeof v8[x] === 'function') {
412
- status[x] = v8[x]
413
- } else {
414
  status[x] = v8[x]
415
  }
416
  }
417
 
418
  const host = 'https://' + req.get('host');
 
 
 
419
  res.json({
420
  creator: `@${process.env['SPACE_AUTHOR_NAME'] || 'ALOK FF'}`,
421
  message: 'Hello World!',
422
  uptime: new Date(process.uptime() * 1000).toUTCString().split(' ')[4],
423
  status,
 
424
  "list": [
425
  {
426
  "title": "BING AI",
@@ -476,6 +479,7 @@ app.all('/', (req, res) => {
476
  });
477
  });
478
 
 
479
  app.get('/yt', async (req, res) => {
480
  const host = 'https://' + req.get('host');
481
  try {
 
390
  app.use(express.json());
391
 
392
  const v8 = require('v8');
393
+ const start = Date.now(); // Mulai menghitung waktu
394
 
395
+ app.all('/', async (req, res) => {
396
  const status = {}
397
  status['diskUsage'] = cp.execSync('du -sh').toString().split('M')[0] + ' MB'
398
 
 
409
 
410
  // Menambahkan semua properti dan metode dari v8
411
  for (let x in v8) {
412
+ if (typeof v8[x] !== 'function') {
 
 
413
  status[x] = v8[x]
414
  }
415
  }
416
 
417
  const host = 'https://' + req.get('host');
418
+ const end = Date.now(); // Selesai menghitung waktu
419
+ const latency = (end - start).toFixed(4) + ' ms'; // Menghitung latency
420
+
421
  res.json({
422
  creator: `@${process.env['SPACE_AUTHOR_NAME'] || 'ALOK FF'}`,
423
  message: 'Hello World!',
424
  uptime: new Date(process.uptime() * 1000).toUTCString().split(' ')[4],
425
  status,
426
+ latency, // Menambahkan latency ke JSON
427
  "list": [
428
  {
429
  "title": "BING AI",
 
479
  });
480
  });
481
 
482
+
483
  app.get('/yt', async (req, res) => {
484
  const host = 'https://' + req.get('host');
485
  try {