Skip to content

Commit d098ade

Browse files
author
Taois
committed
feat: 本地代理传参
1 parent c87f51b commit d098ade

15 files changed

+37444
-5
lines changed

drpy-node-bundle/libs/localDsCore.bundled.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414869,11 +414869,23 @@ async function getEngine(moduleName, query, inject_env) {
414869414869
* @returns {Object} 环境对象,包含各种URL和配置
414870414870
*/
414871414871
function getEnv(moduleName) {
414872-
const proxyUrl = inject_env.proxyUrl || "http://127.0.0.1:9978/proxy?do=node";
414872+
const { jsonUrl = "http://127.0.0.1:9978/json", publicUrl = "http://127.0.0.1:9978/public", requestHost = "http://127.0.0.1:9978", hostname = "127.0.0.1:9978", hostUrl = "127.0.0.1", proxyUrl = `http://127.0.0.1:9978/proxy?do=node&siteKey=${moduleName}`, httpUrl, imageApi, mediaProxyUrl, webdavProxyUrl, ftpProxyUrl, wsName, fServer } = inject_env;
414873414873
const getProxyUrl = function() {
414874414874
return proxyUrl;
414875414875
};
414876414876
return {
414877+
httpUrl,
414878+
imageApi,
414879+
mediaProxyUrl,
414880+
webdavProxyUrl,
414881+
ftpProxyUrl,
414882+
wsName,
414883+
fServer,
414884+
hostUrl,
414885+
jsonUrl,
414886+
publicUrl,
414887+
requestHost,
414888+
hostname,
414877414889
proxyUrl,
414878414890
getProxyUrl,
414879414891
ext: moduleExt,

drpy-node-bundle/localDsCore.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,38 @@ async function getEngine(moduleName, query, inject_env) {
8080
* @returns {Object} 环境对象,包含各种URL和配置
8181
*/
8282
function getEnv(moduleName) {
83-
const proxyUrl = inject_env.proxyUrl || "http://127.0.0.1:9978/proxy?do=node";
83+
// const proxyUrl = inject_env.proxyUrl || "http://127.0.0.1:9978/proxy?do=node";
84+
const {
85+
jsonUrl = "http://127.0.0.1:9978/json",
86+
publicUrl = "http://127.0.0.1:9978/public",
87+
requestHost = "http://127.0.0.1:9978",
88+
hostname = "127.0.0.1:9978",
89+
hostUrl = "127.0.0.1",
90+
proxyUrl = `http://127.0.0.1:9978/proxy?do=node&siteKey=${moduleName}`,
91+
httpUrl, imageApi, mediaProxyUrl, webdavProxyUrl, ftpProxyUrl,
92+
wsName, fServer,
93+
} = inject_env;
8494
const getProxyUrl = function () {
8595
return proxyUrl
8696
};
8797
return {
98+
httpUrl,
99+
imageApi,
100+
mediaProxyUrl,
101+
webdavProxyUrl,
102+
ftpProxyUrl,
103+
wsName,
104+
fServer,
105+
// 下面这些很常用
106+
hostUrl,
107+
jsonUrl,
108+
publicUrl,
109+
requestHost,
110+
hostname,
88111
proxyUrl,
89112
getProxyUrl,
90113
ext: moduleExt,
91-
moduleName: moduleName
114+
moduleName: moduleName,
92115
}
93116
}
94117

drpy-node-bundle/localDsCoreTest.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ console.log(getEngine)
66
// console.log(a)
77
// const b = await getEngine('奇奇[官]', {do: 'cat'})
88
// console.log(b)
9-
const c = await getEngine('果果[官]', {do: 'cat', ac: 'list', t: '3'})
10-
console.log(c)
9+
// const c = await getEngine('果果[官]', {do: 'cat', ac: 'list', t: '3'})
10+
// console.log(c)
11+
const d = await getEngine('设置中心', {do: 'ds'})
12+
console.log(d)

0 commit comments

Comments
 (0)