Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
make cors permissive
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed Jul 18, 2023
1 parent 4f0d756 commit caae28b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ license-file = "LICENSE"
keywords = ["bitcoin", "e-cash", "cashu"]

[workspace.dependencies]
# cashu-crab = { path = "../../cashu-crab" }
# cashu-crab = { path = "../cashu-crab" }
cashu-crab = { git = "https://github.com/thesimplekid/cashu-crab"}
bitcoin = { version = "0.30.0", features = ["no-std"] }
serde = "1.0.164"
Expand Down
14 changes: 14 additions & 0 deletions mint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use std::sync::Arc;

use anyhow::anyhow;
use axum::extract::{Query, State};
use axum::http::header::{
ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_ORIGIN, AUTHORIZATION, CONTENT_TYPE,
};
use axum::http::StatusCode;
use axum::routing::{get, post};
use axum::{Json, Router};
Expand All @@ -29,6 +32,7 @@ use ln::ldk::Ldk;
use ln::{InvoiceStatus, InvoiceTokenStatus, Ln};
use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;
use tower_http::cors::CorsLayer;
use tracing::{debug, warn};
use types::KeysetInfo;
use utils::unix_time;
Expand Down Expand Up @@ -201,6 +205,16 @@ async fn main() -> anyhow::Result<()> {
.route("/check", post(post_check))
.route("/melt", post(post_melt))
.route("/info", get(get_info))
.layer(
CorsLayer::very_permissive()
.allow_credentials(true)
.allow_headers([
AUTHORIZATION,
CONTENT_TYPE,
ACCESS_CONTROL_ALLOW_CREDENTIALS,
ACCESS_CONTROL_ALLOW_ORIGIN,
]),
)
.with_state(state);

let ip = Ipv4Addr::from_str(&settings.info.listen_host)?;
Expand Down

0 comments on commit caae28b

Please sign in to comment.