From 87b3e4d1e076f3568ef8e151861f8bbb948fea61 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 17 Feb 2020 12:45:25 +0100 Subject: [PATCH] remove unused POST /siafile route --- packages/siaviewnode-server/src/main.ts | 33 ------------------------- 1 file changed, 33 deletions(-) diff --git a/packages/siaviewnode-server/src/main.ts b/packages/siaviewnode-server/src/main.ts index 82efc1f4..f03526b2 100644 --- a/packages/siaviewnode-server/src/main.ts +++ b/packages/siaviewnode-server/src/main.ts @@ -30,7 +30,6 @@ const siad = axios.create({ // Ramda shared utility functions const selectFile = R.path(["files", "file"]) -const pName = R.prop("name") export class Server { public app: express.Express @@ -82,7 +81,6 @@ export class Server { } private configureRoutes() { - this.app.post("/siafile", this.handleSiafilePOST.bind(this)) this.app.post("/skyfile", this.handleSkyfilePOST.bind(this)) this.app.get( @@ -174,37 +172,6 @@ export class Server { return res.status(500).send({ error: err.message }) } } - - private async handleSiafilePOST(req: Request, res: Response): Promise { - const file = selectFile(req) as UploadedFile - const selectContentLength = R.path(["headers", "Content-Length"]) - const cl = selectContentLength(req) - - this.logger.info(`POST siafile ${file.name} w/contentlength ${cl}`) - - try { - const { data: stream, headers } = await siad.post( - "/renter/stream", - file.data, - { responseType: "stream" } - ) - - const splitFilename = R.compose(R.head, R.split(".sia")) - const fileName = R.compose(splitFilename, pName)(file) - - res.set( - "Content-Disposition", - `attachment; filename="${fileName}"; filename*="${fileName}"` - ) - res.set("Content-Length", headers["Content-Length"]) - return stream.pipe(res) - } catch (err) { - const { message } = err; - this.logger.error(message) - return res.status(500).send({ error: err.message }) - } - } - } module.exports = new Server(logger).app