mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:49:50 +00:00
Allow types.ruff.rs for red-knot playground (#17358)
This commit is contained in:
parent
7d11ef1564
commit
4bfdf54d1a
1 changed files with 8 additions and 2 deletions
|
@ -31,6 +31,8 @@ const PRODUCTION_HEADERS = {
|
|||
"Access-Control-Allow-Origin": "https://play.ruff.rs",
|
||||
};
|
||||
|
||||
const ALLOWED_DOMAINS = ["https://playknot.ruff.rs", "https://types.ruff.rs"];
|
||||
|
||||
export default {
|
||||
async fetch(
|
||||
request: Request,
|
||||
|
@ -40,8 +42,12 @@ export default {
|
|||
const { DEV, PLAYGROUND } = env;
|
||||
|
||||
const headers = DEV ? DEVELOPMENT_HEADERS : PRODUCTION_HEADERS;
|
||||
if (!DEV && request.headers.get("origin") === "https://playknot.ruff.rs") {
|
||||
headers["Access-Control-Allow-Origin"] = "https://playknot.ruff.rs";
|
||||
|
||||
if (!DEV) {
|
||||
const origin = request.headers.get("origin");
|
||||
if (origin && ALLOWED_DOMAINS.includes(origin)) {
|
||||
headers["Access-Control-Allow-Origin"] = origin;
|
||||
}
|
||||
}
|
||||
|
||||
switch (request.method) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue