Skip to content

Commit

Permalink
build: @nsnanocat/url
Browse files Browse the repository at this point in the history
Update pnpm-lock.yaml
Update package.json
Update request.dev.js
Update request.js
  • Loading branch information
VirgilClyne committed Nov 10, 2024
1 parent 948d26d commit b949a70
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 56 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
"iOS >= 15"
],
"devDependencies": {
"@iringo/modkit": "1.2.0",
"@iringo/modkit": "1.3.0",
"@iringo/modkit-plugin-egern": "1.2.0",
"@rsbuild/plugin-node-polyfill": "^1.2.0"
},
"dependencies": {
"@nsnanocat/util": "^1.3.6"
"@nsnanocat/url": "^1.0.1",
"@nsnanocat/util": "^1.4.7"
}
}
96 changes: 52 additions & 44 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions src/request.dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { $platform, URL, _, Storage, fetch, notification, log, logError, wait, done, getScript, runScript } from "./utils/utils.mjs";
import { $app, Lodash as _, Storage, fetch, notification, log, logError, wait, done } from "@nsnanocat/util";
import { URL } from "@nsnanocat/url";
import database from "./function/database.mjs";
import setENV from "./function/setENV.mjs";
// 构造回复数据
Expand Down Expand Up @@ -171,9 +172,9 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
})()
.catch(e => logError(e))
.finally(() => {
switch ($response) {
default: // 有构造回复数据,返回构造的回复数据
//log(`🚧 finally`, `echo $response: ${JSON.stringify($response, null, 2)}`, "");
switch (typeof $response) {
case "object": // 有构造回复数据,返回构造的回复数据
//log("🚧 finally", `echo $response: ${JSON.stringify($response, null, 2)}`, "");
if ($response.headers?.["Content-Encoding"]) $response.headers["Content-Encoding"] = "identity";
if ($response.headers?.["content-encoding"]) $response.headers["content-encoding"] = "identity";
switch ($platform) {
Expand All @@ -189,9 +190,13 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
break;
}
break;
case undefined: // 无构造回复数据,发送修改的请求数据
//log(`🚧 finally`, `$request: ${JSON.stringify($request, null, 2)}`, "");
case "undefined": // 无构造回复数据,发送修改的请求数据
//log("🚧 finally", `$request: ${JSON.stringify($request, null, 2)}`, "");
done($request);
break;
default:
logError(`不合法的 $response 类型: ${typeof $response}`, "");
done();
break;
}
});
15 changes: 11 additions & 4 deletions src/request.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { $platform, URL, done, log, logError } from "@nsnanocat/util";
import { $app, Lodash as _, Storage, fetch, notification, log, logError, wait, done } from "@nsnanocat/util";
import { URL } from "@nsnanocat/url";
import database from "./function/database.mjs";
import setENV from "./function/setENV.mjs";
// 构造回复数据
Expand Down Expand Up @@ -156,8 +157,9 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
})()
.catch(e => logError(e))
.finally(() => {
switch ($response) {
default: // 有构造回复数据,返回构造的回复数据
switch (typeof $response) {
case "object": // 有构造回复数据,返回构造的回复数据
//log("🚧 finally", `echo $response: ${JSON.stringify($response, null, 2)}`, "");
if ($response.headers?.["Content-Encoding"]) $response.headers["Content-Encoding"] = "identity";
if ($response.headers?.["content-encoding"]) $response.headers["content-encoding"] = "identity";
switch ($platform) {
Expand All @@ -173,8 +175,13 @@ log(`⚠ FORMAT: ${FORMAT}`, "");
break;
}
break;
case undefined: // 无构造回复数据,发送修改的请求数据
case "undefined": // 无构造回复数据,发送修改的请求数据
//log("🚧 finally", `$request: ${JSON.stringify($request, null, 2)}`, "");
done($request);
break;
default:
logError(`不合法的 $response 类型: ${typeof $response}`, "");
done();
break;
}
});

0 comments on commit b949a70

Please sign in to comment.