removed legacy stuff

This commit is contained in:
wukko 2022-12-17 17:29:40 +06:00
parent 13c2884a41
commit 498bdabb86
2 changed files with 3 additions and 21 deletions

View file

@ -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`))

View file

@ -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<div class=\"bullpadding\">&bull; you now can download videos with no audio! simply enable the \"mute audio\" option in settings &gt; audio.\n&bull; soundcloud module has been updated, and downloads should no longer break after some time.</div>\nvisual improvements:\n<div class=\"bullpadding\">&bull; moved some things around in settings popup, and added separators where separation is needed.\n&bull; updated some texts in english and russian.\n&bull; version and commit hash have been joined together, now they're a single unit.</div>\ninternal improvements:\n<div class=\"bullpadding\">&bull; updated api documentation to include isAudioMuted.\n&bull; created render elements for separator and explanation due to high duplication of them in the page.\n&bull; fixed some code quirks.</div>\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<div class=\"bullpadding\">&bull; you now can download videos with no audio! simply enable the \"mute audio\" option in settings &gt; audio.\n&bull; soundcloud module has been updated, and downloads should no longer break after some time.</div>\nvisual improvements:\n<div class=\"bullpadding\">&bull; moved some things around in settings popup, and added separators where separation is needed.\n&bull; updated some texts in english and russian.\n&bull; version and commit hash have been joined together, now they're a single unit.</div>\ninternal improvements:\n<div class=\"bullpadding\">&bull; updated api documentation to include isAudioMuted.\n&bull; created render elements for separator and explanation due to high duplication of them in the page.\n&bull; fully deprecated GET method for API requests.\n&bull; fixed some code quirks.</div>\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",