From 808f9d3542e21c819beb8fe72224f000ae2e019c Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 31 Aug 2017 10:58:59 +0200 Subject: [feat] expose an API to set/get/list gateway preferences - Related: #9010 --- ui/app/lib/bitmask.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'ui') diff --git a/ui/app/lib/bitmask.js b/ui/app/lib/bitmask.js index bfdf0501..7a97319b 100644 --- a/ui/app/lib/bitmask.js +++ b/ui/app/lib/bitmask.js @@ -289,6 +289,46 @@ var bitmask = function(){ uninstall: function() { return call(['vpn', 'uninstall']) } + + /** + * List VPN gateways + * + * They will be sorted in the order that they will be used + * + * @return {Promise<{provider_name: [{'name': string, + * 'country_code': string, + * 'location': string, + * ...}]}> + */ + list: function() { + return call(['vpn', 'list']) + } + + /** + * Get/set the location preference for the gateways + * + * @param {list} Order of preference of locations. + * If it's missing it will return the existing location list + */ + locations: function(locations) { + if (typeof locations !== 'list') { + locations = []; + } + return call(['vpn', 'locations'].concat(locations)) + } + + /** + * Get/set the country preference for the gateways + * + * @param {list} Order of preference of countries. + * If it's missing it will return the existing country list + */ + countries: function(countries) { + if (typeof countries !== 'list') { + countries = []; + } + return call(['vpn', 'countries'].concat(countries)) + } }, mail: { -- cgit v1.2.3