Disable UI by default. (#8105)

This commit is contained in:
Tomasz Drwięga 2018-03-19 18:11:00 +01:00 committed by GitHub
parent e25a660a11
commit beb6438ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 9 deletions

View File

@ -1114,7 +1114,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 {
@ -1339,11 +1339,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![]),
@ -1619,19 +1619,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![]),
@ -1640,7 +1659,7 @@ 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![]),
@ -1648,7 +1667,7 @@ mod tests {
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![]),

View File

@ -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![]),
@ -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()),
}
}

View File

@ -892,6 +892,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);