aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/requests.ts19
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 @@
1import { createWriteStream, remove } from 'fs-extra' 1import { createWriteStream, remove } from 'fs-extra'
2import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, RequestError, Response } from 'got' 2import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, RequestError, Response } from 'got'
3import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent' 3import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'
4import { join } from 'path'
5import { CONFIG } from '../initializers/config'
6import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants' 4import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants'
7import { pipelinePromise } from './core-utils' 5import { pipelinePromise } from './core-utils'
8import { processImage } from './image-utils'
9import { logger, loggerTagsFactory } from './logger' 6import { logger, loggerTagsFactory } from './logger'
10import { getProxy, isProxyEnabled } from './proxy' 7import { getProxy, isProxyEnabled } from './proxy'
11 8
@@ -147,21 +144,6 @@ async function doRequestAndSaveToFile (
147 } 144 }
148} 145}
149 146
150async 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
165function getAgent () { 147function 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