Debug Logs: gzip before upload

This commit is contained in:
Ken Powers 2020-03-20 17:27:31 -04:00 committed by Scott Nonnenberg
parent 4a8f5db0a4
commit a1270867ff
5 changed files with 20 additions and 20 deletions

View file

@ -3,6 +3,8 @@
const FormData = require('form-data');
const got = require('got');
const pify = require('pify');
const { gzip } = require('zlib');
const BASE_URL = 'https://debuglogs.org';
const VERSION = window.getVersion();
@ -52,12 +54,12 @@ exports.upload = async content => {
form.append(key, value);
});
const contentBuffer = Buffer.from(content, 'utf8');
const contentType = 'text/plain';
const contentBuffer = await pify(gzip)(Buffer.from(content, 'utf8'));
const contentType = 'application/gzip';
form.append('Content-Type', contentType);
form.append('file', contentBuffer, {
contentType,
filename: `signal-desktop-debug-log-${VERSION}.txt`,
filename: `signal-desktop-debug-log-${VERSION}.txt.gz`,
});
window.log.info('Debug log upload starting...');