filecat 7.9.0 → 7.10.2
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 +201 -201
- package/README.md +173 -182
- package/build/dist/{4967.3fd3bd40a2b5a3b52428.js → 1060.198d91e2dfc174317c3a.js} +1 -1
- package/build/dist/1075.05eed88707339ca32044.js +1 -0
- package/build/dist/{1142.121454b1de53689b7367.js → 1142.bc43fae2e5e38d9359df.js} +1 -1
- package/build/dist/1384.edbad9c24d883a59724d.js +1 -0
- package/build/dist/1417.d390b18dd58ff5c28160.js +1 -0
- package/build/dist/1448.4db495e1389c0c8445b3.js +1 -0
- package/build/dist/{3324.22efcb1c431177b1cf5f.js → 1455.26a021eb94e5bdd5bec2.js} +1 -1
- package/build/dist/{1636.b6a17252dfd0d22f09a7.js → 1636.b80b1883358e132d3424.js} +1 -1
- package/build/dist/{1832.8ea5c3e8288df0b7fd5c.js → 1832.a01933ba5df99576ecc2.js} +1 -1
- package/build/dist/2300.c99b1dd4e752cdfd5e32.js +2 -0
- package/build/dist/{2300.9e1baa1c0368abe53d96.js.LICENSE.txt → 2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt} +1 -1
- package/build/dist/239.f570f06d4b9c020f1013.js +1 -0
- package/build/dist/{2479.dcc88b3370f0f1d66e02.js → 2479.294792ef5d360ad64abc.js} +1 -1
- package/build/dist/2542.26cb302b60de23166227.js +1 -0
- package/build/dist/{259.81bb9e049e5ef587a96f.js → 259.3c0eb22e9b43ffb63c9c.js} +1 -1
- package/build/dist/2626.3bcfe1f26d9cb796a925.js +1 -0
- package/build/dist/2674.d1bf937289c51ddeceac.js +1 -0
- package/build/dist/3233.43bdd7c12ca829d56116.js +1 -0
- package/build/dist/3299.de79d172b41af93a8716.js +1 -0
- package/build/dist/{6992.f6a07311a638794c24f7.js → 3471.ef3b5dcfe37963034187.js} +1 -1
- package/build/dist/{3528.56eeefab6fca5884e2a6.js → 3528.0f8f34028d92fa87c518.js} +1 -1
- package/build/dist/{3659.8a31495bb8f38c0ffa7c.js → 3659.dd03dc2ac52a3ff19105.js} +1 -1
- package/build/dist/4004.f4c06b50348214eb2962.js +1 -0
- package/build/dist/{4560.8ef2e4b60cc86d019dd6.js → 4560.fd9f8cf2d6022b1d3a94.js} +1 -1
- package/build/dist/{4903.b5451ed0802b3f7c07b2.js → 4903.070aaa53a243baf05133.js} +1 -1
- package/build/dist/{4946.c95d4f426146e0180172.js → 4946.d578f6ba367a742d80bf.js} +2 -2
- package/build/dist/4986.f244efce9cf6be21f846.js +1 -0
- package/build/dist/5272.1f0dfac07ba202e7d323.js +1 -0
- package/build/dist/{5308.052f45c15785487b3766.js → 5308.d1e5ccb49396fc1b026d.js} +1 -1
- package/build/dist/{5516.645e4a900df9bdc1806c.js → 5516.88521f3a3c7101c46df3.js} +1 -1
- package/build/dist/5614.43bdd7c12ca829d56116.js +1 -0
- package/build/dist/{5139.adf9574d9b54a216e041.js → 5709.81f43e3c021fafdfe36f.js} +1 -1
- package/build/dist/{5744.e9f1efb88a617b05b709.js → 5744.0f8a0432b73b2eb0a7ff.js} +1 -1
- package/build/dist/{5877.ca081c4798194230243c.js → 5877.98d0475aaf4058b9a715.js} +1 -1
- package/build/dist/{6247.917e3fbef5dc5fbaf937.js → 6247.525b0b68872036ac2fa6.js} +1 -1
- package/build/dist/{7520.fbb0bc2a05cf94e15418.js → 6322.552511b5cb12cd0c821c.js} +1 -1
- package/build/dist/6492.17ecd8515fa512ce9306.js +1 -0
- package/build/dist/{676.a75318a8b598d8daadf0.js → 676.356039ef6f28f96b8c8b.js} +1 -1
- package/build/dist/{6805.bf0c964ab84f0fcc78be.js → 6805.373ac0e7d6555e4a6459.js} +1 -1
- package/build/dist/{6919.8cf13c01184b7148b28e.js → 6919.c7cc8617b658198d4924.js} +1 -1
- package/build/dist/{7038.4e4fc8e405c56d3080e2.js → 7038.166f915547d27e4dc5e4.js} +1 -1
- package/build/dist/{7759.0b68912ff9ef10869f59.js → 7759.7cd3fe8e5d37df25804c.js} +1 -1
- package/build/dist/7873.e3098bc6f510e5bea55f.js +1 -0
- package/build/dist/7923.d44556578af4d3d7cea3.js +2 -0
- package/build/dist/{7943.19d2de387eeb7f513d8e.js → 7943.acf25a5e98dd13290985.js} +1 -1
- package/build/dist/8090.8977224618a14ae42159.js +2 -0
- package/build/dist/8302.ce97557b7cf7c8387942.js +1 -0
- package/build/dist/8319.6a6b9651c87a1bb4cbb9.js +1 -0
- package/build/dist/{8603.4142ce42c1635f493eca.js → 8603.f1cbcfd64cde885f9809.js} +1 -1
- package/build/dist/8649.d6055ad75975b803bbc1.js +1 -0
- package/build/dist/{8727.3628c746061aed7a4077.js → 8727.8658835acb7e0b6e5acc.js} +1 -1
- package/build/dist/{8765.a5633d054abb67142fc3.js → 8765.8758c290a6b132f2ce7f.js} +1 -1
- package/build/dist/8772.2c35012c25ac9eb5f74d.js +2 -0
- package/build/dist/{8772.e8f9731c1c061f1cdf56.js.LICENSE.txt → 8772.2c35012c25ac9eb5f74d.js.LICENSE.txt} +1 -1
- package/build/dist/8781.6bd14487d172e004e3d3.js +1 -0
- package/build/dist/9299.76095cb6629c36ca3343.js +1 -0
- package/build/dist/9334.a25983aafdcbde63ae5e.js +1 -0
- package/build/dist/{9546.e7206c968e92371ae2b1.js → 9546.2cecad04cf676a6616cd.js} +1 -1
- package/build/dist/dark.css +839 -839
- package/build/dist/filerobot-image-editor.min.js +42445 -42445
- package/build/dist/google-dark.css +2032 -2032
- package/build/dist/google.css +1719 -1719
- package/build/dist/index.html +1 -1
- package/build/dist/main.26c2c54f6ab534513ebd.js +2 -0
- package/build/dist/{main.3a12152528aff6ae213a.js.LICENSE.txt → main.26c2c54f6ab534513ebd.js.LICENSE.txt} +1 -1
- package/build/dist/rle.js +17867 -17867
- package/build/main.js +1 -1
- package/build/plugin/core.type.d.ts +62 -0
- package/build/threads.work.filecat.js +1 -1
- package/env +26 -26
- package/package.json +211 -211
- package/shell/build.js +161 -161
- package/shell/config/.babelrc +14 -14
- package/shell/config/base.webpack.config.js +78 -78
- package/shell/config/common-bin.config.js +44 -44
- package/shell/config/env.js +10 -10
- package/shell/config/prebuild-file-path.js +17 -17
- package/shell/config/webpack.exe.config.js +36 -36
- package/shell/config/webpack.npm.config.js +44 -44
- package/shell/config/webpack.web.config.js +152 -152
- package/shell/dev.js +51 -51
- package/shell/docker-build.sh +2 -2
- package/shell/filecat +1 -1
- package/shell/filecat-watch +1 -1
- package/shell/install.js +48 -48
- package/shell/net-agent/git-clone.bat +23 -23
- package/shell/net-agent/git-pull.bat +17 -17
- package/shell/net-agent/git-push.bat +17 -17
- package/shell/pkg.ts +50 -50
- package/shell/postinstall-optional.js +29 -29
- package/shell/start/filecat-install.sh +22 -22
- package/shell/start/filecat-run.sh +2 -2
- package/shell/start/windows-install.js +178 -178
- package/shell/start/windows-uninstall.js +131 -131
- package/shell/util/file.js +46 -46
- package/build/dist/1075.40103ec059c6b23b056e.js +0 -1
- package/build/dist/1384.0d0fc5faa899c9eddcbe.js +0 -1
- package/build/dist/1417.7e511043474084a2a65b.js +0 -1
- package/build/dist/1448.0710f04bed1c52e6a5db.js +0 -1
- package/build/dist/2300.9e1baa1c0368abe53d96.js +0 -2
- package/build/dist/2542.23fb13b1623c9f7c3fc1.js +0 -1
- package/build/dist/2626.05d1faa293e0a3318b9b.js +0 -1
- package/build/dist/2674.7fd28dae86ccdb247851.js +0 -1
- package/build/dist/2851.2195b5906b2c224c7bf7.js +0 -1
- package/build/dist/3140.794a212da633caf38b3a.js +0 -2
- package/build/dist/3233.fb6bffd5e097e4ac9423.js +0 -1
- package/build/dist/3299.f37767d30b6999df4014.js +0 -1
- package/build/dist/4004.5d68418ad5c2321cb11f.js +0 -1
- package/build/dist/4986.78047106f3a0d2d71199.js +0 -1
- package/build/dist/5272.0b70ee8ec5f083fb9f5b.js +0 -1
- package/build/dist/5614.fb6bffd5e097e4ac9423.js +0 -1
- package/build/dist/6492.3ee4060598de873d8e8f.js +0 -1
- package/build/dist/7756.2f851693ba030c42dde8.js +0 -1
- package/build/dist/7873.11d04b741d2b499d9cb9.js +0 -1
- package/build/dist/7923.861345fd55941e8089a1.js +0 -2
- package/build/dist/8014.28b5cf8c3787dc829aa4.js +0 -1
- package/build/dist/8302.5ae5bfe8baa0084204bb.js +0 -1
- package/build/dist/8319.c15a3674ec7abc493595.js +0 -1
- package/build/dist/8772.e8f9731c1c061f1cdf56.js +0 -2
- package/build/dist/8781.58f0c51870d3dd2689d7.js +0 -1
- package/build/dist/9299.6c06dad1abe098b61766.js +0 -1
- package/build/dist/main.3a12152528aff6ae213a.js +0 -2
- /package/build/dist/{4946.c95d4f426146e0180172.js.LICENSE.txt → 4946.d578f6ba367a742d80bf.js.LICENSE.txt} +0 -0
- /package/build/dist/{7923.861345fd55941e8089a1.js.LICENSE.txt → 7923.d44556578af4d3d7cea3.js.LICENSE.txt} +0 -0
- /package/build/dist/{3140.794a212da633caf38b3a.js.LICENSE.txt → 8090.8977224618a14ae42159.js.LICENSE.txt} +0 -0
package/shell/build.js
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
process.env.NODE_ENV = 'production';
|
|
2
|
-
|
|
3
|
-
const {Listr} = require("listr2");
|
|
4
|
-
const webpack = require('webpack');
|
|
5
|
-
const config = require('./config/webpack.web.config.js');
|
|
6
|
-
const args = process.argv.slice(2)??[]; // slice to remove the first two default values
|
|
7
|
-
let serverConfig ;
|
|
8
|
-
const is_exe = args[0]==="exe"
|
|
9
|
-
const is_npm = args[0]==="npm"
|
|
10
|
-
if (args.length ===0 || is_npm) {
|
|
11
|
-
serverConfig = require('./config/webpack.npm.config.js');
|
|
12
|
-
console.log('npm打包')
|
|
13
|
-
} else if (is_exe) {
|
|
14
|
-
console.log('二进制打包')
|
|
15
|
-
serverConfig = require('./config/webpack.exe.config.js');
|
|
16
|
-
} else {
|
|
17
|
-
console.error('无法识别打包环境')
|
|
18
|
-
}
|
|
19
|
-
const {copyFileSync} = require("fs");
|
|
20
|
-
const fs = require("fs");
|
|
21
|
-
const path = require("path");
|
|
22
|
-
const {rimraf} = require("rimraf");
|
|
23
|
-
const fse = require("fs-extra");
|
|
24
|
-
const {copy_wintun_dll} = require("./config/common-bin.config");
|
|
25
|
-
const {execSync} = require("child_process");
|
|
26
|
-
|
|
27
|
-
// const test_p = path.join(process.cwd(), "node_modules","node-process-watcher");
|
|
28
|
-
// const test_p2 = path.join(process.cwd(), "node_modules","better-sqlite3");
|
|
29
|
-
// console.log(`存在node-process-watcher ${fs.existsSync(test_p)}`);
|
|
30
|
-
// console.log(`存在better-sqlite3 ${fs.existsSync(test_p2)}`);
|
|
31
|
-
|
|
32
|
-
function ensure_copyFileSync(sourcePath, destPath) {
|
|
33
|
-
fse.ensureDirSync(path.dirname(destPath))
|
|
34
|
-
copyFileSync(sourcePath, destPath);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function exec_sync(cmd) {
|
|
38
|
-
try {
|
|
39
|
-
execSync(cmd)
|
|
40
|
-
} catch (error) {
|
|
41
|
-
// 将标准输出的 Buffer 转换为可读字符串并抛出
|
|
42
|
-
throw new Error(error.stdout ? error.stdout.toString() : error.message);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const tasksLister = new Listr(
|
|
47
|
-
[
|
|
48
|
-
{
|
|
49
|
-
title:"清理build目录执行tsc",
|
|
50
|
-
task:async ()=>{
|
|
51
|
-
fse.removeSync(path.join(__dirname, "..", "build"));
|
|
52
|
-
exec_sync("npx tsc")
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
title:"编译plugin到build/plugin目录",
|
|
57
|
-
task:async ()=>{
|
|
58
|
-
exec_sync("npx tsc -p tsconfig.plugin.json")
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title:"子线程构建",
|
|
63
|
-
task:async ()=>{
|
|
64
|
-
return Promise.all([new Promise((res, rej) => {
|
|
65
|
-
const config = {...serverConfig};
|
|
66
|
-
config['entry'] = path.join(__dirname, "..", "build", "server", "main","threads","filecat","threads.work.filecat.js")
|
|
67
|
-
config['output'] = {...config['output']}
|
|
68
|
-
config['output']['filename'] = 'threads.work.filecat.js'
|
|
69
|
-
// 第一个
|
|
70
|
-
webpack(config, (err, stats) => {
|
|
71
|
-
if (err || stats.hasErrors()) {
|
|
72
|
-
console.error(err || stats.toString());
|
|
73
|
-
rej(false);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
res(true);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
})])
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
title: "构建服务端",
|
|
84
|
-
task: async () => {
|
|
85
|
-
return new Promise((res, rej) => {
|
|
86
|
-
webpack(serverConfig, (err, stats) => {
|
|
87
|
-
if (err || stats.hasErrors()) {
|
|
88
|
-
console.error(err || stats.toString());
|
|
89
|
-
rej(false);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "win-process.node"), path.join(__dirname, "..", "build", "win-process.node"))
|
|
93
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "linux-process.node"), path.join(__dirname, "..", "build", "linux-process.node"))
|
|
94
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","linux","linuxtun.node"), path.join(__dirname, "..", "build", "linuxtun.node"))
|
|
95
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","win","wintun.node"), path.join(__dirname, "..", "build", "wintun.node"))
|
|
96
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-amd64.dll"), path.join(__dirname, "..", "build", "wintun-amd64.dll"))
|
|
97
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm.dll"), path.join(__dirname, "..", "build", "wintun-arm.dll"))
|
|
98
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm64.dll"), path.join(__dirname, "..", "build", "wintun-arm64.dll"))
|
|
99
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-x86.dll"), path.join(__dirname, "..", "build", "wintun-x86.dll"))
|
|
100
|
-
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg"), path.join(__dirname, "..", "build", "ffmpeg"))
|
|
101
|
-
// copyFileSync(path.resolve("build/server/main/domain/file/file.worker.js"), path.join(__dirname, "..", "build", "file.worker.js"))
|
|
102
|
-
|
|
103
|
-
// 复制 子进程监控脚本
|
|
104
|
-
// ensure_copyFileSync(path.resolve("src/main/watch.js"), path.join(__dirname, "..", "build", "watch.js"))
|
|
105
|
-
if(is_exe) {
|
|
106
|
-
copy_wintun_dll()
|
|
107
|
-
fs.copyFileSync(path.resolve('package.json'), path.resolve('build','package.json'));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
ensure_copyFileSync(path.resolve("node_modules/node-unrar-js/esm/js/unrar.wasm"), path.join(__dirname, "..", "build", "unrar.wasm"))
|
|
111
|
-
ensure_copyFileSync(path.resolve("node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm_bg.wasm"), path.join(__dirname, "..", "build", "jieba_rs_wasm_bg.wasm"))
|
|
112
|
-
|
|
113
|
-
rimraf.sync(path.join(__dirname,"..","build","server"));
|
|
114
|
-
rimraf.sync(path.join(__dirname,"..","build","build")); //better-sqlite3 莫名其妙的
|
|
115
|
-
|
|
116
|
-
res(true);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
title: "构建web",
|
|
125
|
-
task: async () => {
|
|
126
|
-
return new Promise((res, rej) => {
|
|
127
|
-
webpack(config, (err, stats) => {
|
|
128
|
-
if (err || stats.hasErrors()) {
|
|
129
|
-
console.error(err || stats.toString());
|
|
130
|
-
rej(false);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
// fse.copySync(path.join(__dirname, "..", "src", "web", "meta", 'resources',"assets","excalidraw-assets"),path.join(__dirname, "..", "build", "dist","excalidraw-assets"));
|
|
134
|
-
// fse.copySync(
|
|
135
|
-
// path.resolve('node_modules', '@excalidraw', 'excalidraw', 'dist', 'prod', 'fonts'),
|
|
136
|
-
// path.join(__dirname, "..", "build", "dist", "fonts")
|
|
137
|
-
// );
|
|
138
|
-
copyFileSync(path.join(__dirname, "..", "src", "web", "project", 'component',"file","component","image","js","filerobot-image-editor.min.js"), path.join(__dirname, "..", "build", "dist","filerobot-image-editor.min.js"));
|
|
139
|
-
copyFileSync(path.join(__dirname, "..", "src", "web", "project", "component","proxy","rdp","client","js","rle.js"), path.join(__dirname, "..", "build", "dist","rle.js"));
|
|
140
|
-
copyFileSync(path.join(__dirname, "..", "src", "web", "meta","resources","img","favicon-16x16.png"), path.join(__dirname, "..", "build", "dist","favicon-16x16.png"));
|
|
141
|
-
copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","img","favicon-32x32.png"), path.join(__dirname, "..", "build", "dist","favicon-32x32.png"));
|
|
142
|
-
const base_theme = path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes")
|
|
143
|
-
const files = fs.readdirSync(base_theme)
|
|
144
|
-
for (const file of files) {
|
|
145
|
-
copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes",file), path.join(__dirname, "..", "build", "dist",file));
|
|
146
|
-
}
|
|
147
|
-
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes","dark.css"), path.join(__dirname, "..", "build", "dist","dark.css"));
|
|
148
|
-
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes","modern.css"), path.join(__dirname, "..", "build", "dist","modern.css"));
|
|
149
|
-
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "component","resources","img","svg.png"), path.join(__dirname, "..", "build", "dist","svg.png"))
|
|
150
|
-
res(true);
|
|
151
|
-
});
|
|
152
|
-
})
|
|
153
|
-
},
|
|
154
|
-
// options: {persistentOutput: true},
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
{
|
|
158
|
-
exitOnError: true,
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
tasksLister.run();
|
|
1
|
+
process.env.NODE_ENV = 'production';
|
|
2
|
+
|
|
3
|
+
const {Listr} = require("listr2");
|
|
4
|
+
const webpack = require('webpack');
|
|
5
|
+
const config = require('./config/webpack.web.config.js');
|
|
6
|
+
const args = process.argv.slice(2)??[]; // slice to remove the first two default values
|
|
7
|
+
let serverConfig ;
|
|
8
|
+
const is_exe = args[0]==="exe"
|
|
9
|
+
const is_npm = args[0]==="npm"
|
|
10
|
+
if (args.length ===0 || is_npm) {
|
|
11
|
+
serverConfig = require('./config/webpack.npm.config.js');
|
|
12
|
+
console.log('npm打包')
|
|
13
|
+
} else if (is_exe) {
|
|
14
|
+
console.log('二进制打包')
|
|
15
|
+
serverConfig = require('./config/webpack.exe.config.js');
|
|
16
|
+
} else {
|
|
17
|
+
console.error('无法识别打包环境')
|
|
18
|
+
}
|
|
19
|
+
const {copyFileSync} = require("fs");
|
|
20
|
+
const fs = require("fs");
|
|
21
|
+
const path = require("path");
|
|
22
|
+
const {rimraf} = require("rimraf");
|
|
23
|
+
const fse = require("fs-extra");
|
|
24
|
+
const {copy_wintun_dll} = require("./config/common-bin.config");
|
|
25
|
+
const {execSync} = require("child_process");
|
|
26
|
+
|
|
27
|
+
// const test_p = path.join(process.cwd(), "node_modules","node-process-watcher");
|
|
28
|
+
// const test_p2 = path.join(process.cwd(), "node_modules","better-sqlite3");
|
|
29
|
+
// console.log(`存在node-process-watcher ${fs.existsSync(test_p)}`);
|
|
30
|
+
// console.log(`存在better-sqlite3 ${fs.existsSync(test_p2)}`);
|
|
31
|
+
|
|
32
|
+
function ensure_copyFileSync(sourcePath, destPath) {
|
|
33
|
+
fse.ensureDirSync(path.dirname(destPath))
|
|
34
|
+
copyFileSync(sourcePath, destPath);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function exec_sync(cmd) {
|
|
38
|
+
try {
|
|
39
|
+
execSync(cmd)
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// 将标准输出的 Buffer 转换为可读字符串并抛出
|
|
42
|
+
throw new Error(error.stdout ? error.stdout.toString() : error.message);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const tasksLister = new Listr(
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
title:"清理build目录执行tsc",
|
|
50
|
+
task:async ()=>{
|
|
51
|
+
fse.removeSync(path.join(__dirname, "..", "build"));
|
|
52
|
+
exec_sync("npx tsc")
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title:"编译plugin到build/plugin目录",
|
|
57
|
+
task:async ()=>{
|
|
58
|
+
exec_sync("npx tsc -p tsconfig.plugin.json")
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title:"子线程构建",
|
|
63
|
+
task:async ()=>{
|
|
64
|
+
return Promise.all([new Promise((res, rej) => {
|
|
65
|
+
const config = {...serverConfig};
|
|
66
|
+
config['entry'] = path.join(__dirname, "..", "build", "server", "main","threads","filecat","threads.work.filecat.js")
|
|
67
|
+
config['output'] = {...config['output']}
|
|
68
|
+
config['output']['filename'] = 'threads.work.filecat.js'
|
|
69
|
+
// 第一个
|
|
70
|
+
webpack(config, (err, stats) => {
|
|
71
|
+
if (err || stats.hasErrors()) {
|
|
72
|
+
console.error(err || stats.toString());
|
|
73
|
+
rej(false);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
res(true);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
})])
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: "构建服务端",
|
|
84
|
+
task: async () => {
|
|
85
|
+
return new Promise((res, rej) => {
|
|
86
|
+
webpack(serverConfig, (err, stats) => {
|
|
87
|
+
if (err || stats.hasErrors()) {
|
|
88
|
+
console.error(err || stats.toString());
|
|
89
|
+
rej(false);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "win-process.node"), path.join(__dirname, "..", "build", "win-process.node"))
|
|
93
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "linux-process.node"), path.join(__dirname, "..", "build", "linux-process.node"))
|
|
94
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","linux","linuxtun.node"), path.join(__dirname, "..", "build", "linuxtun.node"))
|
|
95
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "tun","ts","win","wintun.node"), path.join(__dirname, "..", "build", "wintun.node"))
|
|
96
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-amd64.dll"), path.join(__dirname, "..", "build", "wintun-amd64.dll"))
|
|
97
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm.dll"), path.join(__dirname, "..", "build", "wintun-arm.dll"))
|
|
98
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-arm64.dll"), path.join(__dirname, "..", "build", "wintun-arm64.dll"))
|
|
99
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-x86.dll"), path.join(__dirname, "..", "build", "wintun-x86.dll"))
|
|
100
|
+
// copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg"), path.join(__dirname, "..", "build", "ffmpeg"))
|
|
101
|
+
// copyFileSync(path.resolve("build/server/main/domain/file/file.worker.js"), path.join(__dirname, "..", "build", "file.worker.js"))
|
|
102
|
+
|
|
103
|
+
// 复制 子进程监控脚本
|
|
104
|
+
// ensure_copyFileSync(path.resolve("src/main/watch.js"), path.join(__dirname, "..", "build", "watch.js"))
|
|
105
|
+
if(is_exe) {
|
|
106
|
+
copy_wintun_dll()
|
|
107
|
+
fs.copyFileSync(path.resolve('package.json'), path.resolve('build','package.json'));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ensure_copyFileSync(path.resolve("node_modules/node-unrar-js/esm/js/unrar.wasm"), path.join(__dirname, "..", "build", "unrar.wasm"))
|
|
111
|
+
ensure_copyFileSync(path.resolve("node_modules/jieba-wasm/pkg/nodejs/jieba_rs_wasm_bg.wasm"), path.join(__dirname, "..", "build", "jieba_rs_wasm_bg.wasm"))
|
|
112
|
+
|
|
113
|
+
rimraf.sync(path.join(__dirname,"..","build","server"));
|
|
114
|
+
rimraf.sync(path.join(__dirname,"..","build","build")); //better-sqlite3 莫名其妙的
|
|
115
|
+
|
|
116
|
+
res(true);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: "构建web",
|
|
125
|
+
task: async () => {
|
|
126
|
+
return new Promise((res, rej) => {
|
|
127
|
+
webpack(config, (err, stats) => {
|
|
128
|
+
if (err || stats.hasErrors()) {
|
|
129
|
+
console.error(err || stats.toString());
|
|
130
|
+
rej(false);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// fse.copySync(path.join(__dirname, "..", "src", "web", "meta", 'resources',"assets","excalidraw-assets"),path.join(__dirname, "..", "build", "dist","excalidraw-assets"));
|
|
134
|
+
// fse.copySync(
|
|
135
|
+
// path.resolve('node_modules', '@excalidraw', 'excalidraw', 'dist', 'prod', 'fonts'),
|
|
136
|
+
// path.join(__dirname, "..", "build", "dist", "fonts")
|
|
137
|
+
// );
|
|
138
|
+
copyFileSync(path.join(__dirname, "..", "src", "web", "project", 'component',"file","component","image","js","filerobot-image-editor.min.js"), path.join(__dirname, "..", "build", "dist","filerobot-image-editor.min.js"));
|
|
139
|
+
copyFileSync(path.join(__dirname, "..", "src", "web", "project", "component","proxy","rdp","client","js","rle.js"), path.join(__dirname, "..", "build", "dist","rle.js"));
|
|
140
|
+
copyFileSync(path.join(__dirname, "..", "src", "web", "meta","resources","img","favicon-16x16.png"), path.join(__dirname, "..", "build", "dist","favicon-16x16.png"));
|
|
141
|
+
copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","img","favicon-32x32.png"), path.join(__dirname, "..", "build", "dist","favicon-32x32.png"));
|
|
142
|
+
const base_theme = path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes")
|
|
143
|
+
const files = fs.readdirSync(base_theme)
|
|
144
|
+
for (const file of files) {
|
|
145
|
+
copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes",file), path.join(__dirname, "..", "build", "dist",file));
|
|
146
|
+
}
|
|
147
|
+
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes","dark.css"), path.join(__dirname, "..", "build", "dist","dark.css"));
|
|
148
|
+
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "resources","css","themes","modern.css"), path.join(__dirname, "..", "build", "dist","modern.css"));
|
|
149
|
+
// copyFileSync(path.join(__dirname, "..", "src", "web", "meta", "component","resources","img","svg.png"), path.join(__dirname, "..", "build", "dist","svg.png"))
|
|
150
|
+
res(true);
|
|
151
|
+
});
|
|
152
|
+
})
|
|
153
|
+
},
|
|
154
|
+
// options: {persistentOutput: true},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
{
|
|
158
|
+
exitOnError: true,
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
tasksLister.run();
|
package/shell/config/.babelrc
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": [
|
|
3
|
-
"@babel/preset-env",
|
|
4
|
-
"@babel/preset-typescript",
|
|
5
|
-
[
|
|
6
|
-
"@babel/preset-react",
|
|
7
|
-
{
|
|
8
|
-
"runtime": "automatic"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
],
|
|
12
|
-
"plugins": [
|
|
13
|
-
["@babel/plugin-proposal-decorators", { "version": "legacy" }]
|
|
14
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"presets": [
|
|
3
|
+
"@babel/preset-env",
|
|
4
|
+
"@babel/preset-typescript",
|
|
5
|
+
[
|
|
6
|
+
"@babel/preset-react",
|
|
7
|
+
{
|
|
8
|
+
"runtime": "automatic"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
],
|
|
12
|
+
"plugins": [
|
|
13
|
+
["@babel/plugin-proposal-decorators", { "version": "legacy" }]
|
|
14
|
+
]
|
|
15
15
|
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const nodeExternals = require('webpack-node-externals');
|
|
3
|
-
const webpack = require('webpack');
|
|
4
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
-
const package_data = require("../../package.json")
|
|
6
|
-
const {base_url} = require("./env");
|
|
7
|
-
|
|
8
|
-
const common_plugins = {
|
|
9
|
-
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
|
|
10
|
-
'process.env.version': JSON.stringify(package_data.version),
|
|
11
|
-
'process.env.base_url': JSON.stringify(base_url),
|
|
12
|
-
'process.env.run_env': JSON.stringify("npm") // 必须用 JSON.stringify
|
|
13
|
-
}
|
|
14
|
-
// 给js代码注入一些环境变量
|
|
15
|
-
const plugins = [
|
|
16
|
-
new webpack.DefinePlugin(common_plugins),
|
|
17
|
-
// new webpack.DefinePlugin({
|
|
18
|
-
// 'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
19
|
-
// }),
|
|
20
|
-
// 不要一些Debug的二进制文件
|
|
21
|
-
new webpack.IgnorePlugin({
|
|
22
|
-
resourceRegExp: /Debug/,
|
|
23
|
-
})
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
function get_exe_plugins() {
|
|
27
|
-
common_plugins['process.env.run_env'] = JSON.stringify("exe")
|
|
28
|
-
return [
|
|
29
|
-
new webpack.DefinePlugin(common_plugins),
|
|
30
|
-
new webpack.IgnorePlugin({
|
|
31
|
-
resourceRegExp: /Debug/,
|
|
32
|
-
}),
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// 处理 node 二进制文件的webpack rules
|
|
37
|
-
const _node_rules = [
|
|
38
|
-
{
|
|
39
|
-
test: /\.node$/,
|
|
40
|
-
loader: 'node-loader',
|
|
41
|
-
options: {
|
|
42
|
-
name: '[path][name].[ext]'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
// 这些不需要打包,会被安装,运行的时候再使用
|
|
48
|
-
// 动态的 加载需要使用 node_require=eval("require") 原本的动态函数内的require会被替换成webpack的 __webpack_require__
|
|
49
|
-
// webpack会修改函数的位置,这也会导致一些看起来本来没有问题的 变量不存在问题
|
|
50
|
-
const npm_externals = [
|
|
51
|
-
{
|
|
52
|
-
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
53
|
-
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
54
|
-
'cors': 'commonjs cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
55
|
-
'@koa/cors': 'commonjs @koa/cors',
|
|
56
|
-
'@xiaobaidadada/node-pty-prebuilt': 'commonjs @xiaobaidadada/node-pty-prebuilt',
|
|
57
|
-
'@xiaobaidadada/node-tuntap2-wintun': 'commonjs @xiaobaidadada/node-tuntap2-wintun',
|
|
58
|
-
'node-process-watcher': 'commonjs node-process-watcher',
|
|
59
|
-
'@xiaobaidadada/ssh2-prebuilt': 'commonjs @xiaobaidadada/ssh2-prebuilt',
|
|
60
|
-
'node-libsmb2': 'commonjs node-libsmb2',
|
|
61
|
-
'better-sqlite3/build/Release/better_sqlite3.node': 'commonjs better-sqlite3/build/Release/better_sqlite3.node',
|
|
62
|
-
'better-sqlite3': 'commonjs better-sqlite3',
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
const pkg_externals = [
|
|
66
|
-
{
|
|
67
|
-
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
68
|
-
'cors': 'commonjs cors',
|
|
69
|
-
'@koa/cors': 'commonjs @koa/cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
70
|
-
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
module.exports.plugins = plugins;
|
|
75
|
-
module.exports.common_plugins = common_plugins
|
|
76
|
-
module.exports.get_exe_plugins = get_exe_plugins;
|
|
77
|
-
module.exports._node_rules = _node_rules;
|
|
78
|
-
module.exports.npm_externals = npm_externals;
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const nodeExternals = require('webpack-node-externals');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
5
|
+
const package_data = require("../../package.json")
|
|
6
|
+
const {base_url} = require("./env");
|
|
7
|
+
|
|
8
|
+
const common_plugins = {
|
|
9
|
+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
|
|
10
|
+
'process.env.version': JSON.stringify(package_data.version),
|
|
11
|
+
'process.env.base_url': JSON.stringify(base_url),
|
|
12
|
+
'process.env.run_env': JSON.stringify("npm") // 必须用 JSON.stringify
|
|
13
|
+
}
|
|
14
|
+
// 给js代码注入一些环境变量
|
|
15
|
+
const plugins = [
|
|
16
|
+
new webpack.DefinePlugin(common_plugins),
|
|
17
|
+
// new webpack.DefinePlugin({
|
|
18
|
+
// 'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
|
|
19
|
+
// }),
|
|
20
|
+
// 不要一些Debug的二进制文件
|
|
21
|
+
new webpack.IgnorePlugin({
|
|
22
|
+
resourceRegExp: /Debug/,
|
|
23
|
+
})
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
function get_exe_plugins() {
|
|
27
|
+
common_plugins['process.env.run_env'] = JSON.stringify("exe")
|
|
28
|
+
return [
|
|
29
|
+
new webpack.DefinePlugin(common_plugins),
|
|
30
|
+
new webpack.IgnorePlugin({
|
|
31
|
+
resourceRegExp: /Debug/,
|
|
32
|
+
}),
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 处理 node 二进制文件的webpack rules
|
|
37
|
+
const _node_rules = [
|
|
38
|
+
{
|
|
39
|
+
test: /\.node$/,
|
|
40
|
+
loader: 'node-loader',
|
|
41
|
+
options: {
|
|
42
|
+
name: '[path][name].[ext]'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
// 这些不需要打包,会被安装,运行的时候再使用
|
|
48
|
+
// 动态的 加载需要使用 node_require=eval("require") 原本的动态函数内的require会被替换成webpack的 __webpack_require__
|
|
49
|
+
// webpack会修改函数的位置,这也会导致一些看起来本来没有问题的 变量不存在问题
|
|
50
|
+
const npm_externals = [
|
|
51
|
+
{
|
|
52
|
+
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
53
|
+
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
54
|
+
'cors': 'commonjs cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
55
|
+
'@koa/cors': 'commonjs @koa/cors',
|
|
56
|
+
'@xiaobaidadada/node-pty-prebuilt': 'commonjs @xiaobaidadada/node-pty-prebuilt',
|
|
57
|
+
'@xiaobaidadada/node-tuntap2-wintun': 'commonjs @xiaobaidadada/node-tuntap2-wintun',
|
|
58
|
+
'node-process-watcher': 'commonjs node-process-watcher',
|
|
59
|
+
'@xiaobaidadada/ssh2-prebuilt': 'commonjs @xiaobaidadada/ssh2-prebuilt',
|
|
60
|
+
'node-libsmb2': 'commonjs node-libsmb2',
|
|
61
|
+
'better-sqlite3/build/Release/better_sqlite3.node': 'commonjs better-sqlite3/build/Release/better_sqlite3.node',
|
|
62
|
+
'better-sqlite3': 'commonjs better-sqlite3',
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
const pkg_externals = [
|
|
66
|
+
{
|
|
67
|
+
'@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
|
|
68
|
+
'cors': 'commonjs cors',
|
|
69
|
+
'@koa/cors': 'commonjs @koa/cors', // 动态加载无法打包 如果需要可以使用 import "cors"
|
|
70
|
+
// 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
module.exports.plugins = plugins;
|
|
75
|
+
module.exports.common_plugins = common_plugins
|
|
76
|
+
module.exports.get_exe_plugins = get_exe_plugins;
|
|
77
|
+
module.exports._node_rules = _node_rules;
|
|
78
|
+
module.exports.npm_externals = npm_externals;
|
|
79
79
|
module.exports.pkg_externals = pkg_externals;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
const os = require('os')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
|
|
5
|
-
function get_wintun_dll_arch() {
|
|
6
|
-
let cpuArch = os.arch();
|
|
7
|
-
switch (cpuArch) {
|
|
8
|
-
case 'arm':
|
|
9
|
-
case 'arm64':
|
|
10
|
-
break;
|
|
11
|
-
case 'ia32':
|
|
12
|
-
cpuArch = "x86";
|
|
13
|
-
break;
|
|
14
|
-
case 'x64':
|
|
15
|
-
cpuArch = "amd64";
|
|
16
|
-
break;
|
|
17
|
-
default:
|
|
18
|
-
// console.log('未知架构:', arch);
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
return cpuArch;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function copy_wintun_dll() {
|
|
25
|
-
try {
|
|
26
|
-
if (os.platform() !== 'win32') return;
|
|
27
|
-
const cpuArch = get_wintun_dll_arch();
|
|
28
|
-
const winfilename = `wintun${cpuArch ? `-${cpuArch}` : ''}.dll`;
|
|
29
|
-
// 获取模块的根目录
|
|
30
|
-
const modPath = path.dirname(path.resolve("node_modules/@xiaobaidadada/node-tuntap2-wintun/package.json"));
|
|
31
|
-
// 拼接你需要的路径
|
|
32
|
-
const sourcePath = path.join(modPath, "wintun_dll", winfilename);
|
|
33
|
-
const destPath = path.resolve('build',winfilename);
|
|
34
|
-
// console.log("目录",sourcePath,destPath)
|
|
35
|
-
// if (!fs.existsSync(destPath)) {
|
|
36
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
37
|
-
// }
|
|
38
|
-
} catch (e) {
|
|
39
|
-
console.log(e);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// 与项目通用文件
|
|
44
|
-
module.exports.get_wintun_dll_arch = get_wintun_dll_arch;
|
|
1
|
+
const os = require('os')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
|
|
5
|
+
function get_wintun_dll_arch() {
|
|
6
|
+
let cpuArch = os.arch();
|
|
7
|
+
switch (cpuArch) {
|
|
8
|
+
case 'arm':
|
|
9
|
+
case 'arm64':
|
|
10
|
+
break;
|
|
11
|
+
case 'ia32':
|
|
12
|
+
cpuArch = "x86";
|
|
13
|
+
break;
|
|
14
|
+
case 'x64':
|
|
15
|
+
cpuArch = "amd64";
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
// console.log('未知架构:', arch);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
return cpuArch;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function copy_wintun_dll() {
|
|
25
|
+
try {
|
|
26
|
+
if (os.platform() !== 'win32') return;
|
|
27
|
+
const cpuArch = get_wintun_dll_arch();
|
|
28
|
+
const winfilename = `wintun${cpuArch ? `-${cpuArch}` : ''}.dll`;
|
|
29
|
+
// 获取模块的根目录
|
|
30
|
+
const modPath = path.dirname(path.resolve("node_modules/@xiaobaidadada/node-tuntap2-wintun/package.json"));
|
|
31
|
+
// 拼接你需要的路径
|
|
32
|
+
const sourcePath = path.join(modPath, "wintun_dll", winfilename);
|
|
33
|
+
const destPath = path.resolve('build',winfilename);
|
|
34
|
+
// console.log("目录",sourcePath,destPath)
|
|
35
|
+
// if (!fs.existsSync(destPath)) {
|
|
36
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
37
|
+
// }
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.log(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 与项目通用文件
|
|
44
|
+
module.exports.get_wintun_dll_arch = get_wintun_dll_arch;
|
|
45
45
|
module.exports.copy_wintun_dll = copy_wintun_dll;
|
package/shell/config/env.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
// module.exports.base_url = "/pre" // 这将会影响到自定义路由 修改以后之前设置的自定义路由将不可用 请谨慎修改 dev 环境前后端都需要重启
|
|
3
|
-
module.exports.base_url = ""
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 构建说明:
|
|
7
|
-
* 1. npm方式不能把二进制依赖推送到npm 用户安装的时候 环境可能是win或者linux 需要自己安装依赖
|
|
8
|
-
* 2. docker与二进制安装,需要把二进制打包进去
|
|
9
|
-
* 3. 前后端同步的数据 本地dev的时候需要靠这个文件,正式包可以依赖参数
|
|
10
|
-
*
|
|
1
|
+
|
|
2
|
+
// module.exports.base_url = "/pre" // 这将会影响到自定义路由 修改以后之前设置的自定义路由将不可用 请谨慎修改 dev 环境前后端都需要重启
|
|
3
|
+
module.exports.base_url = ""
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 构建说明:
|
|
7
|
+
* 1. npm方式不能把二进制依赖推送到npm 用户安装的时候 环境可能是win或者linux 需要自己安装依赖
|
|
8
|
+
* 2. docker与二进制安装,需要把二进制打包进去
|
|
9
|
+
* 3. 前后端同步的数据 本地dev的时候需要靠这个文件,正式包可以依赖参数
|
|
10
|
+
*
|
|
11
11
|
* */
|