No-ui compilation feature
This commit is contained in:
parent
b37ceccf02
commit
11cae70cdd
@ -49,6 +49,7 @@ default-features = false
|
||||
|
||||
[features]
|
||||
default = ["dapps"]
|
||||
no-ui = ["ethcore-signer/no-ui"]
|
||||
dapps = ["ethcore-dapps"]
|
||||
dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev",
|
||||
"ethcore-dapps/dev", "ethcore-signer/dev"]
|
||||
|
@ -561,7 +561,7 @@ impl Configuration {
|
||||
}
|
||||
|
||||
pub fn dapps_enabled(&self) -> bool {
|
||||
!self.args.flag_dapps_off && !self.args.flag_no_dapps
|
||||
!self.args.flag_dapps_off && !self.args.flag_no_dapps && cfg!(not(feature = "no-ui"))
|
||||
}
|
||||
|
||||
pub fn signer_enabled(&self) -> bool {
|
||||
|
@ -21,9 +21,9 @@ use util::panics::PanicHandler;
|
||||
use die::*;
|
||||
use rpc_apis;
|
||||
|
||||
#[cfg(feature = "dapps")]
|
||||
#[cfg(all(feature = "dapps", not(feature = "no-ui")))]
|
||||
pub use ethcore_dapps::Server as WebappServer;
|
||||
#[cfg(not(feature = "dapps"))]
|
||||
#[cfg(any(not(feature = "dapps"), feature = "no-ui"))]
|
||||
pub struct WebappServer;
|
||||
|
||||
pub struct Configuration {
|
||||
@ -62,7 +62,7 @@ pub fn new(configuration: Configuration, deps: Dependencies) -> Option<WebappSer
|
||||
Some(setup_dapps_server(deps, configuration.dapps_path, &addr, auth))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "dapps"))]
|
||||
#[cfg(any(not(feature = "dapps"), feature = "no-ui"))]
|
||||
pub fn setup_dapps_server(
|
||||
_deps: Dependencies,
|
||||
_dapps_path: String,
|
||||
@ -72,7 +72,7 @@ pub fn setup_dapps_server(
|
||||
die!("Your Parity version has been compiled without WebApps support.")
|
||||
}
|
||||
|
||||
#[cfg(feature = "dapps")]
|
||||
#[cfg(all(feature = "dapps", not(feature = "no-ui")))]
|
||||
pub fn setup_dapps_server(
|
||||
deps: Dependencies,
|
||||
dapps_path: String,
|
||||
|
@ -51,7 +51,7 @@ extern crate ethcore_rpc;
|
||||
extern crate ethcore_signer;
|
||||
extern crate ansi_term;
|
||||
|
||||
#[cfg(feature = "dapps")]
|
||||
#[cfg(all(feature = "dapps", not(feature = "no-ui")))]
|
||||
extern crate ethcore_dapps;
|
||||
|
||||
#[macro_use]
|
||||
|
@ -24,3 +24,4 @@ clippy = { version = "0.0.79", optional = true}
|
||||
|
||||
[features]
|
||||
dev = ["clippy"]
|
||||
no-ui = []
|
||||
|
@ -51,6 +51,7 @@ extern crate ethcore_util as util;
|
||||
extern crate ethcore_rpc as rpc;
|
||||
extern crate jsonrpc_core;
|
||||
extern crate ws;
|
||||
#[cfg(not(feature = "no-ui"))]
|
||||
extern crate parity_dapps_signer as signer;
|
||||
|
||||
mod authcode_store;
|
||||
|
@ -17,7 +17,6 @@
|
||||
//! Session handlers factory.
|
||||
|
||||
use ws;
|
||||
use signer;
|
||||
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(not(feature = "no-ui"))]
|
||||
mod signer {
|
||||
use signer;
|
||||
|
||||
pub fn handle(req: &str) -> Option<signer::File> {
|
||||
signer::handle(req)
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "no-ui")]
|
||||
mod signer {
|
||||
pub struct File {
|
||||
pub content: String,
|
||||
pub mime: String,
|
||||
}
|
||||
|
||||
pub fn handle(_req: &str) -> Option<File> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn origin_is_allowed(self_origin: &str, header: Option<&[u8]>) -> bool {
|
||||
match header {
|
||||
None => false,
|
||||
|
Loading…
Reference in New Issue
Block a user