refactor: 安装向导移除「监听端口」字段

端口由启动方式(PM2 项目端口 / compose / API_PORT 环境变量)决定,默认 3000,
向导填的值会被进程环境覆盖,属误导项;写 .env 的 API_PORT 改取 process.env.API_PORT。
反代 HTTPS/域名仍由 Nginx/宝塔/1Panel 配置,与安装页无关。
This commit is contained in:
Nixevol
2026-07-09 15:11:43 +08:00
parent 8db618a807
commit 7348a3444e
5 changed files with 5 additions and 19 deletions
+1 -2
View File
@@ -192,8 +192,7 @@
"base": "Base",
"appName": "Platform Name",
"baseUrl": "Public URL",
"listenPort": "Listen Port",
"baseUrlHint": "All three apps share this URL: admin at /admin, client at /trace, API at /api. Use Nginx / a control panel to reverse-proxy the domain and HTTPS to the listen port.",
"baseUrlHint": "All three apps share this URL: admin at /admin, client at /trace, API at /api. Reverse-proxy the domain and HTTPS to the service port (default 3000, decided by how the service is launched — not set here).",
"host": "Host",
"port": "Port",
"database": "Database",
+1 -2
View File
@@ -192,8 +192,7 @@
"base": "基础",
"appName": "平台名称",
"baseUrl": "对外访问地址",
"listenPort": "监听端口",
"baseUrlHint": "三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 建议由 Nginx/宝塔/1Panel 反代到监听端口。",
"baseUrlHint": "三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 由 Nginx/宝塔/1Panel 反代到服务端口(默认 3000,由启动方式决定,此处无需填写)。",
"host": "主机",
"port": "端口",
"database": "数据库",
-4
View File
@@ -29,7 +29,6 @@
<h2>{{ tt('base') }}</h2>
<label><span>{{ tt('appName') }}</span><n-input v-model:value="form.appName" /></label>
<label><span>{{ tt('baseUrl') }}</span><n-input v-model:value="form.baseUrl" placeholder="https://example.com" /></label>
<label><span>{{ tt('listenPort') }}</span><n-input-number v-model:value="form.port" :min="1" :show-button="false" class="full" /></label>
<p class="hint">{{ tt('baseUrlHint') }}</p>
</section>
@@ -100,7 +99,6 @@ import { useI18n } from 'vue-i18n';
interface InstallForm {
appName: string;
baseUrl: string;
port: number;
mysql: {
host: string;
port: number;
@@ -138,7 +136,6 @@ const driverOptions = computed(() => [
const form = reactive<InstallForm>({
appName: tt('defaultAppName'),
baseUrl: location.origin,
port: 3000,
mysql: {
host: '127.0.0.1',
port: 3306,
@@ -223,7 +220,6 @@ onMounted(async () => {
const body = await res.json();
installed.value = Boolean(body.data?.installed);
const d = body.data?.defaults || {};
form.port = d.port || form.port;
form.mysql.host = d.mysqlHost || form.mysql.host;
form.mysql.port = d.mysqlPort || form.mysql.port;
form.mysql.database = d.mysqlDatabase || form.mysql.database;
+1 -8
View File
@@ -158,18 +158,11 @@ export class InstallRequestDto {
appName!: string;
// 对外访问地址(域名,可含端口);后台、客户端、短链、二维码均基于此推导。
// 服务监听端口不在此处填写:由启动方式(PM2 项目端口 / compose / API_PORT 环境变量)决定,默认 3000。
@ApiProperty()
@IsUrl({ require_tld: false })
baseUrl!: string;
// 服务监听端口(默认 3000),由前置 Nginx/宝塔/1Panel 反代指向该端口。
@ApiPropertyOptional({ default: 3000 })
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
port?: number;
@ApiProperty()
@ValidateNested()
@Type(() => InstallMysqlDto)
+2 -3
View File
@@ -26,7 +26,6 @@ export class InstallService {
redisHost: process.env.INSTALL_REDIS_HOST || '127.0.0.1',
redisPort: Number(process.env.INSTALL_REDIS_PORT || 6379),
redisPassword: prefillSecrets ? process.env.INSTALL_REDIS_PASSWORD || '' : '',
port: Number(process.env.API_PORT || 3000),
},
};
}
@@ -192,8 +191,8 @@ export class InstallService {
'# ===== 应用 =====',
`APP_NAME=${q(dto.appName)}`,
'NODE_ENV=production',
'# 服务监听端口(由前置 Nginx/宝塔反代指向此端口)',
`API_PORT=${q(String(dto.port || 3000))}`,
'# 服务监听端口:由启动方式决定(PM2 项目端口 / compose / API_PORT 环境变量),默认 3000',
`API_PORT=${q(String(process.env.API_PORT || 3000))}`,
'# 对外访问地址:三端共用,客户端在 /trace、后台 /admin、接口 /api、短链 /t',
`BASE_URL=${q(baseUrl)}`,
'PUBLIC_TRACE_PATH=/t',