Skip to content

Commit

Permalink
fix: Console
Browse files Browse the repository at this point in the history
Update response.dev.js
Update request.dev.js
Update request.js
  • Loading branch information
VirgilClyne committed Nov 28, 2024
1 parent 5dcce58 commit 49761f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/request.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
/**
* 设置
Expand Down
12 changes: 6 additions & 6 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
/**
* 设置
Expand Down Expand Up @@ -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)}`);
Expand Down
12 changes: 5 additions & 7 deletions src/response.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
/**
* 设置
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49761f9

Please sign in to comment.