best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
added cors and title + description meta tags
wukko22f13cc86fe0
diff --git a/cobalt.js b/cobalt.jsindex 521e8f49..b0809f25 100644--- a/cobalt.js+++ b/cobalt.js@@ -1,6 +1,7 @@import "dotenv/config"import express from "express";+import cors from "cors";import * as fs from "fs";import rateLimit from "express-rate-limit";@@ -16,6 +17,8 @@ import stream from "./modules/stream/stream.js";const commitHash = currentCommit();const app = express();+app.disable('x-powered-by');+if (fs.existsSync('./.env') && fs.existsSync('./config.json')) {const apiLimiter = rateLimit({windowMs: 20 * 60 * 1000,@@ -36,12 +39,10 @@ if (fs.existsSync('./.env') && fs.existsSync('./config.json')) {}})- app.set('etag', 'strong');app.use('/api/', apiLimiter);app.use('/api/stream', apiLimiterStream);app.use('/', express.static('files'));- // avoid the %% URIErrorapp.use((req, res, next) => {try {decodeURIComponent(req.path)@@ -52,7 +53,7 @@ if (fs.existsSync('./.env') && fs.existsSync('./config.json')) {next();});- app.get('/api/:type', async (req, res) => {+ app.get('/api/:type', cors({ origin: process.env.selfURL, optionsSuccessStatus: 200 }), async (req, res) => {try {switch (req.params.type) {case 'json':diff --git a/modules/page-renderer.js b/modules/page-renderer.jsindex a82b74de..f8577dae 100644--- a/modules/page-renderer.js+++ b/modules/page-renderer.js@@ -32,6 +32,8 @@ export default function(obj) {<meta property="og:title" content="${appName}" /><meta property="og:description" content="${loc(obj.lang, 'desc', 'embed')}" /><meta property="og:image" content="${process.env.selfURL}icons/generic.png" />+ <meta name="title" content="${appName}" />+ <meta name="description" content="${loc(obj.lang, 'desc', 'embed')}" /><meta name="theme-color" content="#000000" /><meta name="twitter:card" content="summary" />diff --git a/package.json b/package.jsonindex 53e7fd1f..f543178f 100644--- a/package.json+++ b/package.json@@ -22,6 +22,7 @@},"homepage": "https://github.com/wukko/cobalt-web#readme","dependencies": {+ "cors": "^2.8.5","dotenv": "^16.0.1","express": "^4.17.1","express-rate-limit": "^6.3.0",diff --git a/strings/en/apiError.json b/strings/en/apiError.jsonindex 788bee01..13daeecb 100644--- a/strings/en/apiError.json+++ b/strings/en/apiError.json@@ -17,6 +17,6 @@"liveVideo": "i can't download a live video. wait for stream to finish and try again.","nothingToDownload": "it seems like there's nothing to download. try another link!","cantConnectToAPI": "i couldn't connect to {s} api. seems like either {s} is down or server ip got blocked. try again later.",- "noStreamID": "there's no such stream id. you can't fool me!",+ "noStreamID": "there's no such stream id.","noType": "there's no such expected response type."}\ No newline at end of file