mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-21 16:37:47 +08:00
docs: clarify server binding address and LAN accessibility in documentation and startup logs
This commit is contained in:
@@ -178,7 +178,9 @@ cp config.example.json config.json
|
|||||||
go run ./cmd/ds2api
|
go run ./cmd/ds2api
|
||||||
```
|
```
|
||||||
|
|
||||||
默认监听地址:`http://localhost:5001`
|
默认本地访问地址:`http://127.0.0.1:5001`
|
||||||
|
|
||||||
|
服务实际绑定:`0.0.0.0:5001`,因此同一局域网设备通常也可以通过你的内网 IP 访问。
|
||||||
|
|
||||||
> **WebUI 自动构建**:本地首次启动时,若 `static/admin` 不存在,会自动尝试执行 `npm ci`(仅在缺少依赖时)和 `npm run build -- --outDir static/admin --emptyOutDir`(需要本机有 Node.js)。你也可以手动构建:`./scripts/build-webui.sh`
|
> **WebUI 自动构建**:本地首次启动时,若 `static/admin` 不存在,会自动尝试执行 `npm ci`(仅在缺少依赖时)和 `npm run build -- --outDir static/admin --emptyOutDir`(需要本机有 Node.js)。你也可以手动构建:`./scripts/build-webui.sh`
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,9 @@ cp config.example.json config.json
|
|||||||
go run ./cmd/ds2api
|
go run ./cmd/ds2api
|
||||||
```
|
```
|
||||||
|
|
||||||
Default URL: `http://localhost:5001`
|
Default local URL: `http://127.0.0.1:5001`
|
||||||
|
|
||||||
|
The server actually binds to `0.0.0.0:5001`, so devices on the same LAN can usually reach it through your private IP as well.
|
||||||
|
|
||||||
> **WebUI auto-build**: On first local startup, if `static/admin` is missing, DS2API will auto-run `npm ci` (only when dependencies are missing) and `npm run build -- --outDir static/admin --emptyOutDir` (requires Node.js). You can also build manually: `./scripts/build-webui.sh`
|
> **WebUI auto-build**: On first local startup, if `static/admin` is missing, DS2API will auto-run `npm ci` (only when dependencies are missing) and `npm run build -- --outDir static/admin --emptyOutDir` (requires Node.js). You can also build manually: `./scripts/build-webui.sh`
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ cp config.example.json config.json
|
|||||||
|
|
||||||
# 3. Run backend
|
# 3. Run backend
|
||||||
go run ./cmd/ds2api
|
go run ./cmd/ds2api
|
||||||
# Default: http://localhost:5001
|
# Local access: http://127.0.0.1:5001
|
||||||
|
# Actual bind: 0.0.0.0:5001, so LAN access is available via your private IP
|
||||||
```
|
```
|
||||||
|
|
||||||
### Frontend Development (WebUI)
|
### Frontend Development (WebUI)
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ cp config.example.json config.json
|
|||||||
|
|
||||||
# 3. 启动后端
|
# 3. 启动后端
|
||||||
go run ./cmd/ds2api
|
go run ./cmd/ds2api
|
||||||
# 默认监听 http://localhost:5001
|
# 本地访问 http://127.0.0.1:5001
|
||||||
|
# 实际绑定 0.0.0.0:5001,可通过局域网 IP 访问
|
||||||
```
|
```
|
||||||
|
|
||||||
### 前端开发(WebUI)
|
### 前端开发(WebUI)
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ async function buildWebui() {
|
|||||||
// 启动后端(开发模式:go run,无需预编译)
|
// 启动后端(开发模式:go run,无需预编译)
|
||||||
async function startBackendDev() {
|
async function startBackendDev() {
|
||||||
if (!checkGo()) throw new Error('未找到 Go,请先安装 Go (https://go.dev/dl/)');
|
if (!checkGo()) throw new Error('未找到 Go,请先安装 Go (https://go.dev/dl/)');
|
||||||
log.info(`启动后端(go run)... http://localhost:${CONFIG.port}`);
|
log.info(`启动后端(go run)... 本地 http://127.0.0.1:${CONFIG.port} 绑定 0.0.0.0:${CONFIG.port}`);
|
||||||
const proc = spawn('go', ['run', './cmd/ds2api'], {
|
const proc = spawn('go', ['run', './cmd/ds2api'], {
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
@@ -289,7 +289,7 @@ async function startBackendProd() {
|
|||||||
log.warn('未找到编译产物,正在编译...');
|
log.warn('未找到编译产物,正在编译...');
|
||||||
await buildBackend();
|
await buildBackend();
|
||||||
}
|
}
|
||||||
log.info(`启动后端(二进制)... http://localhost:${CONFIG.port}`);
|
log.info(`启动后端(二进制)... 本地 http://127.0.0.1:${CONFIG.port} 绑定 0.0.0.0:${CONFIG.port}`);
|
||||||
const proc = spawn(BINARY, [], {
|
const proc = spawn(BINARY, [], {
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
@@ -325,8 +325,9 @@ async function startFrontend() {
|
|||||||
// 显示状态信息
|
// 显示状态信息
|
||||||
function showStatus() {
|
function showStatus() {
|
||||||
console.log('\n' + '─'.repeat(50));
|
console.log('\n' + '─'.repeat(50));
|
||||||
log.success(`后端 API: http://localhost:${CONFIG.port}`);
|
log.success(`后端 API: http://127.0.0.1:${CONFIG.port}`);
|
||||||
log.success(`管理界面: http://localhost:${CONFIG.port}/admin`);
|
log.success(`管理界面: http://127.0.0.1:${CONFIG.port}/admin`);
|
||||||
|
log.info(`后端绑定: 0.0.0.0:${CONFIG.port} (可通过局域网 IP 访问)`);
|
||||||
if (existsSync(CONFIG.webuiDir)) {
|
if (existsSync(CONFIG.webuiDir)) {
|
||||||
log.success(`前端 Dev: http://localhost:${CONFIG.frontendPort}`);
|
log.success(`前端 Dev: http://localhost:${CONFIG.frontendPort}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user