"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ts/logging/debuglogs.ts" between
Signal-Desktop-1.40.0.tar.gz and Signal-Desktop-1.40.1.tar.gz

About: Signal-Desktop is a cross-platform encrypted messaging service (also available for mobile devices).

debuglogs.ts  (Signal-Desktop-1.40.0):debuglogs.ts  (Signal-Desktop-1.40.1)
// Copyright 2018-2021 Signal Messenger, LLC // Copyright 2018-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import FormData from 'form-data'; import FormData from 'form-data';
import { gzip } from 'zlib'; import { gzip } from 'zlib';
import pify from 'pify'; import pify from 'pify';
import got from 'got'; import got, { Response } from 'got';
import { getUserAgent } from '../util/getUserAgent'; import { getUserAgent } from '../util/getUserAgent';
const BASE_URL = 'https://debuglogs.org'; const BASE_URL = 'https://debuglogs.org';
const isObject = (value: unknown): value is Record<string, unknown> => const isObject = (value: unknown): value is Record<string, unknown> =>
typeof value === 'object' && !Array.isArray(value) && Boolean(value); typeof value === 'object' && !Array.isArray(value) && Boolean(value);
const parseTokenBody = ( const parseTokenBody = (
body: unknown body: unknown
): { fields: Record<string, unknown>; url: string } => { ): { fields: Record<string, unknown>; url: string } => {
skipping to change at line 71 skipping to change at line 71
const contentBuffer = await pify(gzip)(Buffer.from(content, 'utf8')); const contentBuffer = await pify(gzip)(Buffer.from(content, 'utf8'));
const contentType = 'application/gzip'; const contentType = 'application/gzip';
form.append('Content-Type', contentType); form.append('Content-Type', contentType);
form.append('file', contentBuffer, { form.append('file', contentBuffer, {
contentType, contentType,
filename: `signal-desktop-debug-log-${appVersion}.txt.gz`, filename: `signal-desktop-debug-log-${appVersion}.txt.gz`,
}); });
window.log.info('Debug log upload starting...'); window.log.info('Debug log upload starting...');
const { statusCode } = await got.post(url, { headers, body: form }); try {
if (statusCode !== 204) { const { statusCode, body } = await got.post(url, { headers, body: form });
throw new Error(`Failed to upload to S3, got status ${statusCode}`); if (statusCode !== 204) {
throw new Error(
`Failed to upload to S3, got status ${statusCode}, body '${body}'`
);
}
} catch (error) {
const response = error.response as Response<string>;
throw new Error(
`Got threw on upload to S3, got status ${response?.statusCode}, body '${re
sponse?.body}' `
);
} }
window.log.info('Debug log upload complete.'); window.log.info('Debug log upload complete.');
return `${BASE_URL}/${fields.key}`; return `${BASE_URL}/${fields.key}`;
}; };
 End of changes. 2 change blocks. 
4 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)