From 3940bc1992d0dcdab57f252af4609b22937a2cd2 Mon Sep 17 00:00:00 2001 From: chenhaibo <495810242@qq.com> Date: Tue, 4 Feb 2025 11:42:50 +0800 Subject: [PATCH] fix bug --- .gitignore | 1 - .vscode/launch.json | 4 ++-- Makefile | 4 ++-- README.md | 4 ++-- build.bat | 24 ++++++++++++------------ build.sh | 24 ++++++++++++------------ html/NextGB/index.html | 2 +- main/main.go | 39 ++++++++++++++------------------------- 8 files changed, 45 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index b87d357..cd706c9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,5 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* -bin/ objs .idea diff --git a/.vscode/launch.json b/.vscode/launch.json index 69abab7..7880836 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,8 +9,8 @@ "type": "go", "request": "launch", "mode": "exec", - "program": "${workspaceFolder}/bin/srs-sip", - "cwd": "${workspaceFolder}/bin", + "program": "${workspaceFolder}/objs/srs-sip", + "cwd": "${workspaceFolder}/objs", "env": {}, "args": [] } diff --git a/Makefile b/Makefile index 5a95ff2..8f691c8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ GOCMD=go GOBUILD=$(GOCMD) build -BINARY_NAME=bin/srs-sip +BINARY_NAME=objs/srs-sip MAIN_PATH=main/main.go VUE_DIR=html/NextGB @@ -20,7 +20,7 @@ run: install: $(GOBUILD) -o $(BINARY_NAME) $(MAIN_PATH) - mv $(BINARY_NAME) /usr/local/bin + mv $(BINARY_NAME) /usr/local/bin vue-install: cd $(VUE_DIR) && npm install diff --git a/README.md b/README.md index dfe36d5..ca8251b 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,12 @@ If on Windows Run the program: ``` -./bin/srs-sip +./objs/srs-sip ``` Use docker ``` -docker run -id -p 1985:1985 -p 2025:2025 -p 5060:5060 -p 8025:8025 -p 9000:9000 -p 5060:5060/udp -p 8000:8000/udp --name srs-sip --env CANDIDATE=your_ip xiaoniu008/srs-sip:alpha +docker run -id -p 1985:1985 -p 5060:5060 -p 8025:8025 -p 9000:9000 -p 5060:5060/udp -p 8000:8000/udp --name srs-sip --env CANDIDATE=your_ip ossrs/srs-sip:alpha ``` ## Sequence diff --git a/build.bat b/build.bat index d428693..4ee7a64 100644 --- a/build.bat +++ b/build.bat @@ -1,7 +1,7 @@ @echo off setlocal -set BINARY_NAME=bin\srs-sip.exe +set BINARY_NAME=objs\srs-sip.exe set MAIN_PATH=main\main.go set VUE_DIR=html\NextGB set CONFIG_FILE=conf\config.yaml @@ -17,14 +17,14 @@ if "%1"=="all" goto all :build echo Building Go binary... -if not exist "bin" mkdir bin +if not exist "objs" mkdir objs go build -o %BINARY_NAME% %MAIN_PATH% echo Copying config file... if exist "%CONFIG_FILE%" ( - mkdir "bin\%~dp0%CONFIG_FILE%" 2>nul - xcopy /s /i /y "%CONFIG_FILE%" "bin\%~dp0%CONFIG_FILE%\" - echo Config file copied to bin\%~dp0%CONFIG_FILE% + mkdir "objs\%~dp0%CONFIG_FILE%" 2>nul + xcopy /s /i /y "%CONFIG_FILE%" "objs\%~dp0%CONFIG_FILE%\" + echo Config file copied to objs\%~dp0%CONFIG_FILE% ) else ( echo Warning: %CONFIG_FILE% not found ) @@ -35,8 +35,8 @@ echo Cleaning... if exist %BINARY_NAME% del /F /Q %BINARY_NAME% if exist %VUE_DIR%\dist rd /S /Q %VUE_DIR%\dist if exist %VUE_DIR%\node_modules rd /S /Q %VUE_DIR%\node_modules -if exist bin\html rd /S /Q bin\html -if exist bin\%CONFIG_FILE% del /F /Q bin\%CONFIG_FILE% +if exist objs\html rd /S /Q objs\html +if exist objs\%CONFIG_FILE% del /F /Q objs\%CONFIG_FILE% goto :eof :run @@ -105,18 +105,18 @@ if errorlevel 1 ( popd echo Vue build completed successfully -echo Copying dist files to bin directory... -if exist bin\html rd /S /Q bin\html -if not exist bin mkdir bin +echo Copying dist files to objs directory... +if exist objs\html rd /S /Q objs\html +if not exist objs mkdir objs if not exist "%VUE_DIR%\dist" ( echo Error: Vue dist directory not found at %VUE_DIR%\dist goto :eof ) -robocopy "%VUE_DIR%\dist" "bin\html" /E /NFL /NDL /NJH /NJS /nc /ns /np +robocopy "%VUE_DIR%\dist" "objs\html" /E /NFL /NDL /NJH /NJS /nc /ns /np if errorlevel 8 ( echo Error copying files ) else ( - echo Vue dist files successfully copied to bin\html + echo Vue dist files successfully copied to objs\html ) goto :eof diff --git a/build.sh b/build.sh index 088b5f4..dc89abc 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -BINARY_NAME="bin/srs-sip" +BINARY_NAME="objs/srs-sip" MAIN_PATH="main/main.go" VUE_DIR="html/NextGB" CONFIG_FILE="conf/config.yaml" @@ -21,14 +21,14 @@ esac build() { echo "Building Go binary..." - mkdir -p bin + mkdir -p objs go build -o ${BINARY_NAME} ${MAIN_PATH} echo "Copying config file..." if [ -f "${CONFIG_FILE}" ]; then - mkdir -p "bin/$(dirname ${CONFIG_FILE})" - cp -a "${CONFIG_FILE}" "bin/$(dirname ${CONFIG_FILE})/" - echo "Config file copied to bin/$(dirname ${CONFIG_FILE})/" + mkdir -p "objs/$(dirname ${CONFIG_FILE})" + cp -a "${CONFIG_FILE}" "objs/$(dirname ${CONFIG_FILE})/" + echo "Config file copied to objs/$(dirname ${CONFIG_FILE})/" else echo "Warning: ${CONFIG_FILE} not found" fi @@ -39,8 +39,8 @@ clean() { rm -rf ${BINARY_NAME} rm -rf ${VUE_DIR}/dist rm -rf ${VUE_DIR}/node_modules - rm -rf bin/html - rm -rf bin/${CONFIG_FILE} + rm -rf objs/html + rm -rf objs/${CONFIG_FILE} } run() { @@ -107,16 +107,16 @@ vue_build() { popd > /dev/null echo "Vue build completed successfully" - echo "Copying dist files to bin directory..." - rm -rf bin/html - mkdir -p bin + echo "Copying dist files to objs directory..." + rm -rf objs/html + mkdir -p objs if [ ! -d "${VUE_DIR}/dist" ]; then echo "Error: Vue dist directory not found at ${VUE_DIR}/dist" return 1 fi - cp -r "${VUE_DIR}/dist" "bin/html" + cp -r "${VUE_DIR}/dist" "objs/html" if [ $? -eq 0 ]; then - echo "Vue dist files successfully copied to bin/html" + echo "Vue dist files successfully copied to objs/html" else echo "Error copying files" return 1 diff --git a/html/NextGB/index.html b/html/NextGB/index.html index 9e5fc8f..0d41463 100644 --- a/html/NextGB/index.html +++ b/html/NextGB/index.html @@ -4,7 +4,7 @@ -