11using  System . ComponentModel ; 
22using  Flurl . Http ; 
3+ using  Flurl . Http . Content ; 
34using  Kantan . Net . Utilities ; 
45using  SmartImage . Lib . Results ; 
56
@@ -15,10 +16,7 @@ public override async Task<UploadResult> UploadFileAsync(string file, Cancellati
1516		Verify ( file ) ; 
1617
1718		var  response  =  await  Client . Request ( EndpointUrl ) 
18- 			               . WithSettings ( r => 
19- 			               { 
20- 				               r . Timeout  =  Timeout ; 
21- 			               } ) 
19+ 			               . WithSettings ( r =>  {  r . Timeout  =  Timeout ;  } ) 
2220			               . WithHeaders ( new 
2321			               { 
2422				               User_Agent  =  HttpUtilities . UserAgent 
@@ -34,6 +32,26 @@ public override async Task<UploadResult> UploadFileAsync(string file, Cancellati
3432		return  await  ProcessResultAsync ( response ,  ct ) . ConfigureAwait ( false ) ; 
3533	} 
3634
35+ 	/*public async Task<UploadResult> UploadFileAsync(Stream file, CancellationToken ct = default) 
36+ 	{ 
37+ 
38+ 		var response = await Client.Request(EndpointUrl) 
39+ 			               .WithSettings(r => { r.Timeout = Timeout; }) 
40+ 			               .WithHeaders(new 
41+ 			               { 
42+ 				               User_Agent = HttpUtilities.UserAgent 
43+ 			               }) 
44+ 			               .PostMultipartAsync(mp => 
45+ 			               { 
46+ 				               mp.AddFile("fileToUpload", file, Path.GetTempFileName()) 
47+ 					               .AddString("reqtype", "fileupload") 
48+ 					               .AddString("time", "1h") 
49+ 					               .AddString("userhash", string.Empty); 
50+ 			               }, cancellationToken: ct, completionOption: HttpCompletionOption.ResponseHeadersRead); 
51+ 
52+ 		return await ProcessResultAsync(response, ct).ConfigureAwait(false); 
53+ 	}*/ 
54+ 
3755	protected  BaseCatboxEngine ( string  s )  :  base ( s )  {  } 
3856
3957} 
@@ -43,8 +61,6 @@ public sealed class CatboxEngine : BaseCatboxEngine
4361
4462	public  override  long ?  MaxSize  =>  200_000_000L ; 
4563
46- 	public  CatboxEngine ( )  :  base ( "https://catbox.moe/user/api.php" ) 
47- 	{ 
48- 	} 
64+ 	public  CatboxEngine ( )  :  base ( "https://catbox.moe/user/api.php" )  {  } 
4965
5066} 
0 commit comments