encrypted-bucket: delete

This commit is contained in:
@wwwjim 2020-09-25 10:54:37 -07:00
parent 99aa58f3f5
commit 12c04b4358
3 changed files with 30 additions and 13 deletions

View File

@ -1,8 +1,6 @@
import { dispatchCustomEvent } from "~/common/custom-events";
export const upload = async ({ file, context, bucketName }) => {
console.log({ bucketName });
let formData = new FormData();
const HEIC2ANY = require("heic2any");

View File

@ -51,6 +51,7 @@ export default async (req, res) => {
// Would be nice to be nice to get `entity.encrypted` on the bucket property.
let items = null;
if (bucketName === "encrypted-deal") {
console.log("[ encrypted ] archiving encrypted bucket");
try {
const path = await buckets.listPath(bucketRoot.key, "/");
items = path.item;

View File

@ -62,18 +62,36 @@ export default async (req, res) => {
.send({ decorator: "SERVER_BUCKET_NOT_FOUND", error: true });
}
// TODO(jim): Put this call into a file for all Textile related calls.
// TODO(sander+jim):
// See line: 196 on https://github.com/filecoin-project/slate/blob/main/node_common/managers/viewer.js
// Would be nice to be nice to get `entity.encrypted` on the bucket property.
let items = null;
try {
items = await buckets.listIpfsPath(targetBucket.path);
} catch (e) {
Social.sendTextileSlackMessage({
file: "/pages/api/data/bucket-remove.js",
user,
message: e.message,
code: e.code,
functionName: `buckets.listIpfsPath`,
});
if (targetBucket.name === "encrypted-deal") {
console.log("[ encrypted ] removing from encrypted bucket");
try {
const path = await buckets.listPath(targetBucket.key, "/");
items = path.item;
} catch (e) {
Social.sendTextileSlackMessage({
file: "/pages/api/data/bucket-remove.js",
user,
message: e.message,
code: e.code,
functionName: `buckets.listPath`,
});
}
} else {
try {
items = await buckets.listIpfsPath(targetBucket.path);
} catch (e) {
Social.sendTextileSlackMessage({
file: "/pages/api/data/bucket-remove.js",
user,
message: e.message,
code: e.code,
functionName: `buckets.listIpfsPath`,
});
}
}
if (!items) {