mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: music proxy
This commit is contained in:
14
src/webui/src/api/Proxy.ts
Normal file
14
src/webui/src/api/Proxy.ts
Normal 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参数不合法'));
|
||||
}
|
||||
};
|
@@ -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 };
|
||||
|
Reference in New Issue
Block a user