Opening local dapp (#4041)

* Opening local dapp

* Using Path/PathBuf instead of Strings

* Fixing typo and adding some docs to apps::fs functions
This commit is contained in:
Tomasz Drwięga
2017-01-06 16:05:58 +01:00
committed by Gav Wood
parent 332a45846d
commit e983339edd
9 changed files with 188 additions and 66 deletions

View File

@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::path::PathBuf;
use std::sync::Arc;
use endpoint::{Endpoints, Endpoint};
use page::PageEndpoint;
@@ -43,7 +44,8 @@ pub fn utils() -> Box<Endpoint> {
}
pub fn all_endpoints<F: Fetch>(
dapps_path: String,
dapps_path: PathBuf,
extra_dapps: Vec<PathBuf>,
signer_address: Option<(String, u16)>,
web_proxy_tokens: Arc<WebProxyTokens>,
remote: Remote,
@@ -51,6 +53,13 @@ pub fn all_endpoints<F: Fetch>(
) -> Endpoints {
// fetch fs dapps at first to avoid overwriting builtins
let mut pages = fs::local_endpoints(dapps_path, signer_address.clone());
for path in extra_dapps {
if let Some((id, endpoint)) = fs::local_endpoint(path.clone(), signer_address.clone()) {
pages.insert(id, endpoint);
} else {
warn!(target: "dapps", "Ignoring invalid dapp at {}", path.display());
}
}
// NOTE [ToDr] Dapps will be currently embeded on 8180
insert::<parity_ui::App>(&mut pages, "ui", Embeddable::Yes(signer_address.clone()));