fix: music proxy

This commit is contained in:
手瓜一十雪
2025-01-25 18:34:11 +08:00
parent c474158a09
commit 49234ea5c7
4 changed files with 30 additions and 7 deletions

View File

@@ -0,0 +1,14 @@
import { RequestHandler } from "express";
import { RequestUtil } from "@/common/request";
import { sendError, sendSuccess } from "../utils/response";
export const GetProxyHandler: RequestHandler = async (req, res) => {
let { url } = req.query;
if (url && typeof url === "string") {
url = decodeURIComponent(url);
const responseText = await RequestUtil.HttpGetText(url);
res.send(sendSuccess(res, responseText));
} else {
res.send(sendError(res, 'url参数不合法'));
}
};

View File

@@ -1,11 +1,12 @@
import { Router } from 'express';
import { PackageInfoHandler, QQVersionHandler } from '../api/BaseInfo';
import { StatusRealTimeHandler } from "@webapi/api/Status";
import { GetProxyHandler } from '../api/Proxy';
const router = Router();
// router: 获取nc的package.json信息
router.get('/QQVersion', QQVersionHandler);
router.get('/PackageInfo', PackageInfoHandler);
router.get('/GetSysStatusRealTime', StatusRealTimeHandler);
router.get('/proxy', GetProxyHandler);
export { router as BaseRouter };