Enable UI by default, but only display deprecation notice (#8262)
* Enable UI by default, but only display info page. * Fix test. * Fix naming and remove old todo. * Change "wallet" with "browser UI" * Update text, its not deprecated, its moved
This commit is contained in:
parent
bd7273061e
commit
8348147a4f
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -2037,6 +2037,7 @@ dependencies = [
|
||||
"parity-hash-fetch 1.11.0",
|
||||
"parity-reactor 0.1.0",
|
||||
"parity-ui 1.11.0",
|
||||
"parity-ui-deprecation 1.10.0",
|
||||
"parity-version 1.11.0",
|
||||
"parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2256,6 +2257,13 @@ dependencies = [
|
||||
"rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-ui-deprecation"
|
||||
version = "1.10.0"
|
||||
dependencies = [
|
||||
"parity-dapps-glue 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-ui-dev"
|
||||
version = "1.9.0"
|
||||
|
@ -35,6 +35,7 @@ node-health = { path = "./node-health" }
|
||||
parity-hash-fetch = { path = "../hash-fetch" }
|
||||
parity-reactor = { path = "../util/reactor" }
|
||||
parity-ui = { path = "./ui" }
|
||||
parity-ui-deprecation = { path = "./ui-deprecation" }
|
||||
keccak-hash = { path = "../util/hash" }
|
||||
parity-version = { path = "../util/version" }
|
||||
registrar = { path = "../registrar" }
|
||||
|
@ -23,7 +23,6 @@ use page;
|
||||
use proxypac::ProxyPac;
|
||||
use web::Web;
|
||||
use fetch::Fetch;
|
||||
use parity_ui;
|
||||
use {WebProxyTokens, ParentFrameSettings};
|
||||
|
||||
mod app;
|
||||
@ -43,11 +42,15 @@ pub const WEB_PATH: &'static str = "web";
|
||||
pub const URL_REFERER: &'static str = "__referer=";
|
||||
|
||||
pub fn utils(pool: CpuPool) -> Box<Endpoint> {
|
||||
Box::new(page::builtin::Dapp::new(pool, parity_ui::App::default()))
|
||||
Box::new(page::builtin::Dapp::new(pool, ::parity_ui::App::default()))
|
||||
}
|
||||
|
||||
pub fn ui(pool: CpuPool) -> Box<Endpoint> {
|
||||
Box::new(page::builtin::Dapp::with_fallback_to_index(pool, parity_ui::App::default()))
|
||||
Box::new(page::builtin::Dapp::with_fallback_to_index(pool, ::parity_ui::App::default()))
|
||||
}
|
||||
|
||||
pub fn ui_deprecation(pool: CpuPool) -> Box<Endpoint> {
|
||||
Box::new(page::builtin::Dapp::with_fallback_to_index(pool, ::parity_ui_deprecation::App::default()))
|
||||
}
|
||||
|
||||
pub fn ui_redirection(embeddable: Option<ParentFrameSettings>) -> Box<Endpoint> {
|
||||
@ -77,13 +80,13 @@ pub fn all_endpoints<F: Fetch>(
|
||||
// NOTE [ToDr] Dapps will be currently embeded on 8180
|
||||
pages.insert(
|
||||
"ui".into(),
|
||||
Box::new(page::builtin::Dapp::new_safe_to_embed(pool.clone(), parity_ui::App::default(), embeddable.clone()))
|
||||
Box::new(page::builtin::Dapp::new_safe_to_embed(pool.clone(), ::parity_ui::App::default(), embeddable.clone()))
|
||||
);
|
||||
// old version
|
||||
pages.insert(
|
||||
"v1".into(),
|
||||
Box::new({
|
||||
let mut page = page::builtin::Dapp::new_safe_to_embed(pool.clone(), parity_ui::old::App::default(), embeddable.clone());
|
||||
let mut page = page::builtin::Dapp::new_safe_to_embed(pool.clone(), ::parity_ui::old::App::default(), embeddable.clone());
|
||||
// allow JS eval on old Wallet
|
||||
page.allow_js_eval();
|
||||
page
|
||||
|
@ -39,6 +39,7 @@ extern crate node_health;
|
||||
extern crate parity_dapps_glue as parity_dapps;
|
||||
extern crate parity_hash_fetch as hash_fetch;
|
||||
extern crate parity_ui;
|
||||
extern crate parity_ui_deprecation;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate parity_version;
|
||||
extern crate registrar;
|
||||
@ -159,6 +160,7 @@ impl Middleware {
|
||||
registrar: Arc<RegistrarClient<Call=Asynchronous>>,
|
||||
sync_status: Arc<SyncStatus>,
|
||||
fetch: F,
|
||||
info_page_only: bool,
|
||||
) -> Self {
|
||||
let content_fetcher = Arc::new(apps::fetcher::ContentFetcher::new(
|
||||
hash_fetch::urlhint::URLHintContract::new(registrar),
|
||||
@ -166,6 +168,23 @@ impl Middleware {
|
||||
fetch.clone(),
|
||||
pool.clone(),
|
||||
).embeddable_on(None).allow_dapps(false));
|
||||
|
||||
if info_page_only {
|
||||
let mut special = HashMap::default();
|
||||
special.insert(router::SpecialEndpoint::Home, Some(apps::ui_deprecation(pool.clone())));
|
||||
|
||||
return Middleware {
|
||||
endpoints: Default::default(),
|
||||
router: router::Router::new(
|
||||
content_fetcher,
|
||||
None,
|
||||
special,
|
||||
None,
|
||||
dapps_domain.to_owned(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
let special = {
|
||||
let mut special = special_endpoints(
|
||||
pool.clone(),
|
||||
|
@ -150,10 +150,20 @@ impl Router {
|
||||
}
|
||||
},
|
||||
// RPC by default
|
||||
_ => {
|
||||
_ if self.special.contains_key(&SpecialEndpoint::Rpc) => {
|
||||
trace!(target: "dapps", "Resolving to RPC call.");
|
||||
Response::None(req)
|
||||
}
|
||||
},
|
||||
// 404 otherwise
|
||||
_ => {
|
||||
Response::Some(Box::new(future::ok(handlers::ContentHandler::error(
|
||||
hyper::StatusCode::NotFound,
|
||||
"404 Not Found",
|
||||
"Requested content was not found.",
|
||||
None,
|
||||
self.embeddable_on.clone(),
|
||||
).into())))
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -240,6 +240,7 @@ impl Server {
|
||||
registrar,
|
||||
sync_status,
|
||||
fetch,
|
||||
false,
|
||||
)
|
||||
} else {
|
||||
Middleware::dapps(
|
||||
|
18
dapps/ui-deprecation/Cargo.toml
Normal file
18
dapps/ui-deprecation/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
||||
[package]
|
||||
description = "Parity UI deprecation notice."
|
||||
name = "parity-ui-deprecation"
|
||||
version = "1.10.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[features]
|
||||
default = ["with-syntex", "use-precompiled-js"]
|
||||
use-precompiled-js = ["parity-dapps-glue/use-precompiled-js"]
|
||||
with-syntex = ["parity-dapps-glue/with-syntex"]
|
||||
|
||||
[build-dependencies]
|
||||
parity-dapps-glue = "1.9"
|
||||
|
||||
[dependencies]
|
||||
parity-dapps-glue = "1.9"
|
21
dapps/ui-deprecation/build.rs
Normal file
21
dapps/ui-deprecation/build.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate parity_dapps_glue;
|
||||
|
||||
fn main() {
|
||||
parity_dapps_glue::generate();
|
||||
}
|
119
dapps/ui-deprecation/build/index.html
Normal file
119
dapps/ui-deprecation/build/index.html
Normal file
@ -0,0 +1,119 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>Parity</title>
|
||||
<style>
|
||||
/* Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||
/* This file is part of Parity.
|
||||
/*
|
||||
/* Parity is free software: you can redistribute it and/or modify
|
||||
/* it under the terms of the GNU General Public License as published by
|
||||
/* the Free Software Foundation, either version 3 of the License, or
|
||||
/* (at your option) any later version.
|
||||
/*
|
||||
/* Parity is distributed in the hope that it will be useful,
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
/* GNU General Public License for more details.
|
||||
/*
|
||||
/* You should have received a copy of the GNU General Public License
|
||||
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
:root, :root body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
background: rgb(95, 95, 95);
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
font-size: 16px;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
:root a, :root a:visited {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
color: rgb(0, 151, 167); /* #f80 */
|
||||
}
|
||||
|
||||
:root a:hover {
|
||||
color: rgb(0, 174, 193);
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-weight: 300;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
color: rgb(0, 151, 167);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
code,kbd,pre,samp {
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
}
|
||||
|
||||
.parity-navbar {
|
||||
background: rgb(65, 65, 65);
|
||||
height: 72px;
|
||||
padding: 0 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.parity-status {
|
||||
clear: both;
|
||||
padding: 1rem;
|
||||
margin: 1rem 0;
|
||||
text-align: right;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.parity-box {
|
||||
margin: 1rem;
|
||||
padding: 1rem;
|
||||
background-color: rgb(48, 48, 48);
|
||||
box-sizing: border-box;
|
||||
box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
|
||||
border-radius: 2px;
|
||||
z-index: 1;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.parity-box h1,
|
||||
.parity-box h2,
|
||||
.parity-box h3,
|
||||
.parity-box h4,
|
||||
.parity-box h5,
|
||||
.parity-box h6 {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="parity-navbar">
|
||||
</div>
|
||||
<div class="parity-box">
|
||||
<h1>The Parity UI has been split off into a standalone project.</h1>
|
||||
<h3>Get the standalone Parity UI from <a href="https://github.com/Parity-JS/shell/releases">here</a></h3>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="parity-status">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
21
dapps/ui-deprecation/src/lib.rs
Normal file
21
dapps/ui-deprecation/src/lib.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#[cfg(feature = "with-syntex")]
|
||||
include!(concat!(env!("OUT_DIR"), "/lib.rs"));
|
||||
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
include!("lib.rs.in");
|
55
dapps/ui-deprecation/src/lib.rs.in
Normal file
55
dapps/ui-deprecation/src/lib.rs.in
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate parity_dapps_glue;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use parity_dapps_glue::{WebApp, File, Info};
|
||||
|
||||
#[derive(WebAppFiles)]
|
||||
#[webapp(path = "../build")]
|
||||
pub struct App {
|
||||
pub files: HashMap<&'static str, File>,
|
||||
}
|
||||
|
||||
impl Default for App {
|
||||
fn default() -> App {
|
||||
App {
|
||||
files: Self::files(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WebApp for App {
|
||||
fn file(&self, path: &str) -> Option<&File> {
|
||||
self.files.get(path)
|
||||
}
|
||||
|
||||
fn info(&self) -> Info {
|
||||
Info {
|
||||
name: "Parity Wallet info page",
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
author: "Parity <admin@parity.io>",
|
||||
description: "Deprecation notice for Parity Wallet",
|
||||
icon_url: "icon.png",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_js() {
|
||||
parity_dapps_glue::js::build(env!("CARGO_MANIFEST_DIR"), "build");
|
||||
}
|
@ -581,11 +581,13 @@ impl Configuration {
|
||||
}
|
||||
|
||||
fn ui_config(&self) -> UiConfiguration {
|
||||
let ui = self.ui_enabled();
|
||||
UiConfiguration {
|
||||
enabled: self.ui_enabled(),
|
||||
enabled: ui.enabled,
|
||||
interface: self.ui_interface(),
|
||||
port: self.ui_port(),
|
||||
hosts: self.ui_hosts(),
|
||||
info_page_only: ui.info_page_only,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1176,16 +1178,22 @@ impl Configuration {
|
||||
into_secretstore_service_contract_address(self.args.arg_secretstore_doc_sretr_contract.as_ref())
|
||||
}
|
||||
|
||||
fn ui_enabled(&self) -> bool {
|
||||
fn ui_enabled(&self) -> UiEnabled {
|
||||
if self.args.flag_force_ui {
|
||||
return true;
|
||||
return UiEnabled {
|
||||
enabled: true,
|
||||
info_page_only: false,
|
||||
};
|
||||
}
|
||||
|
||||
let ui_disabled = self.args.arg_unlock.is_some() ||
|
||||
self.args.flag_geth ||
|
||||
self.args.flag_no_ui;
|
||||
|
||||
self.args.cmd_ui && !ui_disabled && cfg!(feature = "ui-enabled")
|
||||
return UiEnabled {
|
||||
enabled: (self.args.cmd_ui || !ui_disabled) && cfg!(feature = "ui-enabled"),
|
||||
info_page_only: !self.args.cmd_ui,
|
||||
}
|
||||
}
|
||||
|
||||
fn verifier_settings(&self) -> VerifierSettings {
|
||||
@ -1206,6 +1214,12 @@ impl Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
struct UiEnabled {
|
||||
pub enabled: bool,
|
||||
pub info_page_only: bool,
|
||||
}
|
||||
|
||||
fn into_secretstore_service_contract_address(s: &str) -> Result<Option<SecretStoreContractAddress>, String> {
|
||||
match s {
|
||||
"none" => Ok(None),
|
||||
@ -1418,15 +1432,16 @@ mod tests {
|
||||
origins: Some(vec!["parity://*".into(),"chrome-extension://*".into(), "moz-extension://*".into()]),
|
||||
hosts: Some(vec![]),
|
||||
signer_path: expected.into(),
|
||||
ui_address: None,
|
||||
ui_address: Some("127.0.0.1:8180".into()),
|
||||
dapps_address: Some("127.0.0.1:8545".into()),
|
||||
support_token_api: true,
|
||||
max_connections: 100,
|
||||
}, UiConfiguration {
|
||||
enabled: false,
|
||||
enabled: true,
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
}, LogConfig {
|
||||
color: true,
|
||||
mode: None,
|
||||
@ -1698,10 +1713,26 @@ mod tests {
|
||||
// when
|
||||
let conf0 = parse(&["parity", "--geth"]);
|
||||
let conf1 = parse(&["parity", "--geth", "--force-ui"]);
|
||||
let conf2 = parse(&["parity", "--geth", "ui"]);
|
||||
let conf3 = parse(&["parity"]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ui_enabled(), false);
|
||||
assert_eq!(conf1.ui_enabled(), true);
|
||||
assert_eq!(conf0.ui_enabled(), UiEnabled {
|
||||
enabled: false,
|
||||
info_page_only: true,
|
||||
});
|
||||
assert_eq!(conf1.ui_enabled(), UiEnabled {
|
||||
enabled: true,
|
||||
info_page_only: false,
|
||||
});
|
||||
assert_eq!(conf2.ui_enabled(), UiEnabled {
|
||||
enabled: true,
|
||||
info_page_only: false,
|
||||
});
|
||||
assert_eq!(conf3.ui_enabled(), UiEnabled {
|
||||
enabled: true,
|
||||
info_page_only: true,
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1712,7 +1743,10 @@ mod tests {
|
||||
let conf0 = parse(&["parity", "--unlock", "0x0"]);
|
||||
|
||||
// then
|
||||
assert_eq!(conf0.ui_enabled(), false);
|
||||
assert_eq!(conf0.ui_enabled(), UiEnabled {
|
||||
enabled: false,
|
||||
info_page_only: true,
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1730,11 +1764,45 @@ mod tests {
|
||||
// then
|
||||
assert_eq!(conf0.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf0.ui_config(), UiConfiguration {
|
||||
enabled: false,
|
||||
enabled: true,
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
});
|
||||
|
||||
assert!(conf1.ws_config().unwrap().hosts.is_some());
|
||||
assert_eq!(conf1.ws_config().unwrap().origins, None);
|
||||
assert_eq!(conf1.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf1.ui_config(), UiConfiguration {
|
||||
enabled: true,
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
});
|
||||
assert_eq!(conf1.dapps_config().extra_embed_on, vec![("127.0.0.1".to_owned(), 3000)]);
|
||||
|
||||
assert!(conf2.ws_config().unwrap().hosts.is_some());
|
||||
assert_eq!(conf2.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf2.ui_config(), UiConfiguration {
|
||||
enabled: true,
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 3123,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
});
|
||||
|
||||
assert!(conf3.ws_config().unwrap().hosts.is_some());
|
||||
assert_eq!(conf3.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf3.ui_config(), UiConfiguration {
|
||||
enabled: true,
|
||||
interface: "test".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
});
|
||||
|
||||
assert!(conf4.ws_config().unwrap().hosts.is_some());
|
||||
assert_eq!(conf4.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf4.ui_config(), UiConfiguration {
|
||||
@ -1742,8 +1810,9 @@ mod tests {
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: false,
|
||||
});
|
||||
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 {
|
||||
@ -1751,33 +1820,8 @@ mod tests {
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: false,
|
||||
});
|
||||
assert!(conf5.ws_config().unwrap().hosts.is_some());
|
||||
assert_eq!(conf1.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf1.ui_config(), UiConfiguration {
|
||||
enabled: false,
|
||||
interface: "127.0.0.1".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
});
|
||||
assert_eq!(conf1.dapps_config().extra_embed_on, vec![("127.0.0.1".to_owned(), 3000)]);
|
||||
assert_eq!(conf1.ws_config().unwrap().origins, None);
|
||||
assert_eq!(conf2.directories().signer, "signer".to_owned());
|
||||
assert_eq!(conf2.ui_config(), UiConfiguration {
|
||||
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: false,
|
||||
interface: "test".into(),
|
||||
port: 8180,
|
||||
hosts: Some(vec![]),
|
||||
});
|
||||
assert!(conf3.ws_config().unwrap().hosts.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -164,6 +164,7 @@ pub struct Dependencies {
|
||||
pub pool: CpuPool,
|
||||
pub signer: Arc<SignerService>,
|
||||
pub ui_address: Option<(String, u16)>,
|
||||
pub info_page_only: bool,
|
||||
}
|
||||
|
||||
pub fn new(configuration: Configuration, deps: Dependencies) -> Result<Option<Middleware>, String> {
|
||||
@ -281,6 +282,7 @@ mod server {
|
||||
deps.contract_client,
|
||||
deps.sync_status,
|
||||
deps.fetch,
|
||||
deps.info_page_only,
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ pub struct UiConfiguration {
|
||||
pub interface: String,
|
||||
pub port: u16,
|
||||
pub hosts: Option<Vec<String>>,
|
||||
pub info_page_only: bool,
|
||||
}
|
||||
|
||||
impl UiConfiguration {
|
||||
@ -110,10 +111,11 @@ impl From<UiConfiguration> for HttpConfiguration {
|
||||
impl Default for UiConfiguration {
|
||||
fn default() -> Self {
|
||||
UiConfiguration {
|
||||
enabled: false,
|
||||
enabled: cfg!(feature = "ui-enabled"),
|
||||
port: 8180,
|
||||
interface: "127.0.0.1".into(),
|
||||
hosts: Some(vec![]),
|
||||
info_page_only: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,7 +170,7 @@ impl Default for WsConfiguration {
|
||||
hosts: Some(Vec::new()),
|
||||
signer_path: replace_home(&data_dir, "$BASE/signer").into(),
|
||||
support_token_api: true,
|
||||
ui_address: None,
|
||||
ui_address: Some("127.0.0.1:8180".into()),
|
||||
dapps_address: Some("127.0.0.1:8545".into()),
|
||||
}
|
||||
}
|
||||
|
@ -365,6 +365,7 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<Runnin
|
||||
pool: cpu_pool.clone(),
|
||||
signer: signer_service.clone(),
|
||||
ui_address: cmd.ui_conf.redirection_address(),
|
||||
info_page_only: cmd.ui_conf.info_page_only,
|
||||
})
|
||||
};
|
||||
|
||||
@ -793,6 +794,7 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
|
||||
pool: cpu_pool.clone(),
|
||||
signer: signer_service.clone(),
|
||||
ui_address: cmd.ui_conf.redirection_address(),
|
||||
info_page_only: cmd.ui_conf.info_page_only,
|
||||
})
|
||||
};
|
||||
let dapps_middleware = dapps::new(cmd.dapps_conf.clone(), dapps_deps.clone())?;
|
||||
@ -970,7 +972,7 @@ impl RunningClient {
|
||||
}
|
||||
|
||||
pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
|
||||
if cmd.ui_conf.enabled {
|
||||
if cmd.ui_conf.enabled && !cmd.ui_conf.info_page_only {
|
||||
warn!("{}", Style::new().bold().paint("Parity browser interface is deprecated. It's going to be removed in the next version, use standalone Parity UI instead."));
|
||||
warn!("{}", Style::new().bold().paint("Standalone Parity UI: https://github.com/Parity-JS/shell/releases"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user