From 307da3dce427282fba19948c9c2ef431803ad407 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 8 Apr 2023 16:58:44 +0600 Subject: [PATCH] 5.3.1: tiny fixes - fixed backdrop on press for "copy url" button in mobile "how to save?" popup - added ability to disable cors via env file --- package.json | 4 ++-- src/cobalt.js | 4 +++- src/front/cobalt.css | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c755a84..5274512 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cobalt", "description": "save what you love", - "version": "5.3", + "version": "5.3.1", "author": "wukko", "exports": "./src/cobalt.js", "type": "module", @@ -26,7 +26,7 @@ "cors": "^2.8.5", "dotenv": "^16.0.1", "esbuild": "^0.14.51", - "express": "^4.17.1", + "express": "^4.18.1", "express-rate-limit": "^6.3.0", "ffmpeg-static": "^5.1.0", "got": "^12.1.0", diff --git a/src/cobalt.js b/src/cobalt.js index 3d8bd2a..ea61560 100644 --- a/src/cobalt.js +++ b/src/cobalt.js @@ -26,8 +26,9 @@ const commitHash = shortCommit(); const branch = getCurrentBranch(); const app = express(); +const corsConfig = process.env.cors === '0' ? { origin: process.env.selfURL, optionsSuccessStatus: 200 } : {}; + app.disable('x-powered-by'); -app.use('/api/:type', cors()) if (fs.existsSync('./.env') && process.env.selfURL && process.env.streamSalt && process.env.port) { const apiLimiter = rateLimit({ @@ -55,6 +56,7 @@ if (fs.existsSync('./.env') && process.env.selfURL && process.env.streamSalt && await buildFront(commitHash, branch); + app.use('/api/:type', cors(corsConfig)); app.use('/api/json', apiLimiter); app.use('/api/stream', apiLimiterStream); app.use('/api/onDemand', apiLimiter); diff --git a/src/front/cobalt.css b/src/front/cobalt.css index 5e6a529..640fe82 100644 --- a/src/front/cobalt.css +++ b/src/front/cobalt.css @@ -147,9 +147,9 @@ button:active, background: var(--accent-press); cursor: pointer; } -.desktop .switch.text-backdrop:hover, +.switch.text-backdrop:hover, .switch.text-backdrop:active, -.desktop .text-to-copy.text-backdrop:hover, +.text-to-copy.text-backdrop:hover, .text-to-copy.text-backdrop:active { background: var(--accent); color: var(--background);