From accc52893d63ac03dea9b115ce19469a5f9dafa6 Mon Sep 17 00:00:00 2001 From: Venipa Date: Thu, 16 May 2024 13:36:29 +0200 Subject: [PATCH] feat: added cors to api server --- package.json | 2 +- src/api/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8ea83824..28a97af7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ytmdesktop2", - "version": "0.12.9", + "version": "0.12.10", "private": false, "author": "Venipa ", "scripts": { diff --git a/src/api/main.ts b/src/api/main.ts index 234fd2f6..85f05af9 100644 --- a/src/api/main.ts +++ b/src/api/main.ts @@ -14,7 +14,7 @@ const { app, getWss } = expressWs(createApp()); let appConfig: SettingsStore; const log = logger.child("api-server"); const router = Router() as expressWs.Router; -const whitelist = ['http://localhost', 'https://localhost'] +const whitelist = ['http://localhost', 'https://localhost', 'file://'] app.use(cors({ origin: function (origin, callback) { if (whitelist.find(x => origin.indexOf(x) === 0)) callback(null, true); // allow any localhost