t880216t-server 1.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +124 -0
- package/README.md +191 -0
- package/bin/nohost.js +178 -0
- package/bin/plugin.js +70 -0
- package/bin/util.js +93 -0
- package/index.js +89 -0
- package/lib/config.js +42 -0
- package/lib/index.js +205 -0
- package/lib/main/cgi/getSettings.js +11 -0
- package/lib/main/cgi/getVersion.js +12 -0
- package/lib/main/cgi/login.js +14 -0
- package/lib/main/cgi/restart.js +5 -0
- package/lib/main/cgi/setAdmin.js +6 -0
- package/lib/main/cgi/setDomain.js +13 -0
- package/lib/main/cgi/status.js +122 -0
- package/lib/main/index.js +94 -0
- package/lib/main/router.js +79 -0
- package/lib/main/storage.js +132 -0
- package/lib/main/util.js +138 -0
- package/lib/main/whistleMgr.js +56 -0
- package/lib/main/worker.js +52 -0
- package/lib/main/workerNum.js +11 -0
- package/lib/plugins/account/whistle.share/menu.html +171 -0
- package/lib/plugins/account/whistle.share/package.json +20 -0
- package/lib/plugins/account/whistle.storage/index.js +43 -0
- package/lib/plugins/account/whistle.storage/package.json +8 -0
- package/lib/plugins/account/whistle.storage/rules.txt +1 -0
- package/lib/plugins/whistle.nohost/_rules.txt +38 -0
- package/lib/plugins/whistle.nohost/index.js +3 -0
- package/lib/plugins/whistle.nohost/initial.js +9 -0
- package/lib/plugins/whistle.nohost/lib/accountMgr.js +750 -0
- package/lib/plugins/whistle.nohost/lib/envMgr.js +114 -0
- package/lib/plugins/whistle.nohost/lib/rulesServer.js +85 -0
- package/lib/plugins/whistle.nohost/lib/tunnelRulesServer.js +71 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/account/changePassword.js +8 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/activeAccount.js +9 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/addAccount.js +8 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/allAccounts.js +9 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/changeNotice.js +8 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/changePassword.js +8 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/enableGuest.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/getAuthKey.js +3 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/getSettings.js +22 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/login.js +14 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/move.js +9 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/removeAccount.js +9 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setAccountRules.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setAuthKey.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setDefaultRules.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setEntryPatterns.js +6 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setJsonData.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setRulesTpl.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/setTestRules.js +5 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/admin/specPattern.js +4 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/allowlist.js +4 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/entryRules.js +4 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/follow.js +17 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/getEnv.js +12 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/list.js +43 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/patterns.js +14 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/pluginRules.js +61 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/proxy.js +42 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/proxyNetwork.js +12 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/redirect.js +10 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/selectEnv.js +30 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/cgi/unfollow.js +4 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/index.js +60 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/network.js +38 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/openAPI.js +94 -0
- package/lib/plugins/whistle.nohost/lib/uiServer/router.js +85 -0
- package/lib/plugins/whistle.nohost/lib/util.js +230 -0
- package/lib/plugins/whistle.nohost/lib/whistle.js +149 -0
- package/lib/plugins/whistle.nohost/lib/whistleMgr.js +94 -0
- package/lib/plugins/whistle.nohost/package.json +7 -0
- package/lib/plugins/whistle.nohost/rules.txt +3 -0
- package/lib/service/cgi/export.js +76 -0
- package/lib/service/cgi/import.js +33 -0
- package/lib/service/cgi/util.js +35 -0
- package/lib/service/index.js +37 -0
- package/lib/service/router.js +7 -0
- package/lib/service/server.js +25 -0
- package/lib/util/address.js +55 -0
- package/lib/util/getPort.js +19 -0
- package/lib/util/login.js +55 -0
- package/lib/util/parseDomain.js +17 -0
- package/lib/whistle.js +86 -0
- package/package.json +135 -0
- package/pnpm-workspace.yaml +6 -0
- package/public/admin.75d42731d4aa7f7a558d3abf2a375fcb.js +2 -0
- package/public/admin.75d42731d4aa7f7a558d3abf2a375fcb.js.LICENSE.txt +76 -0
- package/public/admin.html +11 -0
- package/public/button.js +2 -0
- package/public/button.js.LICENSE.txt +31 -0
- package/public/capture.7bab900f27c9bb1b0e33523e994554ae.js +2 -0
- package/public/capture.7bab900f27c9bb1b0e33523e994554ae.js.LICENSE.txt +83 -0
- package/public/capture.html +11 -0
- package/public/eed368d0656f03932671530c3132ed61.svg +1 -0
- package/public/favicon.ico +0 -0
- package/public/network.e4814ec8c966a8a789296679619ec573.js +2 -0
- package/public/network.e4814ec8c966a8a789296679619ec573.js.LICENSE.txt +76 -0
- package/public/network.html +11 -0
- package/public/select.cb638be6656d02a558f2690acd59901a.js +2 -0
- package/public/select.cb638be6656d02a558f2690acd59901a.js.LICENSE.txt +24 -0
- package/public/select.html +26 -0
package/lib/whistle.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const startWhistle = require('whistle');
|
|
4
|
+
const { homedir } = require('os');
|
|
5
|
+
const { getWhistlePath } = require('whistle');
|
|
6
|
+
const { getServerIp } = require('./util/address');
|
|
7
|
+
const parseDomain = require('./util/parseDomain');
|
|
8
|
+
const getPort = require('./util/getPort');
|
|
9
|
+
|
|
10
|
+
const getShadowRules = (port, domain) => {
|
|
11
|
+
domain = parseDomain(domain);
|
|
12
|
+
domain.unshift(`//${getServerIp()}:${port}`);
|
|
13
|
+
return domain.map((d) => {
|
|
14
|
+
return `${d} http://127.0.0.1:${port} enable://capture`;
|
|
15
|
+
}).join('\n');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = (options, callback) => {
|
|
19
|
+
getPort((port) => {
|
|
20
|
+
const {
|
|
21
|
+
domain,
|
|
22
|
+
username,
|
|
23
|
+
password,
|
|
24
|
+
realPort,
|
|
25
|
+
realHost,
|
|
26
|
+
authKey,
|
|
27
|
+
mainAuthKey,
|
|
28
|
+
debugMode,
|
|
29
|
+
storageServer,
|
|
30
|
+
dnsServer,
|
|
31
|
+
globalPluginPath,
|
|
32
|
+
accountPluginPath,
|
|
33
|
+
} = options;
|
|
34
|
+
const projectPluginPath = [path.join(__dirname, 'plugins')];
|
|
35
|
+
const notUninstallPluginPath = [path.join(__dirname, '../node_modules')];
|
|
36
|
+
const addon = globalPluginPath ? projectPluginPath.concat(globalPluginPath) : projectPluginPath;
|
|
37
|
+
let { baseDir } = options;
|
|
38
|
+
if (/^~\//.test(baseDir)) {
|
|
39
|
+
baseDir = path.join(homedir(), baseDir.substring(2));
|
|
40
|
+
} else if (baseDir && /^[\w.-]+$/.test(baseDir)) {
|
|
41
|
+
baseDir = path.join(homedir(), '.nohost', baseDir);
|
|
42
|
+
}
|
|
43
|
+
if (baseDir) {
|
|
44
|
+
process.env.NOHOST_BADE_DIR = baseDir;
|
|
45
|
+
}
|
|
46
|
+
const mode = 'proxyServer|master|x-forwarded-proto';
|
|
47
|
+
const proxy = startWhistle({
|
|
48
|
+
port,
|
|
49
|
+
baseDir,
|
|
50
|
+
projectPluginPath,
|
|
51
|
+
notUninstallPluginPath,
|
|
52
|
+
customPluginPath: path.join(getWhistlePath(), 'nohost_plugins/main_plugins'),
|
|
53
|
+
addon,
|
|
54
|
+
encrypted: true,
|
|
55
|
+
username,
|
|
56
|
+
password,
|
|
57
|
+
realPort,
|
|
58
|
+
realHost,
|
|
59
|
+
cmdName: 'n2 -g',
|
|
60
|
+
host: '127.0.0.1',
|
|
61
|
+
shadowRules: getShadowRules(realPort, domain),
|
|
62
|
+
dnsServer,
|
|
63
|
+
authKey: mainAuthKey,
|
|
64
|
+
pluginsDataMap: {
|
|
65
|
+
nohost: {
|
|
66
|
+
username,
|
|
67
|
+
password,
|
|
68
|
+
domain,
|
|
69
|
+
realPort,
|
|
70
|
+
realHost,
|
|
71
|
+
authKey,
|
|
72
|
+
storageServer,
|
|
73
|
+
dnsServer,
|
|
74
|
+
accountPluginPath,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
mode: debugMode ? mode : `${mode}|strict|rules|disableUpdateTips|proxifier|notAllowedDisablePlugins`,
|
|
78
|
+
}, () => {
|
|
79
|
+
const {
|
|
80
|
+
REMOTE_ADDR_HEAD: remoteAddrHead,
|
|
81
|
+
REMOTE_PORT_HEAD: remotePortHead,
|
|
82
|
+
} = proxy.config;
|
|
83
|
+
callback(null, { remoteAddrHead, remotePortHead, port });
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "t880216t-server",
|
|
3
|
+
"version": "1.5.20",
|
|
4
|
+
"description": "Multi-user & multi-env web debugging proxy based on whistle",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nohost": "./bin/nohost.js",
|
|
8
|
+
"nohosts": "./bin/nohost.js",
|
|
9
|
+
"n2": "./bin/nohost.js"
|
|
10
|
+
},
|
|
11
|
+
"directories": {
|
|
12
|
+
"lib": "lib"
|
|
13
|
+
},
|
|
14
|
+
"port": 8080,
|
|
15
|
+
"scripts": {
|
|
16
|
+
"lint": "eslint *.js lib test src bin packages",
|
|
17
|
+
"lintfix": "eslint --fix *.js lib test src bin packages",
|
|
18
|
+
"dev": "rimraf public && webpack --config ./src/config/webpack.dev.js -w",
|
|
19
|
+
"dist": "rimraf public && webpack --config ./src/config/webpack.prod.js",
|
|
20
|
+
"server": "node bin/nohost run -b dev",
|
|
21
|
+
"start": "nodemon --exec npm run server",
|
|
22
|
+
"docs:dev": "vuepress dev docs",
|
|
23
|
+
"docs:build": "vuepress build docs",
|
|
24
|
+
"test": "jest --config=./test/jest/jest.config.js --coverage",
|
|
25
|
+
"test:watch": "jest --config=./test/jest/jest.config.js --watchAll --coverage"
|
|
26
|
+
},
|
|
27
|
+
"husky": {
|
|
28
|
+
"hooks": {
|
|
29
|
+
"pre-commit": "lint-staged",
|
|
30
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{js,jsx,tsx,ts}": [
|
|
35
|
+
"eslint --fix --quiet",
|
|
36
|
+
"git add"
|
|
37
|
+
],
|
|
38
|
+
"*.{css,scss,less,sss,json,html,yml,graphql,gql}": [
|
|
39
|
+
"prettier --write",
|
|
40
|
+
"git add"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"nodemonConfig": {
|
|
44
|
+
"watch": [
|
|
45
|
+
"lib/"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"registry": "https://registry.npmjs.org/t880216t-server",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/Tencent/nohost.git"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"whistle",
|
|
55
|
+
"multi-users",
|
|
56
|
+
"nohost"
|
|
57
|
+
],
|
|
58
|
+
"author": "avwu <avwu@qq.com>",
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/Tencent/nohost/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/Tencent/nohost#readme",
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@commitlint/cli": "^12.0.1",
|
|
66
|
+
"@commitlint/config-conventional": "^12.0.1",
|
|
67
|
+
"antd": "^3.25.3",
|
|
68
|
+
"babel-core": "^6.25.0",
|
|
69
|
+
"babel-eslint": "10.0.3",
|
|
70
|
+
"babel-loader": "^7.1.1",
|
|
71
|
+
"babel-plugin-import": "^1.2.1",
|
|
72
|
+
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
73
|
+
"babel-plugin-transform-object-assign": "^6.22.0",
|
|
74
|
+
"babel-preset-env": "^1.6.1",
|
|
75
|
+
"babel-preset-es2015": "^6.24.1",
|
|
76
|
+
"babel-preset-react": "^6.24.1",
|
|
77
|
+
"babel-preset-stage-0": "^6.24.1",
|
|
78
|
+
"clipboard": "^2.0.6",
|
|
79
|
+
"copy-webpack-plugin": "^5.0.4",
|
|
80
|
+
"css-loader": "^3.5.1",
|
|
81
|
+
"eslint": "^5.3.0",
|
|
82
|
+
"eslint-config-imweb": "^0.2.19",
|
|
83
|
+
"file-loader": "^4.2.0",
|
|
84
|
+
"html-webpack-plugin": "^3.2.0",
|
|
85
|
+
"husky": "^3.0.1",
|
|
86
|
+
"jest": "^26.5.2",
|
|
87
|
+
"jquery": "3.3.1",
|
|
88
|
+
"kill-port": "^1.6.1",
|
|
89
|
+
"less": "^3.10.3",
|
|
90
|
+
"less-loader": "^5.0.0",
|
|
91
|
+
"lint-staged": "^10.5.4",
|
|
92
|
+
"nodemon": "^2.0.7",
|
|
93
|
+
"prop-types": "^15.5.10",
|
|
94
|
+
"qrcode": "^1.2.0",
|
|
95
|
+
"query-string": "^5.0.1",
|
|
96
|
+
"rc-tween-one": "^2.6.5",
|
|
97
|
+
"react": "^16.2.0",
|
|
98
|
+
"react-dom": "^16.2.0",
|
|
99
|
+
"rimraf": "^3.0.0",
|
|
100
|
+
"style-loader": "^1.0.0",
|
|
101
|
+
"terser-webpack-plugin": "^2.2.1",
|
|
102
|
+
"vuepress": "^1.2.0",
|
|
103
|
+
"webpack": "^4.41.2",
|
|
104
|
+
"webpack-cli": "^3.3.10",
|
|
105
|
+
"webpack-merge": "^4.2.2",
|
|
106
|
+
"whistle-editor": "^0.2.9"
|
|
107
|
+
},
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"@nohost/router": "^1.1.0",
|
|
110
|
+
"async-limiter": "^2.0.0",
|
|
111
|
+
"basic-auth": "^2.0.1",
|
|
112
|
+
"colors": "^1.4.0",
|
|
113
|
+
"cookie": "^0.4.0",
|
|
114
|
+
"crc32": "^0.2.2",
|
|
115
|
+
"fs-extra": "^8.1.0",
|
|
116
|
+
"koa": "^2.8.2",
|
|
117
|
+
"koa-bodyparser": "^4.2.1",
|
|
118
|
+
"koa-compress": "^4.0.1",
|
|
119
|
+
"koa-onerror": "^4.1.0",
|
|
120
|
+
"koa-router": "^12.0.1",
|
|
121
|
+
"koa-static": "^5.0.0",
|
|
122
|
+
"lodash.get": "^4.4.2",
|
|
123
|
+
"lru-cache": "^5.1.1",
|
|
124
|
+
"parseurl": "^1.3.3",
|
|
125
|
+
"pfork": "^0.6.2",
|
|
126
|
+
"simpleproto": "^1.1.0",
|
|
127
|
+
"socketx": "^1.1.0",
|
|
128
|
+
"starting": "^8.0.3",
|
|
129
|
+
"whistle": "^2.9.84",
|
|
130
|
+
"whistle.bi-watcher": "^1.2.2",
|
|
131
|
+
"whistle.inspect": "^2.2.6",
|
|
132
|
+
"whistle.script": "^1.2.10"
|
|
133
|
+
},
|
|
134
|
+
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef"
|
|
135
|
+
}
|