From 49761f99bf1ba5f73b64b6b77008d9f4b8dbc850 Mon Sep 17 00:00:00 2001 From: Virgil Clyne Date: Thu, 28 Nov 2024 16:13:56 +0800 Subject: [PATCH] fix: Console Update response.dev.js Update request.dev.js Update request.js --- src/request.dev.js | 6 +++--- src/request.js | 12 ++++++------ src/response.dev.js | 12 +++++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/request.dev.js b/src/request.dev.js index 1367368..b98dc8c 100644 --- a/src/request.dev.js +++ b/src/request.dev.js @@ -7,13 +7,13 @@ let $response = undefined; /***************** Processing *****************/ // 解构URL const url = new URL($request.url); -Console.debug(`url: ${url.toJSON()}`); +Console.info(`url: ${url.toJSON()}`); // 获取连接参数 const PATHs = url.pathname.split("/").filter(Boolean); -Console.debug(`PATHs: ${PATHs}`); +Console.info(`PATHs: ${PATHs}`); // 解析格式 const FORMAT = ($request.headers?.["Content-Type"] ?? $request.headers?.["content-type"])?.split(";")?.[0]; -Console.debug(`FORMAT: ${FORMAT}`); +Console.info(`FORMAT: ${FORMAT}`); !(async () => { /** * 设置 diff --git a/src/request.js b/src/request.js index b9a3592..5252392 100644 --- a/src/request.js +++ b/src/request.js @@ -4,17 +4,17 @@ import database from "./function/database.mjs"; import setENV from "./function/setENV.mjs"; // 构造回复数据 let $response = undefined; -Console.debug = (...msg) => { }; +Console.debug = (...msg) => {}; /***************** Processing *****************/ // 解构URL const url = new URL($request.url); -Console.debug(`url: ${url.toJSON()}`); +Console.info(`url: ${url.toJSON()}`); // 获取连接参数 const PATHs = url.pathname.split("/").filter(Boolean); -Console.debug(`PATHs: ${PATHs}`); +Console.info(`PATHs: ${PATHs}`); // 解析格式 const FORMAT = ($request.headers?.["Content-Type"] ?? $request.headers?.["content-type"])?.split(";")?.[0]; -Console.debug(`FORMAT: ${FORMAT}`); +Console.info(`FORMAT: ${FORMAT}`); !(async () => { /** * 设置 @@ -173,8 +173,8 @@ Console.debug(`FORMAT: ${FORMAT}`); $request.url = url.toString(); Console.debug(`$request.url: ${$request.url}`); })() -.catch(e => Console.error(e)) -.finally(() => { + .catch(e => Console.error(e)) + .finally(() => { switch (typeof $response) { case "object": // 有构造回复数据,返回构造的回复数据 //Console.debug("🚧 finally", `echo $response: ${JSON.stringify($response, null, 2)}`); diff --git a/src/response.dev.js b/src/response.dev.js index 97f8f0a..6a8794e 100644 --- a/src/response.dev.js +++ b/src/response.dev.js @@ -6,15 +6,13 @@ import { Any } from "./protobuf/google/protobuf/any.js"; /***************** Processing *****************/ // 解构URL const url = new URL($request.url); -Console.debug(`url: ${url.toJSON()}`, ""); +Console.info(`url: ${url.toJSON()}`, ""); // 获取连接参数 -const HOST = url.hostname, - PATH = url.pathname, - PATHs = url.pathname.split("/").filter(Boolean); -Console.debug(`HOST: ${HOST}, PATH: ${PATH}`, ""); +const PATHs = url.pathname.split("/").filter(Boolean); +Console.info(`PATHs: ${PATHs}`, ""); // 解析格式 const FORMAT = ($response.headers?.["Content-Type"] ?? $response.headers?.["content-type"])?.split(";")?.[0]; -Console.debug(`FORMAT: ${FORMAT}`, ""); +Console.info(`FORMAT: ${FORMAT}`, ""); !(async () => { /** * 设置 @@ -79,7 +77,7 @@ Console.debug(`FORMAT: ${FORMAT}`, ""); break; case "api.bilibili.com": case "api.biliapi.net": - switch (PATH) { + switch (url.pathname) { case "/pgc/player/api/playurl": // 番剧-播放地址-api case "/pgc/player/web/playurl": // 番剧-播放地址-web case "/pgc/player/web/playurl/html5": // 番剧-播放地址-web-HTML5