diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/requests.ts | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index a9869e987..495e83558 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -1,11 +1,8 @@ | |||
1 | import { createWriteStream, remove } from 'fs-extra' | 1 | import { createWriteStream, remove } from 'fs-extra' |
2 | import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, RequestError, Response } from 'got' | 2 | import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, RequestError, Response } from 'got' |
3 | import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent' | 3 | import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent' |
4 | import { join } from 'path' | ||
5 | import { CONFIG } from '../initializers/config' | ||
6 | import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants' | 4 | import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants' |
7 | import { pipelinePromise } from './core-utils' | 5 | import { pipelinePromise } from './core-utils' |
8 | import { processImage } from './image-utils' | ||
9 | import { logger, loggerTagsFactory } from './logger' | 6 | import { logger, loggerTagsFactory } from './logger' |
10 | import { getProxy, isProxyEnabled } from './proxy' | 7 | import { getProxy, isProxyEnabled } from './proxy' |
11 | 8 | ||
@@ -147,21 +144,6 @@ async function doRequestAndSaveToFile ( | |||
147 | } | 144 | } |
148 | } | 145 | } |
149 | 146 | ||
150 | async function downloadImage (url: string, destDir: string, destName: string, size: { width: number, height: number }) { | ||
151 | const tmpPath = join(CONFIG.STORAGE.TMP_DIR, 'pending-' + destName) | ||
152 | await doRequestAndSaveToFile(url, tmpPath) | ||
153 | |||
154 | const destPath = join(destDir, destName) | ||
155 | |||
156 | try { | ||
157 | await processImage(tmpPath, destPath, size) | ||
158 | } catch (err) { | ||
159 | await remove(tmpPath) | ||
160 | |||
161 | throw err | ||
162 | } | ||
163 | } | ||
164 | |||
165 | function getAgent () { | 147 | function getAgent () { |
166 | if (!isProxyEnabled()) return {} | 148 | if (!isProxyEnabled()) return {} |
167 | 149 | ||
@@ -211,7 +193,6 @@ export { | |||
211 | doJSONRequest, | 193 | doJSONRequest, |
212 | doRequestAndSaveToFile, | 194 | doRequestAndSaveToFile, |
213 | isBinaryResponse, | 195 | isBinaryResponse, |
214 | downloadImage, | ||
215 | getAgent, | 196 | getAgent, |
216 | findLatestRedirection, | 197 | findLatestRedirection, |
217 | peertubeGot | 198 | peertubeGot |