use dioxus_interpreter_js::INTERPRETER_JS;
use std::path::{Path, PathBuf};
use wry::{
http::{status::StatusCode, Request, Response},
Result,
};
fn module_loader(root_name: &str) -> String {
format!(
r#"
"#,
root_name
)
}
pub(super) fn desktop_handler(
request: &Request>,
asset_root: Option,
custom_head: Option,
custom_index: Option,
root_name: &str,
) -> Result>> {
// Any content that uses the `dioxus://` scheme will be shuttled through this handler as a "special case".
// For now, we only serve two pieces of content which get included as bytes into the final binary.
let path = request.uri().to_string().replace("dioxus://", "");
// all assets should be called from index.html
let trimmed = path.trim_start_matches("index.html/");
if trimmed.is_empty() {
// If a custom index is provided, just defer to that, expecting the user to know what they're doing.
// we'll look for the closing