diff options
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java b/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java index 69900293..02b54add 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java +++ b/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java @@ -149,7 +149,22 @@ public class AppRestrictions { } + private String prepare(String config) { + String newLine = System.getProperty("line.separator"); + if (!config.contains(newLine)&& !config.contains(" ")) { + try { + byte[] decoded = android.util.Base64.decode(config.getBytes(), android.util.Base64.DEFAULT); + config = new String(decoded); + return config; + } catch(IllegalArgumentException e) { + + } + } + return config; + }; + private void addProfile(Context c, String config, String uuid, String name, VpnProfile vpnProfile) { + config = prepare(config); ConfigParser cp = new ConfigParser(); try { cp.parseConfig(new StringReader(config)); |