diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 23:23:13 -0700 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-01-30 23:23:13 -0700 |
commit | fea68f17a1a69bc3710e1b1b743e0d0ded95234a (patch) | |
tree | 25e1ade33f2301fa923650ade16d1d3f0a006e25 | |
parent | 4bcb53cff01cb13530e1011fb6d5ac105be1ba25 (diff) |
FIXME!! Here there be dragons. Of the "fake data seeded by seedy functions" variety,
And there shady json files...Creates Issue #1593
-rw-r--r-- | assets/providers/bitmask.net_eip-service.json | 42 | ||||
-rw-r--r-- | assets/providers/bitmask.net_provider.json | 25 | ||||
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 51 |
3 files changed, 118 insertions, 0 deletions
diff --git a/assets/providers/bitmask.net_eip-service.json b/assets/providers/bitmask.net_eip-service.json new file mode 100644 index 00000000..6ac2fed6 --- /dev/null +++ b/assets/providers/bitmask.net_eip-service.json @@ -0,0 +1,42 @@ +{ + "clusters": [ + { + "label": { + "en": "Location Unknown" + }, + "name": "location_unknown" + } + ], + "gateways": [ + { + "capabilities": { + "adblock": false, + "filter_dns": true, + "ports": [ + "1194", + "443", + "53", + "80" + ], + "protocols": [ + "tcp", + "udp" + ], + "transport": [ + "openvpn" + ], + "user_ips": false + }, + "cluster": "location_unknown", + "host": "aligator.bitmask.net", + "ip_address": "176.53.69.121" + } + ], + "openvpn_configuration": { + "auth": "SHA1", + "cipher": "AES-128-CBC", + "tls-cipher": "DHE-RSA-AES128-SHA" + }, + "serial": 1, + "version": 1 +}
\ No newline at end of file diff --git a/assets/providers/bitmask.net_provider.json b/assets/providers/bitmask.net_provider.json new file mode 100644 index 00000000..d61be196 --- /dev/null +++ b/assets/providers/bitmask.net_provider.json @@ -0,0 +1,25 @@ +{ + "api_uri": "https://api.bitmask.net:4430", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: 0f17c033115f6b76ff67871872303ff65034efe7dd1b910062ca323eb4da5c7e", + "ca_cert_uri": "https://bitmask.net/ca.crt", + "default_language": "en", + "description": { + "el": "Bitmask είναι ένα έργο του LEAP με σκοπό τον έλεγχο της απόδοσης και της αξιοπιστίας του λογισμικού LEAP. Bitmask τρέχει για τις τελευταίες αιμορραγία άκρο του κώδικα LEAP, και θα έχει πιθανότατα περισσότερες δυνατότητες και λιγότερα αξιοπιστία από άλλους φορείς παροχής υπηρεσιών.", + "en": "Bitmask is a project of LEAP with the purpose to test the performance and reliability of the LEAP software. Bitmask runs on the latest bleeding edge of the LEAP code, and will likely have more features and less reliability than other service providers.", + "es": "Bitmask es un proyecto de LEAP con el propósito de probar el rendimiento y la fiabilidad del software LEAP. Bitmask corre la última versión del código LEAP, y es de esperar que tenga más funciones y menos fiabilidad que los proveedores de servicios." + }, + "domain": "bitmask.net", + "enrollment_policy": "open", + "languages": [ + "el", + "en", + "es" + ], + "name": { + "en": "Bitmask" + }, + "services": [ + "openvpn" + ] +}
\ No newline at end of file diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java index 3e8f35a4..cc215be9 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -36,6 +36,10 @@ public class Dashboard extends Activity { preferences = getPreferences(MODE_PRIVATE); + // FIXME provider data!! get parmegv's work so we can stop (or lessen) faking it + if ( !preferences.contains("provider") ) + fixmePrefsFaker(preferences); + // Get our provider provider = Provider.getInstance(preferences); @@ -45,6 +49,53 @@ public class Dashboard extends Activity { providerNameTV.setTextSize(28); // TODO maybe to some calculating, or a marquee? } + // FIXME!! We don't want you around here once we have something /real/ going on + private void fixmePrefsFaker(SharedPreferences fakeit) { + SharedPreferences.Editor fakes = fakeit.edit(); + + AssetManager am = getAssets(); + BufferedReader prov = null; + try { + prov = new BufferedReader(new InputStreamReader(am.open("providers/bitmask.net_provider.json"))); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + BufferedReader serv = null; + try { + serv = new BufferedReader(new InputStreamReader(am.open("providers/bitmask.net_eip-service.json"))); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + StringBuilder provider = new StringBuilder(); + StringBuilder eip = new StringBuilder(); + + String line; + try { + while ((line = prov.readLine()) != null){ + provider.append(line); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + String providerjson = provider.toString(); + try { + while ((line = serv.readLine()) != null){ + eip.append(line); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + String eipjson = eip.toString(); + + fakes.putString("provider", providerjson); + fakes.putString("eip", eipjson); + fakes.commit(); + } + @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. |