Browse Source

config:移除不必要的配置文件并更新文档,调整摄像头流地址和TCP代理配置

master
qinjian 4 days ago
parent
commit
b018653dc2
  1. 97
      .vscode/launch.json
  2. 3
      .vscode/settings.json
  3. 9
      README.md
  4. 3
      client/src/sections/wuyuanbiaoba/components/CameraView.jsx
  5. 4
      server/tcpProxy/index.js

97
.vscode/launch.json

@ -1,97 +0,0 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "开发模式",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"runtimeArgs": [
"run",
"start",
"--",
"--inspect-brk"
],
"console": "integratedTerminal",
"env": {
/*
*/
"NODE_ENV": "development",
"PORT": "5000",
//
"FS_QINIU_DOMAIN": "https://resources-test.anxinyun.cn",
"FS_QINIU_ACTION": "https://up-z0.qiniup.com",
"FS_QINIU_ASSETS_DIR": "temp_v5",
//
"FS_SOCKET_URL": "ws://localhost:4000",
//
"API": "http://localhost:4000",
// TCP
"TCP_HOST": "10.8.30.179",
"TCP_PORT": "2230",
}
},
{
"type": "node",
"request": "launch",
"name": "本地构建",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"runtimeArgs": [
"run",
"build",
// "--",
// "--inspect-brk"
],
"console": "integratedTerminal",
"env": {}
},
{
"type": "node",
"request": "launch",
"name": "生产模式",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"runtimeArgs": [
"run",
"start",
"--",
"--inspect-brk"
],
"console": "integratedTerminal",
"env": {
/*
*/
"NODE_ENV": "production",
"PORT": "5100",
/* ... */
"FS_QINIU_DOMAIN": "https://resources-test.anxinyun.cn",
"FS_QINIU_ACTION": "https://up-z0.qiniup.com",
"FS_QINIU_ASSETS_DIR": "temp_v5",
//
"FS_SOCKET_URL": "ws://localhost:4000",
//
"API": "http://localhost:4000",
"TCP_HOST": "127.0.0.1",
"TCP_PORT": "2230",
}
},
]
}

3
.vscode/settings.json

@ -1,3 +0,0 @@
{
"editor.tabSize": 3
}

9
README.md

@ -1,13 +1,22 @@
# 无源标靶上位机 # 无源标靶上位机
## Docker ## Docker
### 构建镜像 ### 构建镜像
```bash ```bash
docker build -t passive-targeting-web . docker build -t passive-targeting-web .
``` ```
### 运行容器 ### 运行容器
```bash ```bash
docker run -d -p 8080:8080 -p 8081:8081 --name passive-targeting-web passive-targeting-web docker run -d -p 8080:8080 -p 8081:8081 --name passive-targeting-web passive-targeting-web
``` ```
## 开发注意事项
- 请确保在开发环境中,`server/tcpProxy/index.js` 文件中的 `TCP_HOST` 设置为下位机的实际 IP 地址
- 提交代码前,请将 `TCP_HOST` 设置回去
- 确保在生产环境中,`client\src\sections\wuyuanbiaoba\components\CameraView.jsx`,摄像头流的 streamUrl 指向正确的地址
- 提交代码前,请将 `streamUrl` 设置回去

3
client/src/sections/wuyuanbiaoba/components/CameraView.jsx

@ -50,7 +50,8 @@ const CameraView = ({
const maxRectangles = 5; const maxRectangles = 5;
// //
const streamUrl = import.meta.env.MODE === 'development'? 'http://10.8.30.179:2240/video_flow' :"http://127.0.0.1:2240/video_flow"; const streamUrl = `http://${window.location.hostname}:2240/video_flow`; //
// const streamUrl = `http://10.8.30.179:2240/video_flow`; //
// //
const applyTransform = () => { const applyTransform = () => {

4
server/tcpProxy/index.js

@ -1,7 +1,8 @@
const net = require('net'); const net = require('net');
const WebSocket = require('ws'); const WebSocket = require('ws');
// TCP代理配置 // TCP代理配置
const TCP_HOST = process.env.NODE_ENV === 'development'? '10.8.30.179' : '127.0.0.1'; const TCP_HOST = '127.0.0.1'; // 因为下位机和上位机在同一台机器上,所以使用localhost
// const TCP_HOST = '10.8.30.179'; //开发环境配置,开发时请解开这行注释,并且与下位机开发人员确认IP地址,提交代码别忘记注释掉
const TCP_PORT = 2230; const TCP_PORT = 2230;
// 创建独立的WebSocket服务器用于TCP代理 // 创建独立的WebSocket服务器用于TCP代理
@ -27,6 +28,7 @@ function setupTcpProxy(conf) {
// TCP连接成功 // TCP连接成功
tcpClient.connect(process.env.TCP_PORT || TCP_PORT, process.env.TCP_HOST || TCP_HOST, () => { tcpClient.connect(process.env.TCP_PORT || TCP_PORT, process.env.TCP_HOST || TCP_HOST, () => {
console.log(process.env);
console.log(`TCP连接已建立到 ${TCP_HOST}:${TCP_PORT}`); console.log(`TCP连接已建立到 ${TCP_HOST}:${TCP_PORT}`);
}); });

Loading…
Cancel
Save