Merge branch 'fix' into develop

This commit is contained in:
Armin Schrenk
2020-03-06 18:52:18 +01:00
3 changed files with 35 additions and 16 deletions

View File

@@ -10,27 +10,40 @@ public class ReadmeGenerator {
// specs: https://web.archive.org/web/20190708132914/http://www.kleinlercher.at/tools/Windows_Protocols/Word2007RTFSpec9.pdf
private static final String RTF_HEADER = "{\\rtf1\\fbidis\\ansi\\uc0\\fs32\n";
private static final String RTF_FOOTER = "}";
private static final String HELP_URL = "{\\field{\\*\\fldinst HYPERLINK \"http://docs.cryptoamtor.org/\"}{\\fldrslt docs.cryptoamtor.org}}";
private static final String HEADING = "\\fs40\\qc %s";
private static final String EMPTY_PAR = "";
private static final String DONT_PAR = "\\b %s";
private static final String IDENT_PAR = " %s";
private static final String HELP_URL = "{\\field{\\*\\fldinst HYPERLINK \"http://docs.cryptoamtor.org/\"}{\\fldrslt http://docs.cryptoamtor.org}}";
private final ResourceBundle resourceBundle;
@Inject
public ReadmeGenerator(ResourceBundle resourceBundle){
public ReadmeGenerator(ResourceBundle resourceBundle) {
this.resourceBundle = resourceBundle;
}
public String createVaultStorageLocationReadmeRtf() {
return createDocument(List.of( //
resourceBundle.getString("addvault.new.readme.storageLocation.1"), //
String.format(HEADING, resourceBundle.getString("addvault.new.readme.storageLocation.1")), //
resourceBundle.getString("addvault.new.readme.storageLocation.2"), //
resourceBundle.getString("addvault.new.readme.storageLocation.3"), //
String.format(resourceBundle.getString("addvault.new.readme.storageLocation.4"), HELP_URL) //
EMPTY_PAR, //
String.format(DONT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.3")), //
String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.4")), //
String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.5")), //
EMPTY_PAR, //
resourceBundle.getString("addvault.new.readme.storageLocation.6"), //
String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.7")), //
String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.8")), //
String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.9")), //
EMPTY_PAR, //
String.format(resourceBundle.getString("addvault.new.readme.storageLocation.10"), HELP_URL) //
));
}
public String createVaultAccessLocationReadmeRtf() {
return createDocument(List.of( //
resourceBundle.getString("addvault.new.readme.accessLocation.1"), //
String.format(HEADING,resourceBundle.getString("addvault.new.readme.accessLocation.1")), //
resourceBundle.getString("addvault.new.readme.accessLocation.2"), //
resourceBundle.getString("addvault.new.readme.accessLocation.3") //
));
@@ -40,9 +53,9 @@ public class ReadmeGenerator {
String createDocument(Iterable<String> paragraphs) {
StringBuilder sb = new StringBuilder(RTF_HEADER);
for (String p : paragraphs) {
sb.append("\\par {\\sa80 ");
sb.append("{\\sa80 ");
appendEscaped(sb, p);
sb.append("}\n");
sb.append("}\\par \n");
}
sb.append(RTF_FOOTER);
return sb.toString();

View File

@@ -50,12 +50,18 @@ addvaultwizard.new.generateRecoveryKeyChoice=You won't be able to access your da
addvaultwizard.new.generateRecoveryKeyChoice.yes=Yes please, better safe than sorry
addvaultwizard.new.generateRecoveryKeyChoice.no=No thanks, I will not lose my password
### Information
addvault.new.readme.storageLocation.fileName=HELP.rtf
addvault.new.readme.storageLocation.1=\\fs40\\qc ⚠️ VAULT DIRECTORY ⚠️
addvault.new.readme.storageLocation.2=This is your vault's storage location. {\\b DO NOT} alter any files within this directory.
addvault.new.readme.storageLocation.3=If you want to encrypt files using Cryptomator, unlock the vault and use the provided drive.
addvault.new.readme.storageLocation.4=If you need help, try %s.
addvault.new.readme.accessLocation.fileName=WELCOME.rtf
addvault.new.readme.storageLocation.fileName=WHAT IS THIS DIRECTORY.rtf
addvault.new.readme.storageLocation.1=⚠️ VAULT FILES ⚠️
addvault.new.readme.storageLocation.2=This is your vault's storage location.
addvault.new.readme.storageLocation.3=DO NOT
addvault.new.readme.storageLocation.4=• alter any files within this directory or
addvault.new.readme.storageLocation.5=• paste any files for encrypttion into this directory
addvault.new.readme.storageLocation.6=If you want to encrypt files and view the content of the vault, do the following:
addvault.new.readme.storageLocation.7=1. Add this vault to Cryptomator
addvault.new.readme.storageLocation.8=2. Unlock the vault in Cryptomator
addvault.new.readme.storageLocation.9=3. Open the access location by clicking the "Reveal" button
addvault.new.readme.storageLocation.10=If you need help, read the documentation: %s
addvault.new.readme.accessLocation.1=\\fs40\\qc 🔐️ ENCRYPTED VOLUME 🔐️
addvault.new.readme.accessLocation.2=This is your vault's access location. Any files added to this volume will be encrypted by Cryptomator. To access this volume at a later point in time, simply unlock it again from within the Cryptomator application.
addvault.new.readme.accessLocation.3=Feel free to remove this file.

View File

@@ -37,9 +37,9 @@ public class ReadMeGeneratorTest {
String result = readmeGenerator.createDocument(paragraphs);
MatcherAssert.assertThat(result, CoreMatchers.startsWith("{\\rtf1\\fbidis\\ansi\\uc0\\fs32"));
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Dear User,}"));
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 \\b please don't touch the \"d\" directory.}"));
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Thank you for your cooperation \\u55357\\u56841}"));
MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 Dear User,}\\par"));
MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 \\b please don't touch the \"d\" directory.}\\par "));
MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 Thank you for your cooperation \\u55357\\u56841}\\par"));
MatcherAssert.assertThat(result, CoreMatchers.endsWith("}"));
}