summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-12-26 11:53:13 +0100
committerAndrej Mihajlov <and@mullvad.net>2018-01-03 11:57:35 +0100
commit144b1ab2c94f9008cb1e350369ebdd4f684db688 (patch)
treee17768dc084190272dfdc08b7d348bb3998182a3 /app
parent21b53d23243336c6939d898897d605685efbada3 (diff)
downloadmullvadvpn-144b1ab2c94f9008cb1e350369ebdd4f684db688.tar.xz
mullvadvpn-144b1ab2c94f9008cb1e350369ebdd4f684db688.zip
Add allowLan to backend
Diffstat (limited to 'app')
-rw-r--r--app/lib/backend.js30
1 files changed, 28 insertions, 2 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index f78d359926..da87deced4 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -139,6 +139,12 @@ export class Backend {
log.error('Failed to fetch the location: ', e.message);
}
+ try {
+ await this._fetchAllowLan();
+ } catch(e) {
+ log.error('Failed to fetch the LAN sharing policy: ', e.message);
+ }
+
await this._fetchAccountHistory();
}
@@ -339,8 +345,6 @@ export class Backend {
}
}
-
-
async _fetchRelayLocations() {
await this._ensureAuthenticated();
@@ -395,6 +399,28 @@ export class Backend {
);
}
+ async setAllowLan(allowLan: boolean) {
+ try {
+ await this._ensureAuthenticated();
+ await this._ipc.setAllowLan(allowLan);
+
+ this._store.dispatch(
+ settingsActions.updateAllowLan(allowLan)
+ );
+ } catch(e) {
+ log.error('Failed to change the LAN sharing policy: ', e.message);
+ }
+ }
+
+ async _fetchAllowLan() {
+ await this._ensureAuthenticated();
+
+ const allowLan = await this._ipc.getAllowLan();
+ this._store.dispatch(
+ settingsActions.updateAllowLan(allowLan)
+ );
+ }
+
/**
* Start reachability monitoring for online/offline detection
* This is currently done via HTML5 APIs but will be replaced later