[fix] enable web file browsing across control transports, refs #135

This commit is contained in:
dijunkun committed 2026-11-11 16:27:27 +08:00
1 parent ec2c5485a2
commit b2817d0adc
4 files changed
+15 -11

No files matched your search

@@ -151,7 +151,8 @@ void PeerEventHandler::OnReceiveDataBuffer(
source_id == runtime->clipboard_label_ ||
source_id == web_clipboard::kStream))
return;
if (source_id == runtime->control_data_label_ &&
// MiniRTC reports the browser's reliable control channel as data-stream.
if ((source_id == runtime->control_data_label_ || source_id == kWebControlStream) &&
runtime->transfers_.HandleBrowser(data, size, handler, remote_id)) return;
if (source_id == web_clipboard::kStream) {
runtime->clipboard_.ReceiveWeb(
@@ -463,7 +464,7 @@ void PeerEventHandler::OnReceiveDataBuffer(
}
if (remote_action.type == ControlType::host_infomation) {
if (source_id == runtime->control_data_label_) {
if (source_id == runtime->control_data_label_ || source_id == kWebControlStream) {
runtime->transfers_.SetBrowserSupport(handler, remote_id,
remote_action.i.supports_file_browser);
}
@@ -685,12 +685,12 @@ std::string GuiRuntime::BuildHostInformation(bool advertise_trust,
LOG_INFO("Local display [{}:{}]", i + 1, action.i.display_list[i]);
auto message = action.to_json();
FreeRemoteAction(action);
if (advertise_trust) {
auto information = nlohmann::json::parse(message);
information["device_trust_version"] = 1;
message = information.dump();
}
return message;
auto information = nlohmann::json::parse(message);
// Older desktop builds advertise native directory RPC, but their Web
// control router cannot carry it. Negotiate the Web route independently.
information["host_info"]["supports_web_file_browser"] = UserSessionFeaturesAvailable();
if (advertise_trust) information["device_trust_version"] = 1;
return information.dump();
}
void GuiRuntime::AnnounceHostCapabilities(const std::string& id) {