Remove plugin store config from server settings
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 28s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m24s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m33s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m17s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m54s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m40s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m8s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m46s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 1m57s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m9s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m50s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m24s

This commit is contained in:
2026-03-19 19:42:03 +08:00
parent e4999abf47
commit bed78a36d0
3 changed files with 42 additions and 147 deletions

View File

@@ -1,15 +1,12 @@
package dto
// UpdateServerConfigRequest 更新服务器配置请求
// @Description 更新服务器配置
// UpdateServerConfigRequest is the config update payload.
type UpdateServerConfigRequest struct {
Server *ServerConfigPart `json:"server"`
Web *WebConfigPart `json:"web"`
PluginStore *PluginStoreConfigPart `json:"plugin_store"`
}
// ServerConfigPart 服务器配置部分
// @Description 隧道服务器配置
// ServerConfigPart is the server config subset.
type ServerConfigPart struct {
BindAddr string `json:"bind_addr" binding:"omitempty"`
BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"`
@@ -18,8 +15,7 @@ type ServerConfigPart struct {
HeartbeatTimeout int `json:"heartbeat_timeout" binding:"omitempty,min=1,max=600"`
}
// WebConfigPart Web 配置部分
// @Description Web 控制台配置
// WebConfigPart is the web console config subset.
type WebConfigPart struct {
Enabled bool `json:"enabled"`
BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"`
@@ -27,37 +23,25 @@ type WebConfigPart struct {
Password string `json:"password" binding:"omitempty,min=6,max=64"`
}
// ServerConfigResponse 服务器配置响应
// @Description 服务器配置信息
// ServerConfigResponse is the config response payload.
type ServerConfigResponse struct {
Server ServerConfigInfo `json:"server"`
Web WebConfigInfo `json:"web"`
PluginStore PluginStoreConfigInfo `json:"plugin_store"`
}
// ServerConfigInfo 服务器配置信息
// ServerConfigInfo describes the server config.
type ServerConfigInfo struct {
BindAddr string `json:"bind_addr"`
BindPort int `json:"bind_port"`
Token string `json:"token"` // 脱敏后的 token
Token string `json:"token"`
HeartbeatSec int `json:"heartbeat_sec"`
HeartbeatTimeout int `json:"heartbeat_timeout"`
}
// WebConfigInfo Web 配置信息
// WebConfigInfo describes the web console config.
type WebConfigInfo struct {
Enabled bool `json:"enabled"`
BindPort int `json:"bind_port"`
Username string `json:"username"`
Password string `json:"password"` // 显示为 ****
}
// PluginStoreConfigPart 插件商店配置部分
type PluginStoreConfigPart struct {
URL string `json:"url"`
}
// PluginStoreConfigInfo 插件商店配置信息
type PluginStoreConfigInfo struct {
URL string `json:"url"`
Password string `json:"password"`
}

View File

@@ -162,20 +162,14 @@ export interface WebConfigInfo {
password: string
}
export interface PluginStoreConfigInfo {
url: string
}
export interface ServerConfigResponse {
server: ServerConfigInfo
web: WebConfigInfo
plugin_store: PluginStoreConfigInfo
}
export interface UpdateServerConfigRequest {
server?: Partial<ServerConfigInfo>
web?: Partial<WebConfigInfo>
plugin_store?: Partial<PluginStoreConfigInfo>
}
export const getServerConfig = () => get<ServerConfigResponse>('/config')

View File

@@ -1,37 +1,38 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ServerOutline, SettingsOutline, SaveOutline } from '@vicons/ionicons5'
import { useToast } from '../composables/useToast'
import { onMounted, ref } from 'vue'
import { SaveOutline, ServerOutline, SettingsOutline } from '@vicons/ionicons5'
import {
getVersionInfo, getServerConfig, updateServerConfig,
type VersionInfo, type ServerConfigResponse
getServerConfig,
getVersionInfo,
updateServerConfig,
type ServerConfigResponse,
type UpdateServerConfigRequest,
type VersionInfo,
} from '../api'
import { useToast } from '../composables/useToast'
const message = useToast()
const versionInfo = ref<VersionInfo | null>(null)
const loading = ref(true)
// 服务器配置
const serverConfig = ref<ServerConfigResponse | null>(null)
const configLoading = ref(false)
const savingConfig = ref(false)
// 配置表单
const configForm = ref({
heartbeat_sec: 30,
heartbeat_timeout: 90,
web_username: '',
web_password: '',
plugin_store_url: ''
})
const loadVersionInfo = async () => {
try {
const { data } = await getVersionInfo()
versionInfo.value = data
} catch (e) {
console.error('Failed to load version info', e)
} catch (error) {
console.error('Failed to load version info', error)
} finally {
loading.value = false
}
@@ -42,16 +43,14 @@ const loadServerConfig = async () => {
try {
const { data } = await getServerConfig()
serverConfig.value = data
// 填充表单
configForm.value = {
heartbeat_sec: data.server.heartbeat_sec,
heartbeat_timeout: data.server.heartbeat_timeout,
web_username: data.web.username,
web_password: '',
plugin_store_url: data.plugin_store.url
}
} catch (e) {
console.error('Failed to load server config', e)
} catch (error) {
console.error('Failed to load server config', error)
} finally {
configLoading.value = false
}
@@ -60,27 +59,28 @@ const loadServerConfig = async () => {
const handleSaveConfig = async () => {
savingConfig.value = true
try {
const updateReq: any = {
const updateReq: UpdateServerConfigRequest = {
server: {
heartbeat_sec: configForm.value.heartbeat_sec,
heartbeat_timeout: configForm.value.heartbeat_timeout
heartbeat_timeout: configForm.value.heartbeat_timeout,
},
web: {
username: configForm.value.web_username
username: configForm.value.web_username,
},
plugin_store: {
url: configForm.value.plugin_store_url
}
}
// 只有填写了密码才更新
if (configForm.value.web_password) {
updateReq.web.password = configForm.value.web_password
updateReq.web = {
...updateReq.web,
password: configForm.value.web_password,
}
}
await updateServerConfig(updateReq)
message.success('配置已保存,部分配置需要重启服务后生效')
configForm.value.web_password = ''
} catch (e: any) {
message.error(e.response?.data || '保存配置失败')
} catch (error: any) {
message.error(error.response?.data || '保存配置失败')
} finally {
savingConfig.value = false
}
@@ -94,7 +94,6 @@ onMounted(() => {
<template>
<div class="settings-page">
<!-- Particles -->
<div class="particles">
<div class="particle particle-1"></div>
<div class="particle particle-2"></div>
@@ -102,13 +101,11 @@ onMounted(() => {
</div>
<div class="settings-content">
<!-- Header -->
<div class="page-header">
<h1 class="page-title">系统设置</h1>
<p class="page-subtitle">管理服务端配置和系统更新</p>
</div>
<!-- Version Info Card -->
<div class="glass-card">
<div class="card-header">
<h3>版本信息</h3>
@@ -146,7 +143,6 @@ onMounted(() => {
</div>
</div>
<!-- Server Config Card -->
<div class="glass-card">
<div class="card-header">
<h3>服务器配置</h3>
@@ -201,19 +197,6 @@ onMounted(() => {
</div>
</div>
<div class="form-divider"></div>
<div class="form-group">
<label class="form-label">插件商店地址</label>
<input
v-model="configForm.plugin_store_url"
type="text"
class="glass-input"
placeholder="https://git.92coco.cn/flik/GoTunnel-Plugins/raw/branch/main/store.json"
/>
<span class="form-hint">插件商店的 API 地址留空使用默认地址</span>
</div>
<div class="form-actions">
<button
class="glass-btn primary"
@@ -241,7 +224,6 @@ onMounted(() => {
padding: 32px;
}
/* Hide particles */
.particles {
position: absolute;
inset: 0;
@@ -315,7 +297,6 @@ onMounted(() => {
font-size: 14px;
}
/* Glass Card */
.glass-card {
background: var(--color-bg-tertiary);
border-radius: 12px;
@@ -342,7 +323,6 @@ onMounted(() => {
padding: 20px;
}
/* Info Grid */
.info-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
@@ -350,7 +330,9 @@ onMounted(() => {
}
@media (max-width: 600px) {
.info-grid { grid-template-columns: repeat(2, 1fr); }
.info-grid {
grid-template-columns: repeat(2, 1fr);
}
}
.info-item {
@@ -374,65 +356,13 @@ onMounted(() => {
font-family: monospace;
}
/* States */
.loading-state, .empty-state {
.loading-state,
.empty-state {
text-align: center;
padding: 32px;
color: var(--color-text-muted);
}
/* Update Alert */
.update-alert {
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 16px;
font-size: 13px;
}
.update-alert.success {
background: rgba(0, 186, 124, 0.15);
border: 1px solid rgba(0, 186, 124, 0.3);
color: var(--color-success);
}
.update-alert.info {
background: rgba(29, 155, 240, 0.15);
border: 1px solid rgba(29, 155, 240, 0.3);
color: var(--color-info);
}
/* Download Info */
.download-info {
color: var(--color-text-secondary);
font-size: 13px;
margin-bottom: 12px;
}
/* Release Note */
.release-note {
margin-bottom: 16px;
}
.note-label {
display: block;
font-size: 12px;
color: var(--color-text-muted);
margin-bottom: 6px;
}
.release-note pre {
margin: 0;
white-space: pre-wrap;
font-size: 12px;
color: var(--color-text-secondary);
background: var(--color-bg-elevated);
padding: 12px;
border-radius: 8px;
max-height: 150px;
overflow-y: auto;
}
/* Glass Button */
.glass-btn {
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
@@ -456,11 +386,6 @@ onMounted(() => {
cursor: not-allowed;
}
.glass-btn.small {
padding: 6px 12px;
font-size: 12px;
}
.glass-btn.primary {
background: var(--color-accent);
border: none;
@@ -470,7 +395,6 @@ onMounted(() => {
background: var(--color-accent-hover);
}
/* Icon styles */
.header-icon {
width: 20px;
height: 20px;
@@ -482,7 +406,6 @@ onMounted(() => {
height: 14px;
}
/* Config Form */
.config-form {
display: flex;
flex-direction: column;
@@ -501,11 +424,6 @@ onMounted(() => {
font-weight: 500;
}
.form-hint {
font-size: 11px;
color: var(--color-text-muted);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -528,7 +446,6 @@ onMounted(() => {
margin-top: 8px;
}
/* Glass Input */
.glass-input {
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);