fix: file transfer, show error, msgbox (#9389)
* fix: file transfer, show error, msgbox Signed-off-by: fufesou <linlong1266@gmail.com> * fix: translation Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
		
							parent
							
								
									e5ec6957fe
								
							
						
					
					
						commit
						d08c335fdf
					
				@ -34,6 +34,7 @@ class JobID {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef GetSessionID = SessionID Function();
 | 
			
		||||
typedef GetDialogManager = OverlayDialogManager? Function();
 | 
			
		||||
 | 
			
		||||
class FileModel {
 | 
			
		||||
  final WeakReference<FFI> parent;
 | 
			
		||||
@ -45,13 +46,15 @@ class FileModel {
 | 
			
		||||
  late final FileController remoteController;
 | 
			
		||||
 | 
			
		||||
  late final GetSessionID getSessionID;
 | 
			
		||||
  late final GetDialogManager getDialogManager;
 | 
			
		||||
  SessionID get sessionId => getSessionID();
 | 
			
		||||
  late final FileDialogEventLoop evtLoop;
 | 
			
		||||
 | 
			
		||||
  FileModel(this.parent) {
 | 
			
		||||
    getSessionID = () => parent.target!.sessionId;
 | 
			
		||||
    getDialogManager = () => parent.target?.dialogManager;
 | 
			
		||||
    fileFetcher = FileFetcher(getSessionID);
 | 
			
		||||
    jobController = JobController(getSessionID);
 | 
			
		||||
    jobController = JobController(getSessionID, getDialogManager);
 | 
			
		||||
    localController = FileController(
 | 
			
		||||
        isLocal: true,
 | 
			
		||||
        getSessionID: getSessionID,
 | 
			
		||||
@ -736,14 +739,19 @@ class FileController {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const _kOneWayFileTransferError = 'one-way-file-transfer-tip';
 | 
			
		||||
 | 
			
		||||
class JobController {
 | 
			
		||||
  static final JobID jobID = JobID();
 | 
			
		||||
  final jobTable = List<JobProgress>.empty(growable: true).obs;
 | 
			
		||||
  final jobResultListener = JobResultListener<Map<String, dynamic>>();
 | 
			
		||||
  final GetSessionID getSessionID;
 | 
			
		||||
  final GetDialogManager getDialogManager;
 | 
			
		||||
  SessionID get sessionId => getSessionID();
 | 
			
		||||
  OverlayDialogManager? get alogManager => getDialogManager();
 | 
			
		||||
  int _lastTimeShowMsgbox = DateTime.now().millisecondsSinceEpoch;
 | 
			
		||||
 | 
			
		||||
  JobController(this.getSessionID);
 | 
			
		||||
  JobController(this.getSessionID, this.getDialogManager);
 | 
			
		||||
 | 
			
		||||
  int getJob(int id) {
 | 
			
		||||
    return jobTable.indexWhere((element) => element.id == id);
 | 
			
		||||
@ -882,6 +890,15 @@ class JobController {
 | 
			
		||||
      }
 | 
			
		||||
      jobTable.refresh();
 | 
			
		||||
    }
 | 
			
		||||
    if (err == _kOneWayFileTransferError) {
 | 
			
		||||
      if (DateTime.now().millisecondsSinceEpoch - _lastTimeShowMsgbox > 3000) {
 | 
			
		||||
        final dm = alogManager;
 | 
			
		||||
        if (dm != null) {
 | 
			
		||||
          _lastTimeShowMsgbox = DateTime.now().millisecondsSinceEpoch;
 | 
			
		||||
          msgBox(sessionId, 'custom-nocancel', 'Error', err, '', dm);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    debugPrint("jobError $evt");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", "Възобновяване"),
 | 
			
		||||
        ("Invalid file name", "Невалидно име за файл"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "父目录"),
 | 
			
		||||
        ("Resume", "继续"),
 | 
			
		||||
        ("Invalid file name", "无效文件名"),
 | 
			
		||||
        ("one-way-file-transfer-tip", "被控端启用了单项文件传输"),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Rodičovský adresář"),
 | 
			
		||||
        ("Resume", "Pokračovat"),
 | 
			
		||||
        ("Invalid file name", "Nesprávný název souboru"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "mappe"),
 | 
			
		||||
        ("Resume", "Fortsæt"),
 | 
			
		||||
        ("Invalid file name", "Ugyldigt filnavn"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Übergeordnetes Verzeichnis"),
 | 
			
		||||
        ("Resume", "Fortsetzen"),
 | 
			
		||||
        ("Invalid file name", "Ungültiger Dateiname"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -234,5 +234,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("About RustDesk", ""),
 | 
			
		||||
        ("network_error_tip", "Please check your network connection, then click retry."),
 | 
			
		||||
        ("enable-trusted-devices-tip", "Skip 2FA verification on trusted devices"),
 | 
			
		||||
        ("one-way-file-transfer-tip", "One-way file transfer is enabled on the controlled side."),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Directorio superior"),
 | 
			
		||||
        ("Resume", "Continuar"),
 | 
			
		||||
        ("Invalid file name", "Nombre de archivo no válido"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Cartella principale"),
 | 
			
		||||
        ("Resume", "Riprendi"),
 | 
			
		||||
        ("Invalid file name", "Nome file non valido"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "親ディレクトリ"),
 | 
			
		||||
        ("Resume", "再開"),
 | 
			
		||||
        ("Invalid file name", "無効なファイル名"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Vecākdirektorijs"),
 | 
			
		||||
        ("Resume", "Atsākt"),
 | 
			
		||||
        ("Invalid file name", "Nederīgs faila nosaukums"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Hoofdmap"),
 | 
			
		||||
        ("Resume", "Hervatten"),
 | 
			
		||||
        ("Invalid file name", "Ongeldige bestandsnaam"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Folder nadrzędny"),
 | 
			
		||||
        ("Resume", "Wznów"),
 | 
			
		||||
        ("Invalid file name", "Nieprawidłowa nazwa pliku"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Diretório pai"),
 | 
			
		||||
        ("Resume", "Continuar"),
 | 
			
		||||
        ("Invalid file name", "Nome de arquivo inválido"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Родительская директория"),
 | 
			
		||||
        ("Resume", "Продолжить"),
 | 
			
		||||
        ("Invalid file name", "Неверное имя файла"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "Rodičovský adresár"),
 | 
			
		||||
        ("Resume", "Obnoviť"),
 | 
			
		||||
        ("Invalid file name", "Nesprávny názov súboru"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", "父目錄"),
 | 
			
		||||
        ("Resume", "繼續"),
 | 
			
		||||
        ("Invalid file name", "無效文件名"),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -644,5 +644,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
 | 
			
		||||
        ("Parent directory", ""),
 | 
			
		||||
        ("Resume", ""),
 | 
			
		||||
        ("Invalid file name", ""),
 | 
			
		||||
        ("one-way-file-transfer-tip", ""),
 | 
			
		||||
    ].iter().cloned().collect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2139,22 +2139,34 @@ impl Connection {
 | 
			
		||||
                            return true;
 | 
			
		||||
                        }
 | 
			
		||||
                        if crate::get_builtin_option(keys::OPTION_ONE_WAY_FILE_TRANSFER) == "Y" {
 | 
			
		||||
                            match fa.union {
 | 
			
		||||
                                Some(file_action::Union::Send(_))
 | 
			
		||||
                                | Some(file_action::Union::RemoveFile(_))
 | 
			
		||||
                                | Some(file_action::Union::Rename(_))
 | 
			
		||||
                                | Some(file_action::Union::Create(_))
 | 
			
		||||
                                | Some(file_action::Union::RemoveDir(_)) => {
 | 
			
		||||
                                    self.send(fs::new_error(
 | 
			
		||||
                                        0,
 | 
			
		||||
                                        "One-way file transfer is enabled on controlled side",
 | 
			
		||||
                                        0,
 | 
			
		||||
                                    ))
 | 
			
		||||
                                    .await;
 | 
			
		||||
                                    return true;
 | 
			
		||||
                            let mut job_id = None;
 | 
			
		||||
                            match &fa.union {
 | 
			
		||||
                                Some(file_action::Union::Send(s)) => {
 | 
			
		||||
                                    job_id = Some(s.id);
 | 
			
		||||
                                }
 | 
			
		||||
                                Some(file_action::Union::RemoveFile(rf)) => {
 | 
			
		||||
                                    job_id = Some(rf.id);
 | 
			
		||||
                                }
 | 
			
		||||
                                Some(file_action::Union::Rename(r)) => {
 | 
			
		||||
                                    job_id = Some(r.id);
 | 
			
		||||
                                }
 | 
			
		||||
                                Some(file_action::Union::Create(c)) => {
 | 
			
		||||
                                    job_id = Some(c.id);
 | 
			
		||||
                                }
 | 
			
		||||
                                Some(file_action::Union::RemoveDir(rd)) => {
 | 
			
		||||
                                    job_id = Some(rd.id);
 | 
			
		||||
                                }
 | 
			
		||||
                                _ => {}
 | 
			
		||||
                            }
 | 
			
		||||
                            if let Some(job_id) = job_id {
 | 
			
		||||
                                self.send(fs::new_error(
 | 
			
		||||
                                    job_id,
 | 
			
		||||
                                    "one-way-file-transfer-tip",
 | 
			
		||||
                                    0,
 | 
			
		||||
                                ))
 | 
			
		||||
                                .await;
 | 
			
		||||
                                return true;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        match fa.union {
 | 
			
		||||
                            Some(file_action::Union::ReadDir(rd)) => {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user