From 0063e25bfa4e728b32d902d769fbae6f563dbb75 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 20 Apr 2020 15:49:34 -0700 Subject: [PATCH] Cleanup. --- client/debug.log | 3 -- s3upload.js | 88 ------------------------------------------------ 2 files changed, 91 deletions(-) delete mode 100644 client/debug.log delete mode 100644 s3upload.js diff --git a/client/debug.log b/client/debug.log deleted file mode 100644 index 5ae6436f8..000000000 --- a/client/debug.log +++ /dev/null @@ -1,3 +0,0 @@ -[0309/123120.472:ERROR:process_reader_win.cc(108)] process 40916 not found -[0309/123120.472:ERROR:exception_snapshot_win.cc(98)] thread ID 50448 not found in process -[0309/123120.472:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: An attempt was made to access an exiting process. (0xc000010a) diff --git a/s3upload.js b/s3upload.js deleted file mode 100644 index 00e9efd5d..000000000 --- a/s3upload.js +++ /dev/null @@ -1,88 +0,0 @@ -var aws = require("aws-sdk"); -require("dotenv").config(); -// Configure aws with your accessKeyId and your secretAccessKey -aws.config.update({ - region: "ca-central-1", // Put your aws region here - accessKeyId: process.env.AWSAccessKeyId, - secretAccessKey: process.env.AWSSecretKey -}); - -const S3_BUCKET = process.env.Bucket; -// Now lets export this function so we can call it from somewhere else - -exports.sign_s3 = (req, res) => { - console.log("Get S3 Signed Put for bucket: " + S3_BUCKET); - const s3 = new aws.S3(); // Create a new instance of S3 - const fileName = req.body.fileName; - const fileType = req.body.fileType; - // Set up the payload of what we are sending to the S3 api - const s3Params = { - Bucket: S3_BUCKET, - Key: fileName, - Expires: 500, - ContentType: fileType, - ACL: "public-read" - }; - // Make a request to the S3 API to get a signed URL which we can use to upload our file - s3.getSignedUrl("putObject", s3Params, (err, data) => { - if (err) { - console.log(err); - res.json({ success: false, error: err }); - } - // Data payload of what we are sending back, the url of the signedRequest and a URL where we can access the content after its saved. - const returnData = { - signedRequest: data, - url: `https://${S3_BUCKET}.s3.amazonaws.com/${fileName}` - }; - // Send it all back - res.json({ success: true, data: { returnData } }); - }); -}; - -exports.get_s3 = (req, res) => { - const s3 = new aws.S3(); // Create a new instance of S3 - const fileName = req.body.fileName; - //const fileType = req.body.fileType; - // Set up the payload of what we are sending to the S3 api - const s3Params = { - Bucket: S3_BUCKET, - Key: fileName, - Expires: 500 - }; - // Make a request to the S3 API to get a signed URL which we can use to upload our file - s3.getSignedUrl("getObject", s3Params, (err, data) => { - if (err) { - console.log(err); - res.json({ success: false, error: err }); - } - // Data payload of what we are sending back, the url of the signedRequest and a URL where we can access the content after its saved. - const returnData = { - signedRequest: data, - url: `https://${S3_BUCKET}.s3.amazonaws.com/${fileName}` - }; - // Send it all back - res.json({ success: true, data: { returnData } }); - }); -}; - -exports.delete_s3 = (req, res) => { - const s3 = new aws.S3(); // Create a new instance of S3 - const fileName = req.body.fileName; - //const fileType = req.body.fileType; - // Set up the payload of what we are sending to the S3 api - console.log("fileName", req.body); - const s3Params = { - Bucket: S3_BUCKET, - Key: fileName - }; - - s3.deleteObject(s3Params, function(err, data) { - if (err) { - res.json({ success: false, message: err.message }); - } - // error - else { - res.json({ success: true, data }); - } // deleted - }); -};