mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-17 22:11:33 +03:00
textile/hub 1.1.1 and nextjs 9.5.4
This commit is contained in:
parent
61621955de
commit
901c82f0c2
@ -2,12 +2,15 @@ import * as LibraryManager from "~/node_common/managers/library";
|
||||
import * as Utilities from "~/node_common/utilities";
|
||||
import * as Social from "~/node_common/social";
|
||||
|
||||
import AbortController from "abort-controller";
|
||||
import B from "busboy";
|
||||
|
||||
const HIGH_WATER_MARK = 1024 * 1024 * 3;
|
||||
|
||||
export const formMultipart = async (req, res, { user, bucketName }) => {
|
||||
let data = null;
|
||||
const controller = new AbortController();
|
||||
const { signal } = controller;
|
||||
|
||||
const upload = () =>
|
||||
new Promise(async (resolve, reject) => {
|
||||
@ -32,12 +35,14 @@ export const formMultipart = async (req, res, { user, bucketName }) => {
|
||||
const {
|
||||
buckets,
|
||||
bucketKey,
|
||||
bucketRoot,
|
||||
} = await Utilities.getBucketAPIFromUserToken({
|
||||
user,
|
||||
bucketName,
|
||||
});
|
||||
|
||||
if (!buckets) {
|
||||
controller.abort();
|
||||
return reject({
|
||||
decorator: "SERVER_BUCKET_INIT_FAILURE",
|
||||
error: true,
|
||||
@ -47,15 +52,19 @@ export const formMultipart = async (req, res, { user, bucketName }) => {
|
||||
let push;
|
||||
try {
|
||||
console.log("[upload] pushing to textile");
|
||||
push = await buckets.pushPath(bucketKey, data.id, stream);
|
||||
push = await buckets.pushPath(bucketKey, data.id, stream, {
|
||||
root: bucketRoot,
|
||||
signal,
|
||||
});
|
||||
console.log("[upload] finished pushing to textile");
|
||||
} catch (e) {
|
||||
controller.abort();
|
||||
Social.sendTextileSlackMessage({
|
||||
file: "/node_common/upload.js",
|
||||
user,
|
||||
message: e.message,
|
||||
code: e.code,
|
||||
functionName: `buckets.pushPath`,
|
||||
functionName: `buckets.pushPath (aborting)`,
|
||||
});
|
||||
|
||||
return reject({
|
||||
@ -77,9 +86,10 @@ export const formMultipart = async (req, res, { user, bucketName }) => {
|
||||
user,
|
||||
message: e.message,
|
||||
code: e.code,
|
||||
functionName: `form`,
|
||||
functionName: `form (aborting)`,
|
||||
});
|
||||
|
||||
controller.abort();
|
||||
return reject({
|
||||
decorator: "SERVER_UPLOAD_ERROR",
|
||||
error: true,
|
||||
|
@ -47,7 +47,8 @@
|
||||
"@react-hook/window-size": "^3.0.7",
|
||||
"@slack/webhook": "^5.0.3",
|
||||
"@textile/grpc-transport": "0.0.3",
|
||||
"@textile/hub": "^1.1.0",
|
||||
"@textile/hub": "^1.1.1",
|
||||
"abort-controller": "^3.0.0",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"bcrypt": "^5.0.0",
|
||||
"body-parser": "^1.19.0",
|
||||
@ -66,7 +67,7 @@
|
||||
"minisearch": "^2.5.1",
|
||||
"moment": "^2.27.0",
|
||||
"morgan": "^1.10.0",
|
||||
"next": "^9.5.2",
|
||||
"next": "^9.5.4",
|
||||
"pg": "^8.3.3",
|
||||
"prismjs": "^1.20.0",
|
||||
"react": "^16.13.1",
|
||||
|
Loading…
Reference in New Issue
Block a user