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 setENV.mjs
Update request.js
  • Loading branch information
VirgilClyne committed Nov 29, 2024
1 parent 5dcce58 commit e2ebcc1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/function/setENV.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { Lodash as _, getStorage, Console } from "@nsnanocat/util";
* @return {Object} { Settings, Caches, Configs }
*/
export default function setENV(name, platforms, database) {
Console.info("☑️ Set Environment Variables");
Console.log("☑️ Set Environment Variables");
const { Settings, Caches, Configs } = getStorage(name, platforms, database);
/***************** Settings *****************/
Console.debug(`Settings: ${typeof Settings}, Settings内容: ${JSON.stringify(Settings)}`);
/***************** Caches *****************/
//Console.debug(`Caches: ${typeof Caches}, Caches内容: ${JSON.stringify(Caches)}`);
/***************** Configs *****************/
Console.info("✅ Set Environment Variables");
Console.log("✅ Set Environment Variables");
return { Settings, Caches, Configs };
};
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 = () => {};
/***************** 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 e2ebcc1

Please sign in to comment.