feat: 添加 Docker 环境轮询监听支持并优化渲染设置卡片样式

This commit is contained in:
caoxiaozhu
2026-05-09 08:25:54 +00:00
parent 4fbd313f35
commit 6d91528b7c
5 changed files with 64 additions and 23 deletions

View File

@@ -535,6 +535,10 @@
gap: 12px;
}
.rendering-settings-card .switch-group {
margin-bottom: 24px;
}
.switch-row {
width: 100%;
display: flex;

View File

@@ -404,11 +404,10 @@
</template>
<template v-else-if="activeSection === 'rendering'">
<section class="settings-card">
<section class="settings-card rendering-settings-card">
<div class="card-head">
<div>
<h4>ONLYOFFICE 服务配置</h4>
<p>维护文件渲染开关文档服务对外地址和 JWT 密钥后端回调地址继续由部署配置管理</p>
</div>
</div>

View File

@@ -38,9 +38,9 @@ const SECTION_DEFINITIONS = [
{
id: 'rendering',
label: '文件渲染',
title: 'ONLYOFFICE 文件渲染配置',
title: '文件渲染',
desc: '文档预览服务与访问密钥',
longDesc: '集中管理 ONLYOFFICE 文件渲染开关、文档服务地址和 JWT 密钥。服务端内部回调地址继续由部署配置维护。',
longDesc: '维护文件渲染开关、文档服务对外地址和 JWT 密钥,后端回调地址继续由部署配置管理。',
actionLabel: '保存文件渲染配置'
},
{

View File

@@ -0,0 +1,30 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
const settingsScript = readFileSync(new URL('../src/views/scripts/SettingsView.js', import.meta.url), 'utf8')
const settingsView = readFileSync(new URL('../src/views/SettingsView.vue', import.meta.url), 'utf8')
const settingsStyles = readFileSync(new URL('../src/assets/styles/views/settings-view.css', import.meta.url), 'utf8')
function testRenderingSectionUsesConciseToolbarTitle() {
assert.match(settingsScript, /title:\s*'文件渲染'/)
assert.doesNotMatch(settingsScript, /title:\s*'ONLYOFFICE 文件渲染配置'/)
}
function testRenderingCardRemovesDuplicatedDescription() {
assert.match(settingsView, /<h4>ONLYOFFICE 服务配置<\/h4>/)
assert.doesNotMatch(settingsView, /维护文件渲染开关、文档服务对外地址和 JWT 密钥。后端回调地址继续由部署配置管理。/)
}
function testRenderingSectionAddsSpacingBetweenSwitchAndInputs() {
assert.match(settingsView, /<section class="settings-card rendering-settings-card">/)
assert.match(settingsStyles, /\.rendering-settings-card \.switch-group \{\s*margin-bottom: 24px;\s*\}/)
}
function run() {
testRenderingSectionUsesConciseToolbarTitle()
testRenderingCardRemovesDuplicatedDescription()
testRenderingSectionAddsSpacingBetweenSwitchAndInputs()
console.log('settings rendering section tests passed')
}
run()

View File

@@ -12,6 +12,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const envFile = path.join(rootDir, '.env')
const envExampleFile = path.join(rootDir, '.env.example')
const preferPollingWatcher = fs.existsSync('/.dockerenv') || process.env.VITE_USE_POLLING === 'true'
const adminSecretDir = path.join(rootDir, 'server', '.secrets')
const adminSecretFile = path.join(adminSecretDir, 'admin.json')
const adminScryptOptions = { N: 16384, r: 8, p: 1 }
@@ -1024,6 +1025,13 @@ export default defineConfig({
envDir: '..',
server: {
watch: {
...(preferPollingWatcher
? {
// Docker bind mounts can miss fs events for Vue SFCs, which leaves Vite serving stale templates.
usePolling: true,
interval: 250
}
: {}),
ignored: [
envFile,
envExampleFile,