MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / set_cors_whitelist

Function set_cors_whitelist

crates/opencode-server/src/server.rs:438–450  ·  view source on GitHub ↗
(origins: Vec<String>)

Source from the content-addressed store, hash-verified

436}
437
438pub fn set_cors_whitelist(origins: Vec<String>) {
439 let mut next = HashSet::new();
440 for origin in origins {
441 if let Some(normalized) = normalize_origin(&origin) {
442 next.insert(normalized);
443 }
444 }
445
446 match EXTRA_CORS_WHITELIST.write() {
447 Ok(mut guard) => *guard = next,
448 Err(poisoned) => *poisoned.into_inner() = next,
449 }
450}
451
452fn is_extra_allowed_origin(origin: &str) -> bool {
453 let normalized = normalize_origin(origin).unwrap_or_else(|| origin.to_string());

Callers 2

run_tuiFunction · 0.85
run_server_commandFunction · 0.85

Calls 2

newFunction · 0.85
normalize_originFunction · 0.85

Tested by

no test coverage detected