use cli b2 instead of s3 library
This commit is contained in:
parent
f238c13739
commit
3ffbcbab8e
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -7,5 +7,6 @@
|
||||
"https://json.schemastore.org/kustomization.json": "file:///home/cj/Documents/futureporn-monorepo/clusters/production/infrastructure.yaml"
|
||||
},
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true
|
||||
"editor.formatOnSave": true,
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
@ -19,7 +19,8 @@ echo(" * Remote pin the IPFS CID")
|
||||
echo(" [Press Enter When Complete...]")
|
||||
_ = stdin()
|
||||
|
||||
echo(" * Create magnet link. ex: `torf ~/Downloads/projektmelody-chaturbate-2025-08-25.mp4 --notorrent --notracker --webseed https://futureporn-b2.b-cdn.net/projektmelody-chaturbate-2025-08-25.mp4'")
|
||||
echo(" * Create magnet link. ex: `mktorrent --web-seed https://futureporn-b2.b-cdn.net/projektmelody-fansly-2025-08-27.mp4 ~/Documents/voddo/projektmelody-fansly-2025-08-27.mp4`")
|
||||
echo(" * Create magnet link. ex: `torf ~/Downloads/projektmelody-chaturbate-2025-08-27.mp4 --notorrent --notracker`")
|
||||
echo(" [Press Enter When Complete...]")
|
||||
_ = stdin()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "futureporn",
|
||||
"private": true,
|
||||
"version": "2.4.14",
|
||||
"version": "2.5.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently npm:dev:serve npm:dev:build npm:dev:worker npm:dev:compose npm:dev:sftp",
|
||||
@ -101,4 +101,4 @@
|
||||
"prisma": {
|
||||
"seed": "tsx prisma/seed.ts"
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import {
|
||||
import { readFile } from 'fs/promises';
|
||||
import { env } from '../config/env' // adjust this path based on your project structure
|
||||
import logger from "./logger";
|
||||
import { getNanoSpawn } from "./nanoSpawn";
|
||||
|
||||
let client: S3Client | null = null
|
||||
|
||||
@ -24,33 +25,38 @@ export async function uploadFile(
|
||||
if (!mimetype) throw new Error('uploadFile requires mimetype as fifth param');
|
||||
logger.debug(`[uploadFile] filePath=${filePath} with key=${key} bucket=${bucket}`);
|
||||
|
||||
try {
|
||||
// Read file content from disk
|
||||
const fileBuffer = await readFile(filePath);
|
||||
const spawn = await getNanoSpawn();
|
||||
await spawn('b2', ['file', 'upload', bucket, filePath, key])
|
||||
|
||||
// Upload to S3
|
||||
await s3Client.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
Body: fileBuffer,
|
||||
ContentType: mimetype, // or determine dynamically if needed
|
||||
}),
|
||||
);
|
||||
return key
|
||||
|
||||
return key;
|
||||
// try {
|
||||
// // Read file content from disk
|
||||
// const fileBuffer = await readFile(filePath);
|
||||
|
||||
} catch (caught) {
|
||||
if (caught instanceof S3ServiceException) {
|
||||
logger.error(
|
||||
`Error from S3 while uploading to ${bucket}. ${caught.name}: ${caught.message}`,
|
||||
);
|
||||
} else {
|
||||
logger.error(`Unexpected error during upload:`, caught);
|
||||
}
|
||||
// // Upload to S3
|
||||
// await s3Client.send(
|
||||
// new PutObjectCommand({
|
||||
// Bucket: bucket,
|
||||
// Key: key,
|
||||
// Body: fileBuffer,
|
||||
// ContentType: mimetype, // or determine dynamically if needed
|
||||
// }),
|
||||
// );
|
||||
|
||||
throw new Error(`Failed to upload ${filePath} to s3://${bucket}/${key}`);
|
||||
}
|
||||
// return key;
|
||||
|
||||
// } catch (caught) {
|
||||
// if (caught instanceof S3ServiceException) {
|
||||
// logger.error(
|
||||
// `Error from S3 while uploading to ${bucket}. ${caught.name}: ${caught.message}`,
|
||||
// );
|
||||
// } else {
|
||||
// logger.error(`Unexpected error during upload:`, caught);
|
||||
// }
|
||||
|
||||
// throw new Error(`Failed to upload ${filePath} to s3://${bucket}/${key}`);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,8 @@ async function getJson(username) {
|
||||
const formatted = formatTwitterDate(sinceDate);
|
||||
|
||||
const { defaultDatasetId } = await client.actor('kaitoeasyapi/twitter-x-data-tweet-scraper-pay-per-result-cheapest').call({
|
||||
searchTerms: [`from:${username} since:${formatted}`]
|
||||
searchTerms: [`from:${username} since:${formatted}`],
|
||||
maxItems: 15,
|
||||
});
|
||||
|
||||
// Fetches results from the actor's dataset.
|
||||
|
Loading…
x
Reference in New Issue
Block a user