Skip to content

Commit ae93b43

Browse files
committed
Fixed formatting
1 parent 20d7da8 commit ae93b43

File tree

2 files changed

+57
-58
lines changed

2 files changed

+57
-58
lines changed

crates/common/src/publisher.rs

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,63 @@ pub fn handle_publisher_request(
429429
Ok(response)
430430
}
431431

432+
/// Handles the EdgePubs page request.
433+
///
434+
/// Serves the EdgePubs landing page with integrated ad slots.
435+
///
436+
/// # Errors
437+
///
438+
/// Returns a [`TrustedServerError`] if response creation fails.
439+
pub fn handle_edgepubs_page(
440+
settings: &Settings,
441+
mut req: Request,
442+
) -> Result<Response, Report<TrustedServerError>> {
443+
log::info!("Serving EdgePubs landing page");
444+
445+
// log_fastly::init_simple("mylogs", Info);
446+
447+
// Add DMA code check
448+
let dma_code = get_dma_code(&mut req);
449+
log::info!("EdgePubs page - DMA Code: {:?}", dma_code);
450+
451+
// Check GDPR consent
452+
let _consent = match get_consent_from_request(&req) {
453+
Some(c) => c,
454+
None => {
455+
log::debug!("No GDPR consent found for EdgePubs page, using default");
456+
GdprConsent::default()
457+
}
458+
};
459+
460+
// Generate synthetic ID for EdgePubs page
461+
let fresh_id = generate_synthetic_id(settings, &req)?;
462+
463+
// Get or generate Trusted Server ID
464+
let trusted_server_id = get_or_generate_synthetic_id(settings, &req)?;
465+
466+
// Create response with EdgePubs template
467+
let mut response = Response::from_status(StatusCode::OK)
468+
.with_body(EDGEPUBS_TEMPLATE)
469+
.with_header(header::CONTENT_TYPE, "text/html")
470+
.with_header(header::CACHE_CONTROL, "no-store, private")
471+
.with_header(HEADER_X_COMPRESS_HINT, "on");
472+
473+
// Add synthetic ID headers
474+
response.set_header(HEADER_SYNTHETIC_FRESH, &fresh_id);
475+
response.set_header(HEADER_SYNTHETIC_TRUSTED_SERVER, &trusted_server_id);
476+
477+
// Add DMA code header if available
478+
if let Some(dma) = dma_code {
479+
response.set_header(HEADER_X_GEO_METRO_CODE, dma);
480+
}
481+
482+
// Set synthetic ID cookie
483+
let cookie = create_synthetic_cookie(settings, &trusted_server_id);
484+
response.set_header(header::SET_COOKIE, cookie);
485+
486+
Ok(response)
487+
}
488+
432489
#[cfg(test)]
433490
mod tests {
434491
use super::*;
@@ -765,60 +822,3 @@ mod tests {
765822
}
766823
}
767824
}
768-
769-
/// Handles the EdgePubs page request.
770-
///
771-
/// Serves the EdgePubs landing page with integrated ad slots.
772-
///
773-
/// # Errors
774-
///
775-
/// Returns a [`TrustedServerError`] if response creation fails.
776-
pub fn handle_edgepubs_page(
777-
settings: &Settings,
778-
mut req: Request,
779-
) -> Result<Response, Report<TrustedServerError>> {
780-
log::info!("Serving EdgePubs landing page");
781-
782-
// log_fastly::init_simple("mylogs", Info);
783-
784-
// Add DMA code check
785-
let dma_code = get_dma_code(&mut req);
786-
log::info!("EdgePubs page - DMA Code: {:?}", dma_code);
787-
788-
// Check GDPR consent
789-
let _consent = match get_consent_from_request(&req) {
790-
Some(c) => c,
791-
None => {
792-
log::debug!("No GDPR consent found for EdgePubs page, using default");
793-
GdprConsent::default()
794-
}
795-
};
796-
797-
// Generate synthetic ID for EdgePubs page
798-
let fresh_id = generate_synthetic_id(settings, &req)?;
799-
800-
// Get or generate Trusted Server ID
801-
let trusted_server_id = get_or_generate_synthetic_id(settings, &req)?;
802-
803-
// Create response with EdgePubs template
804-
let mut response = Response::from_status(StatusCode::OK)
805-
.with_body(EDGEPUBS_TEMPLATE)
806-
.with_header(header::CONTENT_TYPE, "text/html")
807-
.with_header(header::CACHE_CONTROL, "no-store, private")
808-
.with_header(HEADER_X_COMPRESS_HINT, "on");
809-
810-
// Add synthetic ID headers
811-
response.set_header(HEADER_SYNTHETIC_FRESH, &fresh_id);
812-
response.set_header(HEADER_SYNTHETIC_TRUSTED_SERVER, &trusted_server_id);
813-
814-
// Add DMA code header if available
815-
if let Some(dma) = dma_code {
816-
response.set_header(HEADER_X_GEO_METRO_CODE, dma);
817-
}
818-
819-
// Set synthetic ID cookie
820-
let cookie = create_synthetic_cookie(settings, &trusted_server_id);
821-
response.set_header(header::SET_COOKIE, cookie);
822-
823-
Ok(response)
824-
}

crates/fastly/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use fastly::{Error, Request, Response};
33
use log_fastly::Logger;
44

55
use trusted_server_common::advertiser::handle_ad_request;
6-
use trusted_server_common::constants::HEADER_X_COMPRESS_HINT;
76
use trusted_server_common::gam::{
87
handle_gam_asset, handle_gam_custom_url, handle_gam_golden_url, handle_gam_render,
98
handle_gam_test, is_gam_asset_path,

0 commit comments

Comments
 (0)