summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-daemon/src/management_interface.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index 8a6cddf420..95e5c99833 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -103,10 +103,14 @@ build_rpc_trait! {
#[rpc(meta, name = "shutdown")]
fn shutdown(&self, Self::Metadata) -> BoxFuture<(), Error>;
- /// Get previously used account tokens
+ /// Get previously used account tokens from the account history
#[rpc(meta, name = "get_account_history")]
fn get_account_history(&self, Self::Metadata) -> BoxFuture<Vec<AccountToken>, Error>;
+ /// Remove given account token from the account history
+ #[rpc(meta, name = "remove_account_from_history")]
+ fn remove_account_from_history(&self, Self::Metadata, AccountToken) -> BoxFuture<(), Error>;
+
#[pubsub(name = "new_state")] {
/// Subscribes to the `new_state` event notifications.
#[rpc(name = "new_state_subscribe")]
@@ -495,6 +499,28 @@ impl<T: From<TunnelCommand> + 'static + Send> ManagementInterfaceApi for Managem
))
}
+ fn remove_account_from_history(
+ &self,
+ meta: Self::Metadata,
+ account_token: AccountToken,
+ ) -> BoxFuture<(), Error> {
+ trace!("remove_account_from_history");
+ try_future!(self.check_auth(&meta));
+ Box::new(future::result(
+ AccountHistory::load()
+ .and_then(|mut account_history| {
+ account_history.remove_account_token(account_token)
+ })
+ .map_err(|error| {
+ error!(
+ "Unable to remove account from history: {}",
+ error.display_chain()
+ );
+ Error::internal_error()
+ }),
+ ))
+ }
+
fn new_state_subscribe(
&self,
meta: Self::Metadata,