api相关优化

This commit is contained in:
xuncha
2026-02-19 17:05:43 +08:00
parent ba07d47496
commit 4e64c6ad6e
5 changed files with 412 additions and 198 deletions

View File

@@ -148,6 +148,7 @@ function SettingsPage() {
const [httpApiEnabled, setHttpApiEnabled] = useState(false)
const [httpApiPort, setHttpApiPort] = useState(5031)
const [httpApiRunning, setHttpApiRunning] = useState(false)
const [httpApiMediaExportPath, setHttpApiMediaExportPath] = useState('')
const [isTogglingApi, setIsTogglingApi] = useState(false)
const [showApiWarning, setShowApiWarning] = useState(false)
@@ -169,6 +170,9 @@ function SettingsPage() {
if (status.port) {
setHttpApiPort(status.port)
}
if (status.mediaExportPath) {
setHttpApiMediaExportPath(status.mediaExportPath)
}
} catch (e) {
console.error('检查 API 状态失败:', e)
}
@@ -1978,6 +1982,17 @@ function SettingsPage() {
)}
{/* API 安全警告弹窗 */}
<div className="form-group">
<label></label>
<span className="form-hint">`/api/v1/messages` `media=1` </span>
<input
type="text"
className="field-input"
value={httpApiMediaExportPath || '未获取到目录'}
readOnly
/>
</div>
{showApiWarning && (
<div className="modal-overlay" onClick={() => setShowApiWarning(false)}>
<div className="api-warning-modal" onClick={(e) => e.stopPropagation()}>