Début ajout chemin de sauvegarde dans la configuration de l'application
This commit is contained in:
parent
8746fa3b65
commit
02d9d30985
@ -37,7 +37,7 @@ public class App {
|
||||
protocolRep.addReader(new SignupRule(protocolRep));
|
||||
protocolRep.addReader(new SignoutRule());
|
||||
protocolRep.addReader(new FilelistRule(protocolRep));
|
||||
protocolRep.addReader(new SavefileRule(protocolRep));
|
||||
protocolRep.addReader(new SavefileRule(protocolRep, repositoryStorage.getStoragePath()));
|
||||
protocolRep.addReader(new SendOkRule(protocolRep));
|
||||
|
||||
protocolRep.addWriter(new SignOkRule());
|
||||
|
@ -27,11 +27,13 @@ public class SavefileRule extends ProtocolReader {
|
||||
private static final int FILE_SIZE = 1; // Index file size.
|
||||
|
||||
private ProtocolRepository protocolRep;
|
||||
private String storagePath;
|
||||
|
||||
// Constructor
|
||||
public SavefileRule(ProtocolRepository protocolRep) {
|
||||
public SavefileRule(ProtocolRepository protocolRep, String storagePath) {
|
||||
super(NAME, PATTERN);
|
||||
this.protocolRep = protocolRep;
|
||||
this.storagePath = storagePath;
|
||||
}
|
||||
|
||||
public class Result extends ProtocolResult {
|
||||
@ -52,7 +54,7 @@ public class SavefileRule extends ProtocolReader {
|
||||
System.out.printf("Sauvegarde du fichier : %s %d\n", filename, size);
|
||||
|
||||
try {
|
||||
FileReceiver fileReceiver = new FileReceiver("D:\\"); //"/home/benjamin/ffe");
|
||||
FileReceiver fileReceiver = new FileReceiver(storagePath); // "D:\\"); //"/home/benjamin/ffe");
|
||||
|
||||
String key = AES_GCM.generateSecretKey();
|
||||
String iv = AES_GCM.generateIV();
|
||||
|
@ -114,4 +114,12 @@ public class Repository {
|
||||
public String getUserPasswordSalt(String login) {
|
||||
return appData.getUserPasswordSalt(login);
|
||||
}
|
||||
|
||||
/**
|
||||
* Méthode permettant de récupérer le chemin de sauvegarde des fichiers
|
||||
* @return
|
||||
*/
|
||||
public String getStoragePath() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"multicast_port": 15502,
|
||||
"network_interface": "My network interface",
|
||||
"tls": true,
|
||||
"storagePath": "/home/benjamin/ffe",
|
||||
"users": [
|
||||
{
|
||||
"name": "benjamin",
|
||||
|
Loading…
Reference in New Issue
Block a user