MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / origin_is_allowed

Function origin_is_allowed

packages/server/src/auth.rs:230–241  ·  view source on GitHub ↗
(config: &Config, origin: &str)

Source from the content-addressed store, hash-verified

228}
229
230fn origin_is_allowed(config: &Config, origin: &str) -> bool {
231 let allowed = [
232 format!("http://{}:{}", config.advertise_host, config.http_port),
233 format!("http://{}:{}", config.bind_ip, config.http_port),
234 format!("http://localhost:{}", config.http_port),
235 format!("http://127.0.0.1:{}", config.http_port),
236 format!("http://[::1]:{}", config.http_port),
237 ];
238 allowed.iter().any(|value| value == origin)
239 || LAUNCHPAD_ORIGINS.contains(&origin)
240 || extra_allowed_origins().any(|value| value == "*" || value == origin)
241}
242
243fn origin_is_cors_allowed(config: &Config, origin: &str) -> bool {
244 origin == "null" || origin_is_allowed(config, origin)

Callers 2

origin_is_cors_allowedFunction · 0.85

Calls 1

extra_allowed_originsFunction · 0.85

Tested by

no test coverage detected