Repository: AmbientRun/Ambient
File: app/src/server/mod.rs (Rust)

Code before:
        .host()
        .and_then(|h| h.public_host.clone())
        .or_else(|| local_ip_address::local_ip().ok().map(|x| x.to_string()))
        .unwrap_or("localhost".to_string());
    log::info!("Created server, running at {public_host}:{port}");
    let http_interface_port = cli.host().unwrap().http_interface_port.unwrap_or(HTTP_INTERFACE_PORT);

    // here the key is inserted into the asset cache
    let key = AbsAssetUrl::parse(format!("http://{public_host}:{http_interface_port}/content/")).unwrap();
    ServerBaseUrlKey.insert(&assets, key);
    start_http_interface(runtime, &project_path, http_interface_port);

    ComponentRegistry::get_mut().add_external(ambient_project::all_defined_components(manifest, false).unwrap());

    let manifest = manifest.clone();
    runtime.spawn(async move {
        let mut server_world = World::new_with_config("server", true);
        server_world.init_shape_change_tracking();

        server_world.add_components(server_world.resource_entity(), create_resources(assets.clone())).unwrap();

        // Keep track of the project name
        let name = manifest.project.name.clone().unwrap_or_else(|| "Ambient".into());
        server_world.add_components(server_world.resource_entity(), Entity::new().with(project_name(), name)).unwrap();

        Entity::new().with(synced_resources(), ()).with(abs_asset_url(), format!("http://{public_host}:{http_interface_port}/content/")).spawn(&mut server_world);
        Entity::new().with(synced_resources(), ()).with(dont_store(), ()).spawn(&mut server_world);
        // Note: this should not be reset every time the server is created. Remove this when it becomes possible to load/save worlds.
        Entity::new().with(persistent_resources(), ()).spawn(&mut server_world);

        wasm::initialize(&mut server_world, project_path.clone(), &manifest).unwrap();

        if let Cli::View { asset_path, .. } = cli.clone() {
            let asset_path = AbsAssetUrl::from_file_path(project_path.join("build").join(asset_path).join("prefabs/main.json"));
            log::info!("Spawning asset from {:?}", asset_path);
            let obj = PrefabFromUrl(asset_path.into()).get(&assets).await.unwrap();
            obj.spawn_into_world(&mut server_world, None);
        }
        log::info!("Starting server");
        server
            .run(server_world, Arc::new(systems), Arc::new(on_forking_systems), Arc::new(on_shutdown_systems), Arc::new(is_sync_component))
            .await;
    });
    port
}

fn systems(_world: &mut World) -> SystemGroup {
    SystemGroup::new(
        "server",
        vec![
            ambient_physics::run_simulation_system(),

Review comment (suggestion):
Hm so the `ProxyBaseUrlKey` seems to be lost now; the asset::url method used to use both but now it's just using ServerBaseUrl

Code after:
        .host()
        .and_then(|h| h.public_host.clone())
        .or_else(|| local_ip_address::local_ip().ok().map(|x| x.to_string()))
        .unwrap_or("localhost".to_string());
    log::info!("Created server, running at {public_host}:{port}");
    let http_interface_port = cli.host().unwrap().http_interface_port.unwrap_or(HTTP_INTERFACE_PORT);

    // here the key is inserted into the asset cache
    let key = format!("http://{public_host}:{http_interface_port}/content/");
    ServerBaseUrlKey.insert(&assets, AbsAssetUrl::parse(&key).unwrap());
    start_http_interface(runtime, &project_path, http_interface_port);

    ComponentRegistry::get_mut().add_external(ambient_project_native::all_defined_components(manifest, false).unwrap());

    let manifest = manifest.clone();
    runtime.spawn(async move {
        let mut server_world = World::new_with_config("server", true);
        server_world.init_shape_change_tracking();

        server_world.add_components(server_world.resource_entity(), create_resources(assets.clone())).unwrap();

        // Keep track of the project name
        let name = manifest.project.name.clone().unwrap_or_else(|| "Ambient".into());
        server_world.add_components(server_world.resource_entity(), Entity::new().with(project_name(), name)).unwrap();


        Entity::new().with(synced_resources(), ()).with(content_base_url(), key).spawn(&mut server_world);
        Entity::new().with(synced_resources(), ()).with(dont_store(), ()).spawn(&mut server_world);
        // Note: this should not be reset every time the server is created. Remove this when it becomes possible to load/save worlds.
        Entity::new().with(persistent_resources(), ()).spawn(&mut server_world);

        wasm::initialize(&mut server_world, project_path.clone(), &manifest).unwrap();

        if let Cli::View { asset_path, .. } = cli.clone() {
            let asset_path = AbsAssetUrl::from_file_path(project_path.join("build").join(asset_path).join("prefabs/main.json"));
            log::info!("Spawning asset from {:?}", asset_path);
            let obj = PrefabFromUrl(asset_path.into()).get(&assets).await.unwrap();
            obj.spawn_into_world(&mut server_world, None);
        }
        log::info!("Starting server");
        server
            .run(server_world, Arc::new(systems), Arc::new(on_forking_systems), Arc::new(on_shutdown_systems), Arc::new(is_sync_component))
            .await;
    });
    port
}

fn systems(_world: &mut World) -> SystemGroup {
    SystemGroup::new(
        "server",
        vec![