mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
api相关优化
This commit is contained in:
@@ -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()}>
|
||||
|
||||
5
src/types/electron.d.ts
vendored
5
src/types/electron.d.ts
vendored
@@ -501,6 +501,11 @@ export interface ElectronAPI {
|
||||
onToken: (callback: (token: string) => void) => () => void
|
||||
onDownloadProgress: (callback: (payload: { downloaded: number; total: number; speed: number }) => void) => () => void
|
||||
}
|
||||
http: {
|
||||
start: (port?: number) => Promise<{ success: boolean; port?: number; error?: string }>
|
||||
stop: () => Promise<{ success: boolean }>
|
||||
status: () => Promise<{ running: boolean; port: number; mediaExportPath: string }>
|
||||
}
|
||||
}
|
||||
|
||||
export interface ExportOptions {
|
||||
|
||||
Reference in New Issue
Block a user