From b3f7777fb2422705743153d6fc9a83e9904b34b8 Mon Sep 17 00:00:00 2001 From: bdbai Date: Sat, 4 May 2024 22:11:55 +0800 Subject: [PATCH] Fix empty object in profile not exported --- ytflow-app-util/src/profile/export.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ytflow-app-util/src/profile/export.rs b/ytflow-app-util/src/profile/export.rs index 0e5916f..cc82ff4 100644 --- a/ytflow-app-util/src/profile/export.rs +++ b/ytflow-app-util/src/profile/export.rs @@ -74,7 +74,7 @@ fn encode_cbor_buf(buf: &[u8]) -> TomlValue { CborValue::Text(s) => s == "__byte_repr" || s == "__toml_repr", _ => false, }); - table.set_dotted(!(is_repr || indent > 2)); + table.set_dotted(!(is_repr || indent > 2 || table.is_empty())); TomlValue::InlineTable(table) } _ => return None, @@ -255,6 +255,20 @@ mod tests { &db, ) .unwrap(); + Plugin::create( + profile_id, + "ws-client".into(), + "WebSocket client.".into(), + "ws-client".into(), + 0, + to_cbor(cbor!({ + "headers" => {}, + "next" => "client-tls.tcp" + })) + .to_vec(), + &db, + ) + .unwrap(); Plugin::create( profile_id, "null".into(), @@ -336,6 +350,14 @@ param.fallback.udp = "proxy-forward.udp" param.fallback.resolver = "fake-ip.resolver" updated_at = 2024-04-27T09:43:17.191 +# WebSocket client. +[plugins.ws-client] +plugin = "ws-client" +plugin_version = 0 +param.headers = {} +param.next = "client-tls.tcp" +updated_at = 2024-04-27T09:43:17.191 + # null [plugins.null] plugin = "null"