From f837c115704cfb9415736b9bb1c8cbc727d09342 Mon Sep 17 00:00:00 2001 From: Clement BOUVET Date: Wed, 20 Nov 2024 17:24:02 +0100 Subject: [PATCH 1/3] Cargo.toml: import edgee-path/edgee-sdk --- Cargo.lock | 20 ++++++++++++++++++++ Cargo.toml | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7dd05dd..abe8888 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -923,6 +923,8 @@ dependencies = [ "chrono", "clap", "cookie", + "edgee-path", + "edgee-sdk", "futures", "hex", "html-escape", @@ -962,6 +964,24 @@ dependencies = [ "wasmtime-wasi", ] +[[package]] +name = "edgee-path" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3554c7d421dab323cda42f297fc1591f1d89049f7e67d477f4dc1caf735b5ead" +dependencies = [ + "rand", +] + +[[package]] +name = "edgee-sdk" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3cfb834ddb90f237008cff3941b27637b4c66f03b976b4f37bdef681520feb" +dependencies = [ + "edgee-path", +] + [[package]] name = "either" version = "1.13.0" diff --git a/Cargo.toml b/Cargo.toml index a99ac91..dc7c77b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,8 @@ url = "2.5.2" uuid = { version = "1.9.1", features = ["v4", "serde"] } wasmtime = "27.0.0" wasmtime-wasi = "27.0.0" - +edgee-sdk = "1.2.0" +edgee-path = "0.1.0" [features] bundled = [ "openssl/vendored", From d23fc307238cc17db710d8fe2f48c401b3772e32 Mon Sep 17 00:00:00 2001 From: Clement BOUVET Date: Thu, 28 Nov 2024 13:37:33 +0100 Subject: [PATCH 2/3] use new edgee-sdk/edgee-path crates --- src/proxy/compute/html.rs | 53 +---- src/proxy/controller.rs | 4 +- src/proxy/mod.rs | 3 +- src/tools/mod.rs | 1 - src/tools/path.rs | 489 -------------------------------------- 5 files changed, 4 insertions(+), 546 deletions(-) delete mode 100644 src/tools/path.rs diff --git a/src/proxy/compute/html.rs b/src/proxy/compute/html.rs index 540efe2..7540cd4 100644 --- a/src/proxy/compute/html.rs +++ b/src/proxy/compute/html.rs @@ -1,5 +1,3 @@ -use crate::tools::path; - #[derive(Debug, Default)] pub struct Document { pub data_collection_events: String, @@ -169,7 +167,7 @@ pub fn parse_html(html: &str, host: &str) -> Document { // if inline is true, then we need to inline the SDK if let (true, Some(sdk_url)) = (inline, &builder.sdk_src) { - if let Ok(inlined_sdk) = get_sdk_from_url(sdk_url, host) { + if let Ok(inlined_sdk) = edgee_sdk::get_sdk_from_url(sdk_url, host) { set_document_field!(builder, inlined_sdk, inlined_sdk); } } @@ -326,52 +324,3 @@ fn extract_content_value(tag: &str) -> Option { // Extract the value between the quotes Some(rest_of_tag[..end_quote].to_string()) } - -/// Retrieves the SDK content from a given URL. -/// -/// This function extracts the version of the SDK from the URL using a regular expression. -/// Then, it retrieves the SDK content based on the extracted version. -/// The function returns a `Result` that contains the SDK content wrapped in a `