Skip to content

Commit

Permalink
refactor: extract holochain management functionality into standalone …
Browse files Browse the repository at this point in the history
…crate 'holochain-manager', modify tauri-plugin-holochain to use holochain-manager under-the-hood
  • Loading branch information
mattyg committed Aug 20, 2024
1 parent f58770a commit 02eb744
Show file tree
Hide file tree
Showing 31 changed files with 1,094 additions and 1,007 deletions.
78 changes: 47 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/hc-pilot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tauri = "2.0.0-rc"
tauri-plugin-log = "2.0.0-rc"

tauri-plugin-holochain = { path = "../tauri-plugin-holochain" }
holochain-manager = { path = "../holochain-manager" }
holochain_types = "0.3.2"
holochain_client = "0.5.1"

Expand Down
2 changes: 1 addition & 1 deletion crates/hc-pilot/gen/schemas/acl-manifests.json

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions crates/hc-pilot/gen/schemas/desktop-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,6 @@
]
},
{
"description": "holochain:default -> Default permissions for the plugin",
"type": "string",
"enum": [
"holochain:default"
Expand All @@ -2124,13 +2123,6 @@
"holochain:allow-get-locales"
]
},
{
"description": "holochain:allow-get-runtime-info -> Enables the get_runtime_info command without any pre-configured scope.",
"type": "string",
"enum": [
"holochain:allow-get-runtime-info"
]
},
{
"description": "holochain:allow-is-holochain-ready -> Enables the is_holochain_ready command without any pre-configured scope.",
"type": "string",
Expand Down Expand Up @@ -2166,13 +2158,6 @@
"holochain:deny-get-locales"
]
},
{
"description": "holochain:deny-get-runtime-info -> Denies the get_runtime_info command without any pre-configured scope.",
"type": "string",
"enum": [
"holochain:deny-get-runtime-info"
]
},
{
"description": "holochain:deny-is-holochain-ready -> Denies the is_holochain_ready command without any pre-configured scope.",
"type": "string",
Expand Down
15 changes: 0 additions & 15 deletions crates/hc-pilot/gen/schemas/linux-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,6 @@
]
},
{
"description": "holochain:default -> Default permissions for the plugin",
"type": "string",
"enum": [
"holochain:default"
Expand All @@ -2124,13 +2123,6 @@
"holochain:allow-get-locales"
]
},
{
"description": "holochain:allow-get-runtime-info -> Enables the get_runtime_info command without any pre-configured scope.",
"type": "string",
"enum": [
"holochain:allow-get-runtime-info"
]
},
{
"description": "holochain:allow-is-holochain-ready -> Enables the is_holochain_ready command without any pre-configured scope.",
"type": "string",
Expand Down Expand Up @@ -2166,13 +2158,6 @@
"holochain:deny-get-locales"
]
},
{
"description": "holochain:deny-get-runtime-info -> Denies the get_runtime_info command without any pre-configured scope.",
"type": "string",
"enum": [
"holochain:deny-get-runtime-info"
]
},
{
"description": "holochain:deny-is-holochain-ready -> Denies the is_holochain_ready command without any pre-configured scope.",
"type": "string",
Expand Down
7 changes: 4 additions & 3 deletions crates/hc-pilot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use lair_keystore::dependencies::sodoken::{BufRead, BufWrite};
use std::collections::HashMap;
use std::path::PathBuf;
use tauri::{AppHandle, Context, Wry};
use tauri_plugin_holochain::{HolochainExt, HolochainPluginConfig, WANNetworkConfig};
use tauri_plugin_holochain::HolochainExt;
use holochain_manager::{HolochainManagerConfig, WANNetworkConfig};
use url2::url2;

#[derive(Parser, Debug)]
Expand Down Expand Up @@ -105,7 +106,7 @@ fn main() {
)
.plugin(tauri_plugin_holochain::init(
vec_to_locked(password.as_bytes().to_vec()).expect("Can't build passphrase"),
HolochainPluginConfig {
HolochainManagerConfig {
wan_network_config,
holochain_dir: conductor_dir,
},
Expand Down Expand Up @@ -157,7 +158,7 @@ async fn setup(
membrane_proofs: HashMap<String, std::sync::Arc<holochain_types::prelude::SerializedBytes>>,
network_seed: Option<String>,
) -> anyhow::Result<AppInfo> {
let admin_ws = handle.holochain()?.admin_websocket().await?;
let admin_ws = handle.holochain()?.holochain_runtime.admin_websocket().await?;
let agent_key = match agent_key {
Some(agent_key) => agent_key,
None => {
Expand Down
63 changes: 63 additions & 0 deletions crates/holochain-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[package]
name = "holochain-manager"
version = "0.0.0"
authors = ["[email protected]"]
description = ""
edition = "2021"
rust-version = "1.75"

[dependencies]
# Holochain dependencies
mr_bundle = "0.3.2"
holochain = "0.3.2"
holochain_types = "0.3.2"
holochain_keystore = "0.3.2"
holochain_conductor_api = "0.3.2"

kitsune_p2p_mdns = "0.3.2"
kitsune_p2p_types = "0.3.2"

tx5-signal-srv = "0.0.14-alpha"
tx5-signal = "0.0.14-alpha"

# Lair dependencies
hc_seed_bundle = "0.2"
lair_keystore = "0.4.5"
lair_keystore_api = "0.4.5"

# Holochain client
holochain_client = "0.5.1"

local-ip-address = "0.6"
serde_json = "1"
sha256 = "1"
log = "0.4"
symlink = "0.1.0"
nanoid = "0.4.0"
async-std = "1.12"
serde = "1.0.193"
thiserror = "1.0"
url = "2.4.0"
url2 = "0.0.6"
zip = { version = "0.6" }
bzip2 = { version = "0.4", features = ["static"] }
portpicker = "0.1"
mime_guess = "2.0.4"
hyper = { version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
http-body-util = "0.1"
tls-listener = "0.8"
futures = "0.3"
either = "*"
tokio = "1"
one_err = "0"
base64 = "0.22"
anyhow = "1"
async-trait = "0.1"

[features]
default = ["gossip_arc_normal"]

gossip_arc_empty = []
gossip_arc_full = []
gossip_arc_normal = []
Loading

0 comments on commit 02eb744

Please sign in to comment.