| 767 | } |
| 768 | |
| 769 | fn metro_devtools_frontend_url(port: u16, entry: &Value, web_socket_debugger_url: &str) -> String { |
| 770 | let frontend = string_value(entry, "devtoolsFrontendUrl"); |
| 771 | let asset_path = metro_frontend_asset_path(frontend.as_deref()); |
| 772 | let query = frontend |
| 773 | .as_deref() |
| 774 | .and_then(|value| split_path_query(value).1); |
| 775 | // Reverse-proxy Metro's own (version-matched) Fusebox frontend through the |
| 776 | // SimDeck origin so the LAN client and Studio app can reach it, with the |
| 777 | // socket rewritten to the proxied inspector path. |
| 778 | format!( |
| 779 | "{}?{}", |
| 780 | metro_frontend_proxy_base(port, &asset_path), |
| 781 | metro_frontend_query_with_socket(query, web_socket_debugger_url) |
| 782 | ) |
| 783 | } |
| 784 | |
| 785 | fn metro_frontend_proxy_base(port: u16, asset_path: &str) -> String { |
| 786 | format!("/api/metro/{port}{asset_path}") |