fix small issues

This commit is contained in:
wukko
2022-09-01 19:51:18 +06:00
parent e61122d5b0
commit f70128f4fc
11 changed files with 40 additions and 49 deletions

View File

@@ -9,8 +9,8 @@ function closest(goal, array) {
export default function(service, quality, maxQuality) {
if (quality == "max") return maxQuality;
quality = parseInt(mq[quality])
maxQuality = parseInt(maxQuality)
quality = parseInt(mq[quality], 10)
maxQuality = parseInt(maxQuality, 10)
if (quality >= maxQuality || quality == maxQuality) return maxQuality;

View File

@@ -22,6 +22,6 @@ export default function(res, ip, id, hmac, exp) {
res.status(streamInfo.status).json(apiJSON(0, { t: streamInfo.error }).body);
}
} catch (e) {
internalError(res)
res.status(500).json({ status: "error", text: "Internal Server Error" });
}
}

View File

@@ -4,7 +4,7 @@ import got from "got";
import { ffmpegArgs, genericUserAgent } from "../config.js";
import { msToTime } from "../sub/utils.js";
export async function streamDefault(streamInfo, res) {
export function streamDefault(streamInfo, res) {
try {
res.setHeader('Content-disposition', `attachment; filename="${streamInfo.isAudioOnly ? `${streamInfo.filename}.${streamInfo.audioFormat}` : streamInfo.filename}"`);
const stream = got.get(streamInfo.urls, {
@@ -23,7 +23,7 @@ export async function streamDefault(streamInfo, res) {
res.end();
}
}
export async function streamLiveRender(streamInfo, res) {
export function streamLiveRender(streamInfo, res) {
try {
if (streamInfo.urls.length == 2) {
let headers = {};
@@ -79,7 +79,7 @@ export async function streamLiveRender(streamInfo, res) {
res.end();
}
}
export async function streamAudioOnly(streamInfo, res) {
export function streamAudioOnly(streamInfo, res) {
try {
let headers = {};
if (streamInfo.service == "bilibili") {