Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Disable UI by default. (#8105)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw authored and andresilva committed Mar 19, 2018
1 parent fc91ca8 commit 2c5aea4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
33 changes: 26 additions & 7 deletions parity/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ impl Configuration {
self.args.flag_geth ||
self.args.flag_no_ui;

!ui_disabled && cfg!(feature = "ui-enabled")
self.args.cmd_ui && !ui_disabled && cfg!(feature = "ui-enabled")
}

fn verifier_settings(&self) -> VerifierSettings {
Expand Down Expand Up @@ -1338,11 +1338,11 @@ mod tests {
origins: Some(vec!["parity://*".into(),"chrome-extension://*".into(), "moz-extension://*".into()]),
hosts: Some(vec![]),
signer_path: expected.into(),
ui_address: Some("127.0.0.1:8180".into()),
ui_address: None,
dapps_address: Some("127.0.0.1:8545".into()),
support_token_api: true
}, UiConfiguration {
enabled: true,
enabled: false,
interface: "127.0.0.1".into(),
port: 8180,
hosts: Some(vec![]),
Expand Down Expand Up @@ -1596,19 +1596,38 @@ mod tests {
let conf1 = parse(&["parity", "--ui-path=signer", "--ui-no-validation"]);
let conf2 = parse(&["parity", "--ui-path=signer", "--ui-port", "3123"]);
let conf3 = parse(&["parity", "--ui-path=signer", "--ui-interface", "test"]);
let conf4 = parse(&["parity", "--ui-path=signer", "--force-ui"]);
let conf5 = parse(&["parity", "--ui-path=signer", "ui"]);

// then
assert_eq!(conf0.directories().signer, "signer".to_owned());
assert_eq!(conf0.ui_config(), UiConfiguration {
enabled: false,
interface: "127.0.0.1".into(),
port: 8180,
hosts: Some(vec![]),
});
assert!(conf4.ws_config().unwrap().hosts.is_some());
assert_eq!(conf4.directories().signer, "signer".to_owned());
assert_eq!(conf4.ui_config(), UiConfiguration {
enabled: true,
interface: "127.0.0.1".into(),
port: 8180,
hosts: Some(vec![]),
});
assert!(conf0.ws_config().unwrap().hosts.is_some());
assert!(conf5.ws_config().unwrap().hosts.is_some());
assert!(conf5.ws_config().unwrap().hosts.is_some());
assert_eq!(conf5.directories().signer, "signer".to_owned());
assert_eq!(conf5.ui_config(), UiConfiguration {
enabled: true,
interface: "127.0.0.1".into(),
port: 8180,
hosts: Some(vec![]),
});
assert!(conf5.ws_config().unwrap().hosts.is_some());
assert_eq!(conf1.directories().signer, "signer".to_owned());
assert_eq!(conf1.ui_config(), UiConfiguration {
enabled: true,
enabled: false,
interface: "127.0.0.1".into(),
port: 8180,
hosts: Some(vec![]),
Expand All @@ -1617,15 +1636,15 @@ mod tests {
assert_eq!(conf1.ws_config().unwrap().origins, None);
assert_eq!(conf2.directories().signer, "signer".to_owned());
assert_eq!(conf2.ui_config(), UiConfiguration {
enabled: true,
enabled: false,
interface: "127.0.0.1".into(),
port: 3123,
hosts: Some(vec![]),
});
assert!(conf2.ws_config().unwrap().hosts.is_some());
assert_eq!(conf3.directories().signer, "signer".to_owned());
assert_eq!(conf3.ui_config(), UiConfiguration {
enabled: true,
enabled: false,
interface: "test".into(),
port: 8180,
hosts: Some(vec![]),
Expand Down
4 changes: 2 additions & 2 deletions parity/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl From<UiConfiguration> for HttpConfiguration {
impl Default for UiConfiguration {
fn default() -> Self {
UiConfiguration {
enabled: true && cfg!(feature = "ui-enabled"),
enabled: false,
port: 8180,
interface: "127.0.0.1".into(),
hosts: Some(vec![]),
Expand Down Expand Up @@ -166,7 +166,7 @@ impl Default for WsConfiguration {
hosts: Some(Vec::new()),
signer_path: replace_home(&data_dir, "$BASE/signer").into(),
support_token_api: true,
ui_address: Some("127.0.0.1:8180".into()),
ui_address: None,
dapps_address: Some("127.0.0.1:8545".into()),
}
}
Expand Down
5 changes: 5 additions & 0 deletions parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,11 @@ pub fn execute_impl(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>)
}

pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
if cmd.ui_conf.enabled {
warn!("Parity browser interface is deprecated. It's going to be removed in the next version, use standalone Parity Wallet instead.");
warn!("Standalone Parity Wallet: https://github.com/Parity-JS/shell/releases");
}

if cmd.ui && cmd.dapps_conf.enabled {
// Check if Parity is already running
let addr = format!("{}:{}", cmd.ui_conf.interface, cmd.ui_conf.port);
Expand Down

0 comments on commit 2c5aea4

Please sign in to comment.