Spaces:
Running
Running
Update src/components/loader/tw-progress-monitor.js
Browse files
src/components/loader/tw-progress-monitor.js
CHANGED
@@ -1,18 +1,25 @@
|
|
1 |
-
|
2 |
-
const corsAnywhere = require('cors-anywhere');
|
3 |
-
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
4 |
|
5 |
-
// CORS
|
6 |
-
const
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
});
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
// グローバルな進行状況管理変数
|
17 |
let total = 0;
|
18 |
let complete = 0;
|
|
|
1 |
+
const { exec } = require("child_process");
|
|
|
|
|
2 |
|
3 |
+
// CORS Anywhere サーバーを起動
|
4 |
+
const corsProxy = exec("npx cors-anywhere --port 8080", (error, stdout, stderr) => {
|
5 |
+
if (error) {
|
6 |
+
console.error(`CORS Proxy 起動エラー: ${error.message}`);
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
if (stderr) {
|
10 |
+
console.error(`CORS Proxy 警告: ${stderr}`);
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
console.log(`CORS Proxy 実行中: ${stdout}`);
|
14 |
});
|
15 |
|
16 |
+
// CORS Proxy のプロセスを監視
|
17 |
+
corsProxy.stdout.on("data", data => console.log(`CORS Proxy: ${data}`));
|
18 |
+
corsProxy.stderr.on("data", data => console.error(`CORS Proxy Error: ${data}`));
|
19 |
+
|
20 |
+
console.log("Node.js サーバーが起動しました!");
|
21 |
+
|
22 |
+
|
23 |
// グローバルな進行状況管理変数
|
24 |
let total = 0;
|
25 |
let complete = 0;
|