Update index.ts
This commit is contained in:
parent
8839141f16
commit
5cbb504657
1 changed files with 9 additions and 4 deletions
13
index.ts
13
index.ts
|
|
@ -31,6 +31,13 @@ async function updateChangelistIds() {
|
||||||
|
|
||||||
const tracker_page =
|
const tracker_page =
|
||||||
"https://docs.google.com/spreadsheets/u/0/d/1Z8aANbxXbnUGoZPRvJfWL3gz6jrzPPrwVt3d0c1iJ_4/htmlview/sheet?headers=false&gid=1884837542";
|
"https://docs.google.com/spreadsheets/u/0/d/1Z8aANbxXbnUGoZPRvJfWL3gz6jrzPPrwVt3d0c1iJ_4/htmlview/sheet?headers=false&gid=1884837542";
|
||||||
|
|
||||||
|
const ALLOWED_ORIGINS = [
|
||||||
|
"https://artistgrid.cx",
|
||||||
|
"https://monochrome.tf",
|
||||||
|
"https://monochrome-back.pages.dev",
|
||||||
|
"https://monochrome.samidy.com",
|
||||||
|
];
|
||||||
|
|
||||||
async function getTH() {
|
async function getTH() {
|
||||||
const req = await fetch(tracker_page);
|
const req = await fetch(tracker_page);
|
||||||
|
|
@ -199,9 +206,8 @@ export class ClientResponse extends Response {
|
||||||
super(body, init);
|
super(body, init);
|
||||||
|
|
||||||
const origin = req.headers.get("Origin");
|
const origin = req.headers.get("Origin");
|
||||||
const origins = process.env.ORIGIN!.split(",");
|
|
||||||
|
|
||||||
if (origin && origins.includes(origin)) {
|
if (origin && ALLOWED_ORIGINS.includes(origin)) {
|
||||||
this.headers.set("Access-Control-Allow-Origin", origin);
|
this.headers.set("Access-Control-Allow-Origin", origin);
|
||||||
this.headers.set(
|
this.headers.set(
|
||||||
"Access-Control-Allow-Methods",
|
"Access-Control-Allow-Methods",
|
||||||
|
|
@ -220,9 +226,8 @@ export class ClientResponse extends Response {
|
||||||
});
|
});
|
||||||
|
|
||||||
const origin = req.headers.get("Origin");
|
const origin = req.headers.get("Origin");
|
||||||
const origins = process.env.ORIGIN!.split(",");
|
|
||||||
|
|
||||||
if (origin && origins.includes(origin)) {
|
if (origin && ALLOWED_ORIGINS.includes(origin)) {
|
||||||
res.headers.set("Access-Control-Allow-Origin", origin);
|
res.headers.set("Access-Control-Allow-Origin", origin);
|
||||||
res.headers.set(
|
res.headers.set(
|
||||||
"Access-Control-Allow-Methods",
|
"Access-Control-Allow-Methods",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue