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