File tree Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Expand file tree Collapse file tree 3 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ impl Client {
37
37
let peers = Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ;
38
38
let http_client = reqwest:: Client :: new ( ) ;
39
39
let sessions = Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ;
40
- let download_dir = "/home/wyli/Downloads " . to_string ( ) ;
40
+ let download_dir = "/home/localsend " . to_string ( ) ;
41
41
42
42
Ok ( Self {
43
43
device,
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ impl Client {
35
35
. layer ( RequestBodyLimitLayer :: new ( 1024 * 1024 * 1024 ) )
36
36
. layer ( Extension ( self . device . clone ( ) ) )
37
37
. layer ( Extension ( self . sessions . clone ( ) ) )
38
+ . layer ( Extension ( self . download_dir . clone ( ) ) )
38
39
. with_state ( peers)
39
40
40
41
}
Original file line number Diff line number Diff line change @@ -192,13 +192,13 @@ pub async fn register_prepare_upload(
192
192
pub async fn register_upload (
193
193
Query ( params) : Query < UploadParams > ,
194
194
Extension ( sessions) : Extension < Arc < Mutex < HashMap < String , Session > > > > ,
195
+ Extension ( download_dir) : Extension < String > ,
195
196
body : Bytes ,
196
197
) -> impl IntoResponse {
197
198
// Extract query parameters
198
199
let session_id = & params. session_id ;
199
200
let file_id = & params. file_id ;
200
201
let token = & params. token ;
201
- let download_dir = PathBuf :: from ( "/home/wyli/Downloads" ) ;
202
202
203
203
// Get session and validate
204
204
let mut sessions_lock = sessions. lock ( ) . await ;
@@ -237,7 +237,7 @@ pub async fn register_upload(
237
237
}
238
238
239
239
// Create file path
240
- let file_path = download_dir . join ( & file_metadata. file_name ) ;
240
+ let file_path = format ! ( "{}/{}" , download_dir , file_metadata. file_name) ;
241
241
242
242
// Write file
243
243
if let Err ( e) = tokio:: fs:: write ( & file_path, body) . await {
You can’t perform that action at this time.
0 commit comments