Fix cors
This commit is contained in:
+5
-2
@@ -16,7 +16,7 @@ mod web;
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
|
|
||||||
use tower_http::cors::{AllowOrigin, CorsLayer};
|
use tower_http::cors::{AllowOrigin, CorsLayer, Any};
|
||||||
|
|
||||||
use crate::api::Api;
|
use crate::api::Api;
|
||||||
use crate::billing::Billing;
|
use crate::billing::Billing;
|
||||||
@@ -52,7 +52,10 @@ async fn main() -> Result<()> {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter_map(|o| o.parse::<axum::http::HeaderValue>().ok())
|
.filter_map(|o| o.parse::<axum::http::HeaderValue>().ok())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let cors = CorsLayer::new().allow_origin(AllowOrigin::list(parsed));
|
let cors = CorsLayer::new()
|
||||||
|
.allow_origin(AllowOrigin::list(parsed))
|
||||||
|
.allow_methods(Any)
|
||||||
|
.allow_headers(Any);
|
||||||
|
|
||||||
let app = api.router().layer(cors);
|
let app = api.router().layer(cors);
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ pub struct Wallet {
|
|||||||
|
|
||||||
impl Wallet {
|
impl Wallet {
|
||||||
pub fn from_url(url: &str) -> Result<Self> {
|
pub fn from_url(url: &str) -> Result<Self> {
|
||||||
let url = url
|
Ok(Self { url: url.parse::<NostrWalletConnectURI>()? })
|
||||||
.parse::<NostrWalletConnectURI>()
|
|
||||||
.map_err(|_| anyhow!("invalid NWC URL"))?;
|
|
||||||
Ok(Self { url })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn make_invoice(
|
pub async fn make_invoice(
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export default function Home() {
|
|||||||
|
|
||||||
<h1 class="text-5xl sm:text-6xl font-extrabold tracking-tight text-gray-900 mb-6 leading-tight">
|
<h1 class="text-5xl sm:text-6xl font-extrabold tracking-tight text-gray-900 mb-6 leading-tight">
|
||||||
Your community,<br />
|
Your community,<br />
|
||||||
<span class="text-blue-600">your relay.</span>
|
<span class="text-blue-600">your server.</span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p class="text-xl text-gray-500 mb-10 max-w-2xl mx-auto leading-relaxed">
|
<p class="text-xl text-gray-500 mb-10 max-w-2xl mx-auto leading-relaxed">
|
||||||
|
|||||||
Reference in New Issue
Block a user