fix 401 from localhost. thanks Ani!

master
Niko PLP 2 days ago
parent fb345aec05
commit 4b06847038
  1. 2
      helpers/ngnet/README.md
  2. 6
      helpers/ngnet/src/main.rs

@ -28,7 +28,7 @@ pnpm run dev --host
cargo watch -c -w src -x run
```
> Currently, the ngnet server api is listening on http://127.0.0.1:3033 only which might cause you trouble with Android emulator (hardcoded in `main.rs`).
> Currently, the ngnet server api is listening on http://127.0.0.1:3033 only, which might cause you trouble with Android emulator (hardcoded in `main.rs`).
> If you need to test from a (virtual) android device, you can use adb to tunnel the connection like: [`adb reverse tcp:3033 tcp:3033`](https://justinchips.medium.com/proxying-adb-client-connections-2ab495f774eb).
## Prod

@ -125,7 +125,7 @@ async fn main() -> anyhow::Result<()> {
.map(|reply, p: HashMap<String, String>| match p.get("o") {
Some(obj) => {
let decoded = obj.trim();
if BSP_DETAILS.get(decoded).is_none() {
if BSP_DETAILS.get(decoded).is_none() && decoded != "http://localhost:14400" && decoded != "http://localhost:1421" {
// rejected (BSP not listed)
warp::http::StatusCode::UNAUTHORIZED.into_response()
} else {
@ -182,9 +182,11 @@ async fn main() -> anyhow::Result<()> {
{
cors = cors.allow_origin(NG_NET_URL);
cors = cors.allow_origin(NG_APP_URL);
cors = cors.allow_origin("http://localhost:14400");
cors = cors.allow_origin("http://localhost:1421");
// TODO when there will be an API again, we will call it from any BSPs.
// we should add the list of all BSPs origin's here
log::info!("Starting server on http://localhost:3033");
log::info!("Starting production server on http://localhost:3033");
warp::serve(static_files.or(static_files_auth.or(static_files_bootstrap)).with(cors).with(incoming_log))
.run(([127, 0, 0, 1], 3033))
.await;

Loading…
Cancel
Save