From 498bdabb86c195d435d0c39b94f8cce2728945fd Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 17 Dec 2022 17:29:40 +0600 Subject: [PATCH] removed legacy stuff --- src/cobalt.js | 22 ++-------------------- src/modules/changelog/changelog.json | 2 +- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/cobalt.js b/src/cobalt.js index bce2398..9cf475e 100644 --- a/src/cobalt.js +++ b/src/cobalt.js @@ -105,27 +105,9 @@ if (fs.existsSync('./.env') && process.env.selfURL && process.env.streamSalt && try { let ip = encrypt(req.header('x-forwarded-for') ? req.header('x-forwarded-for') : req.ip.replace('::ffff:', ''), process.env.streamSalt); switch (req.params.type) { - // ** - // json GET method will be deprecated by 4.5! make sure to move your shortcuts to POST method. - // ** case 'json': - try { - if (req.query.url && req.query.url.length < 150) { - let chck = checkJSONPost({}); - chck["ip"] = ip; - let j = await getJSON(req.query.url.trim(), languageCode(req), chck) - res.status(j.status).json(j.body); - } else { - let j = apiJSON(3, { t: loc(languageCode(req), 'ErrorNoLink', process.env.selfURL) }) - res.status(j.status).json(j.body); - } - } catch (e) { - res.status(500).json({ 'status': 'error', 'text': loc(languageCode(req), 'ErrorCantProcess') }) - } + res.status(405).json({ 'status': 'error', 'text': 'GET method for this request has been deprecated. see https://github.com/wukko/cobalt/blob/current/docs/API.md for up-to-date API documentation.' }); break; - // ** - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ will be removed soon ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - // ** case 'stream': if (req.query.p) { res.status(200).json({ "status": "continue" }); @@ -190,7 +172,7 @@ if (fs.existsSync('./.env') && process.env.selfURL && process.env.streamSalt && res.redirect('/') }); app.listen(process.env.port, () => { - console.log(`\n${Cyan(appName)} ${Bright(`v.${version}-${commitHash}`)}\n\nURL: ${Cyan(`${process.env.selfURL}`)}\nPort: ${process.env.port}\nStart time: ${Bright(Math.floor(new Date().getTime()))}\n`) + console.log(`\n${Cyan(appName)} ${Bright(`v.${version}-${commitHash}`)}\n\nURL: ${Cyan(`${process.env.selfURL}`)}\nPort: ${process.env.port}\nStart time: ${Bright(new Date().getUTCDate())}\n`) }); } else { console.log(Red(`cobalt hasn't been configured yet or configuration is invalid.\n`) + Bright(`please run the setup script to fix this: `) + Green(`npm run setup`)) diff --git a/src/modules/changelog/changelog.json b/src/modules/changelog/changelog.json index 01c21a2..9afa342 100644 --- a/src/modules/changelog/changelog.json +++ b/src/modules/changelog/changelog.json @@ -3,7 +3,7 @@ "version": "4.6", "title": "mute videos and proper soundcloud support", "banner": "shutup.png", - "content": "i've been longing to implement both of these things, and here they finally are.\n\nservice-related improvements:\n
• you now can download videos with no audio! simply enable the \"mute audio\" option in settings > audio.\n• soundcloud module has been updated, and downloads should no longer break after some time.
\nvisual improvements:\n
• moved some things around in settings popup, and added separators where separation is needed.\n• updated some texts in english and russian.\n• version and commit hash have been joined together, now they're a single unit.
\ninternal improvements:\n
• updated api documentation to include isAudioMuted.\n• created render elements for separator and explanation due to high duplication of them in the page.\n• fixed some code quirks.
\nhere's how soundcloud downloads got fixed:\n\npreviously, client_id was (stupidly) hardcoded. that means cobalt wasn't able to fetch song data if soundcloud web app got updated.\nnow, cobalt tries to find the up-to-date client_id, caches it in memory, and checks if web app version has changed to update the id accordingly. you can see this change for yourself on github." + "content": "i've been longing to implement both of these things, and here they finally are.\n\nservice-related improvements:\n
• you now can download videos with no audio! simply enable the \"mute audio\" option in settings > audio.\n• soundcloud module has been updated, and downloads should no longer break after some time.
\nvisual improvements:\n
• moved some things around in settings popup, and added separators where separation is needed.\n• updated some texts in english and russian.\n• version and commit hash have been joined together, now they're a single unit.
\ninternal improvements:\n
• updated api documentation to include isAudioMuted.\n• created render elements for separator and explanation due to high duplication of them in the page.\n• fully deprecated GET method for API requests.\n• fixed some code quirks.
\nhere's how soundcloud downloads got fixed:\n\npreviously, client_id was (stupidly) hardcoded. that means cobalt wasn't able to fetch song data if soundcloud web app got updated.\nnow, cobalt tries to find the up-to-date client_id, caches it in memory, and checks if web app version has changed to update the id accordingly. you can see this change for yourself on github." }, "history": [{ "version": "4.5",