add some default file types to ignore

pull/62/head
Zlatin Balevsky 2021-06-03 17:22:38 +01:00
parent 34b7496036
commit 1c2972ecfc
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 12 additions and 5 deletions

View File

@ -157,7 +157,7 @@ class MuWireSettings {
allowMessages = Boolean.valueOf(props.getProperty("allowMessages","true")) allowMessages = Boolean.valueOf(props.getProperty("allowMessages","true"))
allowOnlyTrustedMessages = Boolean.valueOf(props.getProperty("allowOnlyTrustedMessages","false")) allowOnlyTrustedMessages = Boolean.valueOf(props.getProperty("allowOnlyTrustedMessages","false"))
ignoredFileTypes = DataUtil.readEncodedSet(props, "ignoredFileTypes") ignoredFileTypes = DataUtil.readEncodedSet(props, "ignoredFileTypes", "part,az!,ut!,!qb")
watchedDirectories = DataUtil.readEncodedSet(props, "watchedDirectories") watchedDirectories = DataUtil.readEncodedSet(props, "watchedDirectories")
watchedKeywords = DataUtil.readEncodedSet(props, "watchedKeywords") watchedKeywords = DataUtil.readEncodedSet(props, "watchedKeywords")
watchedRegexes = DataUtil.readEncodedSet(props, "watchedRegexes") watchedRegexes = DataUtil.readEncodedSet(props, "watchedRegexes")

View File

@ -190,17 +190,24 @@ public class DataUtil {
} }
public static Set<String> readEncodedSet(Properties props, String property) { public static Set<String> readEncodedSet(Properties props, String property) {
return readEncodedSet(props, property, null);
}
public static Set<String> readEncodedSet(Properties props, String property, String defaults) {
Set<String> rv = new ConcurrentHashSet<>(); Set<String> rv = new ConcurrentHashSet<>();
if (props.containsKey(property)) { if (props.containsKey(property)) {
String [] encoded = props.getProperty(property).split(","); String[] encoded = props.getProperty(property).split(",");
for(String s : encoded) for (String s : encoded)
rv.add(readi18nString(Base64.decode(s))); rv.add(readi18nString(Base64.decode(s)));
} else if (defaults != null) {
for (String s : defaults.split(","))
rv.add(s);
} }
return rv; return rv;
} }
public static void writeEncodedSet(Set<String> set, String property, Properties props) { public static void writeEncodedSet(Set<String> set, String property, Properties props) {
if (set.isEmpty()) if (set.isEmpty())
return; return;
String encoded = set.stream().map(s -> Base64.encode(encodei18nString(s))) String encoded = set.stream().map(s -> Base64.encode(encodei18nString(s)))
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));

View File

@ -297,7 +297,7 @@ OPTIONS_SHARING_SETTINGS=Sharing Settings
OPTIONS_SHARE_DOWNLOADED_FILES=Share downloaded files OPTIONS_SHARE_DOWNLOADED_FILES=Share downloaded files
OPTIONS_SHARE_HIDDEN_FILES=Share hidden files OPTIONS_SHARE_HIDDEN_FILES=Share hidden files
OPTIONS_HASHING_CORES=CPU Cores to use when hashing OPTIONS_HASHING_CORES=CPU Cores to use when hashing
OPTIONS_IGNORED_FILE_TYPES=File types to not share (comma-separated) OPTIONS_IGNORED_FILE_TYPES=File types to not share
OPTIONS_UPDATE_SETTINGS=Update Settings OPTIONS_UPDATE_SETTINGS=Update Settings
OPTIONS_CHECK_FOR_UPDATES=Check for updates every (hours) OPTIONS_CHECK_FOR_UPDATES=Check for updates every (hours)
OPTIONS_DOWNLOAD_UPDATES=Download updates automatically OPTIONS_DOWNLOAD_UPDATES=Download updates automatically