1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-25 01:31:47 +03:00

feat: send report to Pastebin and generate URL

This commit is contained in:
louistiti 2022-10-19 01:17:57 +08:00
parent 76e700e9ce
commit fcce24d68c
No known key found for this signature in database
GPG Key ID: 0A1C3B043E70C77D

View File

@ -6,6 +6,7 @@ import dotenv from 'dotenv'
import { command } from 'execa'
import semver from 'semver'
import kill from 'tree-kill'
import request from 'superagent'
import { version } from '@@/package.json'
import { LogHelper } from '@/helpers/log-helper'
@ -256,7 +257,7 @@ dotenv.config()
report.can_start_tcp_server.v = false
}, timeout)
p.stdout.on('end', () => {
p.stdout.on('end', async () => {
const tcpServerEnd = Date.now()
pastebinData.tcpServer.output = tcpServerOutput
pastebinData.tcpServer.startTime = `${tcpServerEnd - tcpServerStart}ms`
@ -485,6 +486,23 @@ dotenv.config()
pastebinData.report = report
LogHelper.title('REPORT URL')
LogHelper.info('Sending report...')
try {
const { body } = await request
.post('http://localhost:3000/api/report')
.send({
report: pastebinData
})
const { data: reportData } = body
LogHelper.success(`Report URL: ${reportData.reportUrl}`)
} catch (e) {
LogHelper.error(`Failed to send report: ${e}`)
}
process.exit(0)
})
} catch (e) {