diff --git a/Cargo.lock b/Cargo.lock index 2d5285cb0..383dbdfa1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,10 +284,10 @@ dependencies = [ "jsonrpc-http-server 5.1.0 (git+https://github.com/ethcore/jsonrpc-http-server.git)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)", - "parity-dapps-builtins 0.5.2 (git+https://github.com/ethcore/parity-dapps-builtins-rs.git)", - "parity-dapps-status 0.5.1 (git+https://github.com/ethcore/parity-dapps-status-rs.git)", - "parity-dapps-wallet 0.6.1 (git+https://github.com/ethcore/parity-dapps-wallet-rs.git)", + "parity-dapps 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", + "parity-dapps-home 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", + "parity-dapps-status 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", + "parity-dapps-wallet 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -367,7 +367,7 @@ dependencies = [ "ethcore-util 1.2.2", "jsonrpc-core 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-minimal-sysui 0.2.0 (git+https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git)", + "parity-dapps-signer 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.5.0 (git+https://github.com/ethcore/ws-rs.git?branch=stable)", @@ -897,8 +897,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-dapps" -version = "0.3.0" -source = "git+https://github.com/ethcore/parity-dapps-rs.git#8cc812c26c903cf5764ce0f4cc3f2a7c3ddb0dc2" +version = "0.6.0" +source = "git+https://github.com/ethcore/parity-ui.git#7120546d08d4d9eb648e255c04935002223d362f" dependencies = [ "aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -910,34 +910,37 @@ dependencies = [ ] [[package]] -name = "parity-dapps-builtins" -version = "0.5.2" -source = "git+https://github.com/ethcore/parity-dapps-builtins-rs.git#01af2091d5d70dfe0aecbfd96308f0ae79fc61e6" +name = "parity-dapps-home" +version = "0.6.0" +source = "git+https://github.com/ethcore/parity-ui.git#7120546d08d4d9eb648e255c04935002223d362f" dependencies = [ - "parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)", + "parity-dapps 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", +] + +[[package]] +name = "parity-dapps-signer" +version = "0.6.0" +source = "git+https://github.com/ethcore/parity-ui.git#7120546d08d4d9eb648e255c04935002223d362f" +dependencies = [ + "parity-dapps 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", ] [[package]] name = "parity-dapps-status" -version = "0.5.1" -source = "git+https://github.com/ethcore/parity-dapps-status-rs.git#110ef2e66142ec8dc15fc40b8ddda5ed3bcfc1fb" +version = "0.6.0" +source = "git+https://github.com/ethcore/parity-ui.git#7120546d08d4d9eb648e255c04935002223d362f" dependencies = [ - "parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)", + "parity-dapps 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", ] [[package]] name = "parity-dapps-wallet" -version = "0.6.1" -source = "git+https://github.com/ethcore/parity-dapps-wallet-rs.git#867994fe25038f000f1cc09cd024a83700a03930" +version = "0.6.0" +source = "git+https://github.com/ethcore/parity-ui.git#7120546d08d4d9eb648e255c04935002223d362f" dependencies = [ - "parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)", + "parity-dapps 0.6.0 (git+https://github.com/ethcore/parity-ui.git)", ] -[[package]] -name = "parity-minimal-sysui" -version = "0.2.0" -source = "git+https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git#996c9f3f0ebedc727aecb4ece191154e956ae292" - [[package]] name = "phf" version = "0.7.14" diff --git a/Cargo.toml b/Cargo.toml index 2cb60c0f1..008d54b6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,9 +47,11 @@ version = "0.8" default-features = false [features] -default = ["rpc", "dapps", "ethcore-signer"] -rpc = ["ethcore-rpc"] +default = ["rpc", "ethcore-signer", "ui", "use-precompiled-js"] +ui = ["dapps", "ethcore-signer/ui"] +use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"] dapps = ["ethcore-dapps"] +rpc = ["ethcore-rpc"] dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethcore-dapps/dev", "ethcore-signer/dev"] travis-beta = ["ethcore/json-tests"] diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 92df62cd7..d12e2aa23 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -20,13 +20,11 @@ serde_json = "0.7.0" serde_macros = { version = "0.7.0", optional = true } ethcore-rpc = { path = "../rpc" } ethcore-util = { path = "../util" } -parity-dapps = { git = "https://github.com/ethcore/parity-dapps-rs.git", version = "0.3" } +parity-dapps = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6" } # List of apps -parity-dapps-status = { git = "https://github.com/ethcore/parity-dapps-status-rs.git", version = "0.5.1" } -parity-dapps-builtins = { git = "https://github.com/ethcore/parity-dapps-builtins-rs.git", version = "0.5.2" } -parity-dapps-wallet = { git = "https://github.com/ethcore/parity-dapps-wallet-rs.git", version = "0.6.0", optional = true } -parity-dapps-dao = { git = "https://github.com/ethcore/parity-dapps-dao-rs.git", version = "0.4.0", optional = true } -parity-dapps-makerotc = { git = "https://github.com/ethcore/parity-dapps-makerotc-rs.git", version = "0.3.0", optional = true } +parity-dapps-status = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6" } +parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6" } +parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6", optional = true } mime_guess = { version = "1.6.1" } clippy = { version = "0.0.77", optional = true} @@ -39,3 +37,9 @@ default = ["serde_codegen", "extra-dapps"] extra-dapps = ["parity-dapps-wallet"] nightly = ["serde_macros"] dev = ["clippy", "ethcore-rpc/dev", "ethcore-util/dev"] + +use-precompiled-js = [ + "parity-dapps-status/use-precompiled-js", + "parity-dapps-home/use-precompiled-js", + "parity-dapps-wallet/use-precompiled-js" +] diff --git a/dapps/src/apps/mod.rs b/dapps/src/apps/mod.rs index 9f6a5c745..50bdd2073 100644 --- a/dapps/src/apps/mod.rs +++ b/dapps/src/apps/mod.rs @@ -22,7 +22,7 @@ use parity_dapps::WebApp; mod fs; extern crate parity_dapps_status; -extern crate parity_dapps_builtins; +extern crate parity_dapps_home; pub const DAPPS_DOMAIN : &'static str = ".parity"; pub const RPC_PATH : &'static str = "rpc"; @@ -34,7 +34,7 @@ pub fn main_page() -> &'static str { } pub fn utils() -> Box { - Box::new(PageEndpoint::with_prefix(parity_dapps_builtins::App::default(), UTILS_PATH.to_owned())) + Box::new(PageEndpoint::with_prefix(parity_dapps_home::App::default(), UTILS_PATH.to_owned())) } pub fn all_endpoints(dapps_path: String) -> Endpoints { @@ -44,7 +44,7 @@ pub fn all_endpoints(dapps_path: String) -> Endpoints { // because we use Cross-Origin LocalStorage. // TODO [ToDr] Account naming should be moved to parity. pages.insert("home".into(), Box::new( - PageEndpoint::new_safe_to_embed(parity_dapps_builtins::App::default()) + PageEndpoint::new_safe_to_embed(parity_dapps_home::App::default()) )); pages.insert("proxy".into(), ProxyPac::boxed()); insert::(&mut pages, "parity"); @@ -52,8 +52,6 @@ pub fn all_endpoints(dapps_path: String) -> Endpoints { // Optional dapps wallet_page(&mut pages); - daodapp_page(&mut pages); - makerotc_page(&mut pages); pages } @@ -66,22 +64,6 @@ fn wallet_page(pages: &mut Endpoints) { #[cfg(not(feature = "parity-dapps-wallet"))] fn wallet_page(_pages: &mut Endpoints) {} -#[cfg(feature = "parity-dapps-dao")] -fn daodapp_page(pages: &mut Endpoints) { - extern crate parity_dapps_dao; - insert::(pages, "dao"); -} -#[cfg(not(feature = "parity-dapps-dao"))] -fn daodapp_page(_pages: &mut Endpoints) {} - -#[cfg(feature = "parity-dapps-makerotc")] -fn makerotc_page(pages: &mut Endpoints) { - extern crate parity_dapps_makerotc; - insert::(pages, "makerotc"); -} -#[cfg(not(feature = "parity-dapps-makerotc"))] -fn makerotc_page(_pages: &mut Endpoints) {} - fn insert(pages: &mut Endpoints, id: &str) { pages.insert(id.to_owned(), Box::new(PageEndpoint::new(T::default()))); } diff --git a/ethcore/src/types/transaction.rs b/ethcore/src/types/transaction.rs index a8e1c66e4..ebb82c528 100644 --- a/ethcore/src/types/transaction.rs +++ b/ethcore/src/types/transaction.rs @@ -91,7 +91,7 @@ impl Transaction { impl From for SignedTransaction { fn from(t: ethjson::state::Transaction) -> Self { - let to: Option<_> = t.to.into(); + let to: Option = t.to.into(); Transaction { nonce: t.nonce.into(), gas_price: t.gas_price.into(), @@ -108,7 +108,7 @@ impl From for SignedTransaction { impl From for SignedTransaction { fn from(t: ethjson::transaction::Transaction) -> Self { - let to: Option<_> = t.to.into(); + let to: Option = t.to.into(); SignedTransaction { unsigned: Transaction { nonce: t.nonce.into(), diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 618965a15..a90129a6b 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -18,9 +18,11 @@ env_logger = "0.3" ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "stable" } ethcore-util = { path = "../util" } ethcore-rpc = { path = "../rpc" } -parity-minimal-sysui = { git = "https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git", version = "0.2.0" } +parity-dapps-signer = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6", optional = true} clippy = { version = "0.0.77", optional = true} [features] dev = ["clippy"] +ui = ["parity-dapps-signer"] +use-precompiled-js = ["parity-dapps-signer/use-precompiled-js"] diff --git a/signer/src/lib.rs b/signer/src/lib.rs index 3aaed8bcf..246020874 100644 --- a/signer/src/lib.rs +++ b/signer/src/lib.rs @@ -51,7 +51,8 @@ extern crate ethcore_util as util; extern crate ethcore_rpc as rpc; extern crate jsonrpc_core; extern crate ws; -extern crate parity_minimal_sysui as sysui; +#[cfg(feature = "ui")] +extern crate parity_dapps_signer as signer; mod authcode_store; mod ws_server; diff --git a/signer/src/ws_server/session.rs b/signer/src/ws_server/session.rs index 4b2eb808c..73d38656f 100644 --- a/signer/src/ws_server/session.rs +++ b/signer/src/ws_server/session.rs @@ -17,7 +17,6 @@ //! Session handlers factory. use ws; -use sysui; use authcode_store::AuthCodes; use std::path::{PathBuf, Path}; use std::sync::Arc; @@ -25,6 +24,26 @@ use std::str::FromStr; use jsonrpc_core::IoHandler; use util::H256; +#[cfg(feature = "ui")] +mod signer { + use signer; + + pub fn handle(req: &str) -> Option { + signer::handle(req) + } +} +#[cfg(not(feature = "ui"))] +mod signer { + pub struct File { + pub content: String, + pub mime: String, + } + + pub fn handle(_req: &str) -> Option { + None + } +} + fn origin_is_allowed(self_origin: &str, header: Option<&Vec>) -> bool { match header { None => false, @@ -111,7 +130,7 @@ impl ws::Handler for Session { } // Otherwise try to serve a page. - Ok(sysui::handle(req.resource()) + Ok(signer::handle(req.resource()) .map_or_else( // return 404 not found || add_headers(ws::Response::not_found("Not found".into()), "text/plain"),