From 8b71155e7cb013effcb691cbb473a97393980ac1 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 6 Mar 2018 18:58:01 -0500 Subject: [PATCH] Replace `superagent` with `got` for debug logs --- js/logging.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/js/logging.js b/js/logging.js index 6fedabc0c..45cd0a7e5 100644 --- a/js/logging.js +++ b/js/logging.js @@ -5,7 +5,8 @@ const electron = require('electron'); const bunyan = require('bunyan'); const _ = require('lodash'); -const superagent = require('superagent'); + +const debuglogs = require('./modules/debuglogs'); const ipc = electron.ipcRenderer; @@ -108,26 +109,7 @@ function fetch() { }); } -const DEBUGLOGS_API_URL = 'https://debuglogs.org'; -const publish = async (content) => { - const credentialsResponse = await superagent.get(DEBUGLOGS_API_URL); - const { fields, url } = credentialsResponse.body; - const uploadRequest = superagent.post(url); - Object.entries(fields).forEach(([key, value]) => { - uploadRequest.field(key, value); - }); - - const contentBuffer = Buffer.from(content, 'utf8'); - uploadRequest.attach('file', contentBuffer, { - contentType: 'text/plain', - filename: 'signal-desktop-debug-log.txt', - }); - - await uploadRequest; - - return `${DEBUGLOGS_API_URL}/${fields.key}`; -}; - +const publish = debuglogs.upload; // A modern logging interface for the browser