diff --git a/src/cobalt.js b/src/cobalt.js
index e8173cca..f21835a4 100644
--- a/src/cobalt.js
+++ b/src/cobalt.js
@@ -69,8 +69,8 @@ if (fs.existsSync('./.env') && process.env.selfURL && process.env.streamSalt &&
try {
JSON.parse(buf);
if (buf.length > 720) throw new Error();
- if (req.header('Content-Type') != "application/json") res.status(500).json({ 'status': 'error', 'text': 'invalid content type header' })
- if (req.header('Accept') != "application/json") res.status(500).json({ 'status': 'error', 'text': 'invalid accept header' })
+ if (String(req.header('Content-Type')) !== "application/json") res.status(500).json({ 'status': 'error', 'text': 'invalid content type header' })
+ if (String(req.header('Accept')) !== "application/json") res.status(500).json({ 'status': 'error', 'text': 'invalid accept header' })
} catch(e) {
res.status(500).json({ 'status': 'error', 'text': 'invalid json body.' })
}
diff --git a/src/modules/pageRender/onDemand.js b/src/modules/pageRender/onDemand.js
index 7ab1373a..6fed7c0b 100644
--- a/src/modules/pageRender/onDemand.js
+++ b/src/modules/pageRender/onDemand.js
@@ -6,7 +6,7 @@ export function changelogHistory() { // blockId 0
let historyLen = history.length
for (let i in history) {
- let separator = (i != 0 && i != historyLen) ? '
' : ''
+ let separator = (i !== 0 && i !== historyLen) ? '' : ''
render += `${separator}${history[i]["banner"] ? `` : ''}`
}
return render;
diff --git a/src/modules/processing/services/reddit.js b/src/modules/processing/services/reddit.js
index 4465ec04..30d51b71 100644
--- a/src/modules/processing/services/reddit.js
+++ b/src/modules/processing/services/reddit.js
@@ -13,7 +13,7 @@ export default async function(obj) {
let video = data["secure_media"]["reddit_video"]["fallback_url"].split('?')[0],
audio = video.match('.mp4') ? `${video.split('_')[0]}_audio.mp4` : `${data["secure_media"]["reddit_video"]["fallback_url"].split('DASH')[0]}audio`;
- await fetch(audio, { method: "HEAD" }).then((r) => {if (r.status != 200) audio = ''}).catch(() => {audio = ''});
+ await fetch(audio, { method: "HEAD" }).then((r) => {if (Number(r.status) !== 200) audio = ''}).catch(() => {audio = ''});
let id = data["secure_media"]["reddit_video"]["fallback_url"].split('/')[3];
if (!audio.length > 0) return { typeId: 1, urls: video };
diff --git a/src/modules/processing/services/soundcloud.js b/src/modules/processing/services/soundcloud.js
index 312f60ef..aa3a695a 100644
--- a/src/modules/processing/services/soundcloud.js
+++ b/src/modules/processing/services/soundcloud.js
@@ -56,7 +56,7 @@ export default async function(obj) {
let fileUrlBase = json.media.transcodings[0]["url"].replace("/hls", "/progressive")
let fileUrl = `${fileUrlBase}${fileUrlBase.includes("?") ? "&" : "?"}client_id=${clientId}&track_authorization=${json.track_authorization}`;
- if (!fileUrl.substring(0, 54) === "https://api-v2.soundcloud.com/media/soundcloud:tracks:") return { error: 'ErrorEmptyDownload' };
+ if (fileUrl.substring(0, 54) !== "https://api-v2.soundcloud.com/media/soundcloud:tracks:") return { error: 'ErrorEmptyDownload' };
if (json.duration > maxAudioDuration) return { error: ['ErrorLengthAudioConvert', maxAudioDuration / 60000] };
diff --git a/src/modules/processing/services/twitter.js b/src/modules/processing/services/twitter.js
index f46c63a4..77eb375e 100644
--- a/src/modules/processing/services/twitter.js
+++ b/src/modules/processing/services/twitter.js
@@ -74,7 +74,7 @@ export default async function(obj) {
if (!AudioSpaceById) return { error: 'ErrorEmptyDownload' };
if (!AudioSpaceById.data.audioSpace.metadata) return { error: 'ErrorEmptyDownload' };
- if (!AudioSpaceById.data.audioSpace.metadata.is_space_available_for_replay === true) return { error: 'TwitterSpaceWasntRecorded' };
+ if (AudioSpaceById.data.audioSpace.metadata.is_space_available_for_replay !== true) return { error: 'TwitterSpaceWasntRecorded' };
let streamStatus = await fetch(
`https://twitter.com/i/api/1.1/live_video_stream/status/${AudioSpaceById.data.audioSpace.metadata.media_key}`, { headers: _headers }
diff --git a/src/modules/processing/services/vimeo.js b/src/modules/processing/services/vimeo.js
index 534ce05d..7f402597 100644
--- a/src/modules/processing/services/vimeo.js
+++ b/src/modules/processing/services/vimeo.js
@@ -13,7 +13,7 @@ export default async function(obj) {
let best = all[0];
try {
- if (obj.quality != "max") {
+ if (obj.quality !== "max") {
let pref = parseInt(quality[obj.quality], 10)
for (let i in all) {
let currQuality = parseInt(all[i]["quality"].replace('p', ''), 10)
@@ -50,7 +50,7 @@ export default async function(obj) {
switch (type) {
case "parcel":
- if (obj.quality != "max") {
+ if (obj.quality !== "max") {
let pref = parseInt(quality[obj.quality], 10)
for (let i in masterJSON_Video) {
let currQuality = parseInt(services.vimeo.resolutionMatch[masterJSON_Video[i]["width"]], 10)
diff --git a/src/modules/processing/services/vk.js b/src/modules/processing/services/vk.js
index 2ab7feb7..c30d1e7f 100644
--- a/src/modules/processing/services/vk.js
+++ b/src/modules/processing/services/vk.js
@@ -12,7 +12,7 @@ export default async function(obj) {
let js = JSON.parse('{"lang":' + html.split(`{"lang":`)[1].split(']);')[0]);
- if (!Number(js["mvData"]["is_active_live"]) === 0) return { error: 'ErrorLiveVideo' };
+ if (Number(js["mvData"]["is_active_live"]) !== 0) return { error: 'ErrorLiveVideo' };
if (js["mvData"]["duration"] > maxVideoDuration / 1000) return { error: ['ErrorLengthLimit', maxVideoDuration / 60000] };
let mpd = JSON.parse(xml2json(js["player"]["params"][0]["manifest"], { compact: true, spaces: 4 }));
diff --git a/src/modules/processing/services/youtube.js b/src/modules/processing/services/youtube.js
index 8ec87453..d96af51f 100644
--- a/src/modules/processing/services/youtube.js
+++ b/src/modules/processing/services/youtube.js
@@ -12,7 +12,7 @@ export default async function(obj) {
let videoMatch = [], fullVideoMatch = [], video = [],
audio = info.filter((a) => {
- if (!a["isHLS"] && !a["isDashMPD"] && a["hasAudio"] && !a["hasVideo"] && a["container"] == obj.format) return true
+ if (!a["isHLS"] && !a["isDashMPD"] && a["hasAudio"] && !a["hasVideo"] && a["container"] === obj.format) return true
}).sort((a, b) => Number(b.bitrate) - Number(a.bitrate));
if (audio.length === 0) return { error: 'ErrorBadFetch' };
@@ -20,11 +20,11 @@ export default async function(obj) {
if (!isAudioOnly) {
video = info.filter((a) => {
- if (!a["isHLS"] && !a["isDashMPD"] && a["hasVideo"] && a["container"] == obj.format) {
- if (obj.quality != "max") {
- if (a["hasAudio"] && mq[obj.quality] == a["height"]) {
+ if (!a["isHLS"] && !a["isDashMPD"] && a["hasVideo"] && a["container"] === obj.format) {
+ if (obj.quality !== "max") {
+ if (a["hasAudio"] && String(mq[obj.quality]) === String(a["height"])) {
fullVideoMatch.push(a)
- } else if (!a["hasAudio"] && mq[obj.quality] == a["height"]) {
+ } else if (!a["hasAudio"] && String(mq[obj.quality]) === String(a["height"])) {
videoMatch.push(a)
}
}
@@ -32,11 +32,11 @@ export default async function(obj) {
}
}).sort((a, b) => Number(b.bitrate) - Number(a.bitrate));
- if (obj.quality != "max") {
+ if (obj.quality !== "max") {
if (videoMatch.length === 0) {
let ss = selectQuality("youtube", obj.quality, video[0]["qualityLabel"].slice(0, 5).replace('p', '').trim());
videoMatch = video.filter((a) => {
- if (a["qualityLabel"].slice(0, 5).replace('p', '').trim() == ss) return true
+ if (a["qualityLabel"].slice(0, 5).replace('p', '').trim() === String(ss)) return true
})
} else if (fullVideoMatch.length > 0) {
videoMatch = [fullVideoMatch[0]]
diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js
index 5160d83f..ef77d238 100644
--- a/src/modules/stream/types.js
+++ b/src/modules/stream/types.js
@@ -27,7 +27,7 @@ export function streamDefault(streamInfo, res) {
}
export function streamLiveRender(streamInfo, res) {
try {
- if (!streamInfo.urls.length === 2) {
+ if (streamInfo.urls.length !== 2) {
res.end();
return;
}