mirror of
https://github.com/besoeasy/file-drop.git
synced 2026-01-27 13:48:50 -06:00
feat: update pinCid function to include response type and body size limits; bump version to 1.4.2
This commit is contained in:
@@ -59,11 +59,14 @@ const pinCid = async (cid) => {
|
||||
console.log(`[IPFS] Trying to fetch CID ${cid.slice(0, 12)}..., using ${peerCount} peers`);
|
||||
|
||||
// Fire-and-forget: Start pin in background without waiting
|
||||
const endpoint = `${IPFS_API}/api/v0/pin/add?arg=${encodeURIComponent(cid)}&recursive=true&progress=true`;
|
||||
|
||||
// Start the pin operation but don't await it
|
||||
axios.post(endpoint, null, {
|
||||
timeout: 3 * 60 * 60 * 1000 // 3 hours
|
||||
const endpoint = `${IPFS_API}/api/v0/pin/add?arg=${encodeURIComponent(cid)}&recursive=true`;
|
||||
|
||||
// Start the pin operation but don't await it (cap body size to avoid buffer growth)
|
||||
axios.post(endpoint, null, {
|
||||
timeout: 3 * 60 * 60 * 1000, // 3 hours
|
||||
responseType: "json",
|
||||
maxContentLength: 1024 * 1024, // 1 MB safety cap
|
||||
maxBodyLength: 1024 * 1024,
|
||||
}).then((pinResponse) => {
|
||||
if (pinResponse.data && pinResponse.data.Pins) {
|
||||
console.log(`[IPFS-API] PIN_COMPLETED cid=${cid}`);
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "file-drop",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "file-drop",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^1.8.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-drop",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "file drop",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user