@@ -243,6 +243,60 @@ module.exports = (on, config) => {
243243 await etherscan . getTransactionStatus ( txid ) ,
244244 etherscanWaitForTxSuccess : async ( { txid } ) =>
245245 await etherscan . waitForTxSuccess ( txid ) ,
246+ uploadVideo : async ( videoPath ) => {
247+ const fs = require ( 'fs' ) ;
248+ const path = require ( 'path' ) ;
249+ const FormData = require ( 'form-data' ) ;
250+ const fetch = require ( 'node-fetch' ) ;
251+
252+ try {
253+ // Check if video file exists
254+ const fullPath = path . resolve ( videoPath ) ;
255+ if ( ! fs . existsSync ( fullPath ) ) {
256+ throw new Error ( `Video file not found: ${ fullPath } ` ) ;
257+ }
258+
259+ console . log ( `📹 Uploading video: ${ fullPath } ` ) ;
260+
261+ // Create form data
262+ const form = new FormData ( ) ;
263+ form . append ( 'file' , fs . createReadStream ( fullPath ) ) ;
264+
265+ // Upload to transfer.toolsfdg.net
266+ const response = await fetch ( 'https://transfer.toolsfdg.net/video' , {
267+ method : 'POST' ,
268+ body : form ,
269+ headers : form . getHeaders ( )
270+ } ) ;
271+
272+ const result = await response . text ( ) ;
273+
274+ if ( response . ok ) {
275+ console . log ( `✅ Video uploaded successfully: ${ result } ` ) ;
276+ return {
277+ success : true ,
278+ url : result ,
279+ status : response . status ,
280+ message : 'Video uploaded successfully'
281+ } ;
282+ } else {
283+ console . error ( `❌ Video upload failed: ${ response . status } - ${ result } ` ) ;
284+ return {
285+ success : false ,
286+ status : response . status ,
287+ error : result ,
288+ message : 'Video upload failed'
289+ } ;
290+ }
291+ } catch ( error ) {
292+ console . error ( `❌ Video upload error: ${ error . message } ` ) ;
293+ return {
294+ success : false ,
295+ error : error . message ,
296+ message : 'Video upload error'
297+ } ;
298+ }
299+ } ,
246300 } ) ;
247301
248302 if ( process . env . BASE_URL ) {
0 commit comments