Skip to content

Commit

Permalink
Merge pull request #1297 from YokiToki/patch-cors-1
Browse files Browse the repository at this point in the history
Fix CORS issue with browser extension
  • Loading branch information
perry-mitchell authored Mar 27, 2024
2 parents 88f8b31 + f9d5164 commit 7006363
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
45 changes: 42 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
"@buttercup/secure-file-host": "^0.3.0",
"@electron/remote": "^2.0.8",
"buttercup": "^7.7.0",
"cors": "^2.8.5",
"debounce": "^1.2.1",
"debounce-promise": "^3.1.2",
"delayable-setinterval": "^0.1.1",
Expand Down Expand Up @@ -240,6 +241,7 @@
"@buttercup/ui": "^6.3.0",
"@electron/fuses": "^1.7.0",
"@hookstate/core": "^3.0.13",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.20",
"@types/jest": "^29.5.7",
"@types/node": "^20.8.10",
Expand Down
2 changes: 2 additions & 0 deletions source/main/services/browser/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express, { Request, Response, NextFunction } from "express";
import cors from "cors";
import createRouter from "express-promise-router";
import { VERSION } from "../../library/build";
import { handleAuthPing, processAuthRequest, processAuthResponse } from "./controllers/auth";
Expand All @@ -14,6 +15,7 @@ export function buildApplication(): express.Application {
app.disable("x-powered-by");
app.use(express.text());
app.use(express.json());
app.use(cors());
app.use((req: Request, res: Response, next: NextFunction) => {
res.set("Server", `ButtercupDesktop/${VERSION}`);
next();
Expand Down

0 comments on commit 7006363

Please sign in to comment.