Skip to content

Commit

Permalink
theme: use hugo css theme
Browse files Browse the repository at this point in the history
Signed-off-by: lvaccaro <[email protected]>
  • Loading branch information
lvaccaro committed Nov 28, 2023
1 parent be16959 commit 1226ad4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ version = "0.1.1-dev"
bdk = { version = "0.13.0", default-features = false }
bdk-macros = "^0.6"
dirs-next = "2.0.0"
rust-ini = "0.16"
structopt = "0.3"
rust-ini = "0.16"
url = { version = "2", features = ["serde"] }
percent-encoding = "2.1.0"

[features]
default = ["electrum", "bdk/key-value-db"]
Expand Down
19 changes: 18 additions & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use crate::{html, wallet};
use crate::html::not_found;
use wallet::{Wallet, Error, gen_err};

use btctipserver_bitcoin::BTCWallet;

pub fn run_server(url: &str, wallet: Wallet) {
let wallet_mutex = Arc::new(Mutex::new(wallet));
let server = Server::http(url).unwrap();
Expand All @@ -31,7 +33,6 @@ pub fn run_server(url: &str, wallet: Wallet) {
};
drop(wallet_lock);
Response::from_string(html).with_header(content_type_header)

} else {
let html = match page(&mut wallet_lock, parsed.query().unwrap()) {
Ok(txt) => txt,
Expand Down Expand Up @@ -63,6 +64,22 @@ pub fn page(
uri: &str,
) -> Result<String, Error> {
let network = wallet.network()?;
let mut address = uri;

BTCWallet::Bip21::parse(uri).unwrap();


Bip21::parse("bitcoin:2NDxuABdg2uqk9MouV6f53acAwaY2GwKVHK")
let address = match parsed.query().unwrap() {

};



if parsed.query().unwrap().starts_with(wallet.schema()) {
address = Bip21::parse("bitcoin:2NDxuABdg2uqk9MouV6f53acAwaY2GwKVHK").unwrap();
}

let address = uri;
let mine = wallet.is_my_address(address)?;
if !mine {
Expand Down
9 changes: 9 additions & 0 deletions server/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,13 @@ impl Wallet {
Wallet::ClightningWallet(w) => { w.balance_address(addr, _from_height).map_err(|_| gen_err()) }
}
}

pub fn schema(&mut self) -> &str {
match self {
Wallet::BTCWallet(_) => "bitcoin",
Wallet::LiquidWallet(_) => "liquidnetwork",
Wallet::ClightningWallet(_) => "lightning",
}
}

}

0 comments on commit 1226ad4

Please sign in to comment.