mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-04-09 15:08:31 +00:00
Compare commits
1 Commits
main
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8789793da |
@@ -1693,6 +1693,13 @@ function registerIpcHandlers() {
|
|||||||
return applyLaunchAtStartupPreference(enabled === true)
|
return applyLaunchAtStartupPreference(enabled === true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('app:checkWayland', async () => {
|
||||||
|
if (process.platform !== 'linux') return false;
|
||||||
|
|
||||||
|
const sessionType = process.env.XDG_SESSION_TYPE?.toLowerCase();
|
||||||
|
return Boolean(process.env.WAYLAND_DISPLAY || sessionType === 'wayland');
|
||||||
|
})
|
||||||
|
|
||||||
ipcMain.handle('log:getPath', async () => {
|
ipcMain.handle('log:getPath', async () => {
|
||||||
return join(app.getPath('userData'), 'logs', 'wcdb.log')
|
return join(app.getPath('userData'), 'logs', 'wcdb.log')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||||||
ipcRenderer.on('app:updateAvailable', (_, info) => callback(info))
|
ipcRenderer.on('app:updateAvailable', (_, info) => callback(info))
|
||||||
return () => ipcRenderer.removeAllListeners('app:updateAvailable')
|
return () => ipcRenderer.removeAllListeners('app:updateAvailable')
|
||||||
},
|
},
|
||||||
|
checkWayland: () => ipcRenderer.invoke('app:checkWayland'),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
|
|||||||
56
package-lock.json
generated
56
package-lock.json
generated
@@ -28,7 +28,7 @@
|
|||||||
"react-router-dom": "^7.14.0",
|
"react-router-dom": "^7.14.0",
|
||||||
"react-virtuoso": "^4.18.1",
|
"react-virtuoso": "^4.18.1",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"sherpa-onnx-node": "^1.12.35",
|
"sherpa-onnx-node": "^1.12.36",
|
||||||
"silk-wasm": "^3.7.1",
|
"silk-wasm": "^3.7.1",
|
||||||
"wechat-emojis": "^1.0.2",
|
"wechat-emojis": "^1.0.2",
|
||||||
"zustand": "^5.0.2"
|
"zustand": "^5.0.2"
|
||||||
@@ -9093,9 +9093,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-darwin-arm64": {
|
"node_modules/sherpa-onnx-darwin-arm64": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.36.tgz",
|
||||||
"integrity": "sha512-WGIABo3ruBXE/7FhAdaVNuM+ZKx0B7jkA+jT22k5TxUcw58nWzgkY6k+CPdM14lfaaXR+jPWdDrM4gXl/bP4RQ==",
|
"integrity": "sha512-c1C7f2zO2BXNusrDlid5Mq5USfqq4oJrimnnHqNYtm4Kk2UzrxA9l6lAu2FZDj4gTQYRY4IJnlo0T7UXeOsjtQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -9106,9 +9106,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-darwin-x64": {
|
"node_modules/sherpa-onnx-darwin-x64": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.36.tgz",
|
||||||
"integrity": "sha512-hzWQm4CJhGyf3N9Sd1Oobcdz49FauuSCmhrm5vRqydyNsANjs89wATHAuatPAtinpBkgEqacDPrGz+1A/BWpNA==",
|
"integrity": "sha512-pRaELEwQ60cfBTtERiw6muN+0+FhVom0As0erRcRqdPKLNK4HCCSUaoHPYLFT6W1VUiJBzABH+WE2+LTDyx5JA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -9119,9 +9119,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-linux-arm64": {
|
"node_modules/sherpa-onnx-linux-arm64": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.36.tgz",
|
||||||
"integrity": "sha512-9glJ+dRv/rFWz/61tiKfaR9Gj+8B6sXi7NBgwBAnO/+ygu/WAjBfQRz2+S0YIy1dxqu7ng246TBNnx1M2XaNXA==",
|
"integrity": "sha512-Lv+j1Bq0Blp44O/i4gT4RieSDpiCoEPXfvNv0ABR2Gp6IbziI7gEsHgAf8HGjrA7EirtHAgX0o4hzUPW9yc+uw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -9132,9 +9132,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-linux-x64": {
|
"node_modules/sherpa-onnx-linux-x64": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.36.tgz",
|
||||||
"integrity": "sha512-h+v4Yed8T+k1qLlKX2LTGoXP/11ycz7jbqC2f80kDWgz9J8m46mOBa/H20wVkLyQPy1vG1O5iH5Fe5Wh4QlLhw==",
|
"integrity": "sha512-Wul2WAaUt0e2zZaaQR4N3GTDhcZdz44w3FiStr195TI9U4uNxVbFgZbw9YsEMj8K7gm7JhoH2bnCn8fUJv88EQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -9145,23 +9145,23 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-node": {
|
"node_modules/sherpa-onnx-node": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.36.tgz",
|
||||||
"integrity": "sha512-RHCgV+9fos/ZxP0MsIL7JPU9K3YHnIDmwtX674ChQZY6DLVaIQaju+J3hDqzRu1R3agnDg9WDf01zsT46NC7SQ==",
|
"integrity": "sha512-AjdOE0qa3jAmS/zh0BwNVXn9ZRz8PpgCgcLIyf7IYxDfTMWIgHaRFisDL4QzttuDe3apvBXjP1Y7FtZPSRFqqQ==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"sherpa-onnx-darwin-arm64": "^1.12.35",
|
"sherpa-onnx-darwin-arm64": "^1.12.36",
|
||||||
"sherpa-onnx-darwin-x64": "^1.12.35",
|
"sherpa-onnx-darwin-x64": "^1.12.36",
|
||||||
"sherpa-onnx-linux-arm64": "^1.12.35",
|
"sherpa-onnx-linux-arm64": "^1.12.36",
|
||||||
"sherpa-onnx-linux-x64": "^1.12.35",
|
"sherpa-onnx-linux-x64": "^1.12.36",
|
||||||
"sherpa-onnx-win-ia32": "^1.12.35",
|
"sherpa-onnx-win-ia32": "^1.12.36",
|
||||||
"sherpa-onnx-win-x64": "^1.12.35"
|
"sherpa-onnx-win-x64": "^1.12.36"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-win-ia32": {
|
"node_modules/sherpa-onnx-win-ia32": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-ia32/-/sherpa-onnx-win-ia32-1.12.36.tgz",
|
||||||
"integrity": "sha512-6H6BSdXXWtz92AuvOmr4w/QvCofxXbfbNKT7jCxdE7Nd4AvinLJxT02vbnL6T54vuXd9chu0QvQrDl1tuRphAA==",
|
"integrity": "sha512-An3O5tEq4P5xKBSZMq10F/w6q79fgdbFZ4NKPoflSKSW37TSyNz9MhHLHwhse/BMPa35eW14J9dsGG3DZTC/xA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -9172,9 +9172,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/sherpa-onnx-win-x64": {
|
"node_modules/sherpa-onnx-win-x64": {
|
||||||
"version": "1.12.35",
|
"version": "1.12.36",
|
||||||
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-x64/-/sherpa-onnx-win-x64-1.12.35.tgz",
|
"resolved": "https://registry.npmjs.org/sherpa-onnx-win-x64/-/sherpa-onnx-win-x64-1.12.36.tgz",
|
||||||
"integrity": "sha512-+GLrxwaEvpJAO0KZgKulfd4qUR089MD+TjE5jVSugMTq4Eh/R/TpPPqYQGibRZVPHW7Se1ABfHGapZQoFMHH5Q==",
|
"integrity": "sha512-wZLQflcvy8ynsU6B8GvqWIhOCAjP6+rnzyadF+qGWgZzMSCduapD63q++0QDRabGRBL8qfsd2n7O2dF/W2kccQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
"react-router-dom": "^7.14.0",
|
"react-router-dom": "^7.14.0",
|
||||||
"react-virtuoso": "^4.18.1",
|
"react-virtuoso": "^4.18.1",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"sherpa-onnx-node": "^1.12.35",
|
"sherpa-onnx-node": "^1.12.36",
|
||||||
"silk-wasm": "^3.7.1",
|
"silk-wasm": "^3.7.1",
|
||||||
"wechat-emojis": "^1.0.2",
|
"wechat-emojis": "^1.0.2",
|
||||||
"zustand": "^5.0.2"
|
"zustand": "^5.0.2"
|
||||||
|
|||||||
65
src/App.tsx
65
src/App.tsx
@@ -107,6 +107,44 @@ function App() {
|
|||||||
const [showAnalyticsConsent, setShowAnalyticsConsent] = useState(false)
|
const [showAnalyticsConsent, setShowAnalyticsConsent] = useState(false)
|
||||||
const [analyticsConsent, setAnalyticsConsent] = useState<boolean | null>(null)
|
const [analyticsConsent, setAnalyticsConsent] = useState<boolean | null>(null)
|
||||||
|
|
||||||
|
const [showWaylandWarning, setShowWaylandWarning] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const checkWaylandStatus = async () => {
|
||||||
|
try {
|
||||||
|
// 防止在非客户端环境报错,先检查 API 是否存在
|
||||||
|
if (!window.electronAPI?.app?.checkWayland) return
|
||||||
|
|
||||||
|
// 通过 configService 检查是否已经弹过窗
|
||||||
|
const hasWarned = await window.electronAPI.config.get('waylandWarningShown')
|
||||||
|
|
||||||
|
if (!hasWarned) {
|
||||||
|
const isWayland = await window.electronAPI.app.checkWayland()
|
||||||
|
if (isWayland) {
|
||||||
|
setShowWaylandWarning(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('检查 Wayland 状态失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有在协议同意之后并且已经进入主应用流程才检查
|
||||||
|
if (!isAgreementWindow && !isOnboardingWindow && !agreementLoading) {
|
||||||
|
checkWaylandStatus()
|
||||||
|
}
|
||||||
|
}, [isAgreementWindow, isOnboardingWindow, agreementLoading])
|
||||||
|
|
||||||
|
const handleDismissWaylandWarning = async () => {
|
||||||
|
try {
|
||||||
|
// 记录到本地配置中,下次不再提示
|
||||||
|
await window.electronAPI.config.set('waylandWarningShown', true)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('保存 Wayland 提示状态失败:', e)
|
||||||
|
}
|
||||||
|
setShowWaylandWarning(false)
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (location.pathname !== '/settings') {
|
if (location.pathname !== '/settings') {
|
||||||
settingsBackgroundRef.current = location
|
settingsBackgroundRef.current = location
|
||||||
@@ -647,6 +685,33 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/*{showWaylandWarning && (*/}
|
||||||
|
{/* <div className="agreement-overlay">*/}
|
||||||
|
{/* <div className="agreement-modal">*/}
|
||||||
|
{/* <div className="agreement-header">*/}
|
||||||
|
{/* <Shield size={32} />*/}
|
||||||
|
{/* <h2>环境兼容性提示 (Wayland)</h2>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* <div className="agreement-content">*/}
|
||||||
|
{/* <div className="agreement-text">*/}
|
||||||
|
{/* <p>检测到您当前正在使用 <strong>Wayland</strong> 显示服务器。</p>*/}
|
||||||
|
{/* <p>在 Wayland 环境下,出于系统级的安全与设计机制,<strong>应用程序无法直接控制新弹出窗口的位置</strong>。</p>*/}
|
||||||
|
{/* <p>这可能导致某些独立窗口(如消息通知、图片查看器等)出现位置随机、或不受控制的情况。这是底层机制导致的,对此我们无能为力。</p>*/}
|
||||||
|
{/* <br />*/}
|
||||||
|
{/* <p>如果您觉得窗口位置异常严重影响了使用体验,建议尝试:</p>*/}
|
||||||
|
{/* <p>1. 在系统登录界面,将会话切换回 <strong>X11 (Xorg)</strong> 模式。</p>*/}
|
||||||
|
{/* <p>2. 修改您的桌面管理器 (WM/DE) 配置,强制指定该应用程序的窗口规则。</p>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* <div className="agreement-footer">*/}
|
||||||
|
{/* <div className="agreement-actions">*/}
|
||||||
|
{/* <button className="btn btn-primary" onClick={handleDismissWaylandWarning}>我知道了,不再提示</button>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/* </div>*/}
|
||||||
|
{/*)}*/}
|
||||||
|
|
||||||
{/* 更新提示对话框 */}
|
{/* 更新提示对话框 */}
|
||||||
<UpdateDialog
|
<UpdateDialog
|
||||||
open={showUpdateDialog}
|
open={showUpdateDialog}
|
||||||
|
|||||||
@@ -238,6 +238,23 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
const [aiInsightTelegramToken, setAiInsightTelegramToken] = useState('')
|
const [aiInsightTelegramToken, setAiInsightTelegramToken] = useState('')
|
||||||
const [aiInsightTelegramChatIds, setAiInsightTelegramChatIds] = useState('')
|
const [aiInsightTelegramChatIds, setAiInsightTelegramChatIds] = useState('')
|
||||||
|
|
||||||
|
const [isWayland, setIsWayland] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const checkWaylandStatus = async () => {
|
||||||
|
if (window.electronAPI?.app?.checkWayland) {
|
||||||
|
try {
|
||||||
|
const wayland = await window.electronAPI.app.checkWayland()
|
||||||
|
setIsWayland(wayland)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('检查 Wayland 状态失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkWaylandStatus()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 检查 Hello 可用性
|
// 检查 Hello 可用性
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setHelloAvailable(isWindows)
|
setHelloAvailable(isWindows)
|
||||||
@@ -1679,6 +1696,11 @@ function SettingsPage({ onClose }: SettingsPageProps = {}) {
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>通知显示位置</label>
|
<label>通知显示位置</label>
|
||||||
<span className="form-hint">选择通知弹窗在屏幕上的显示位置</span>
|
<span className="form-hint">选择通知弹窗在屏幕上的显示位置</span>
|
||||||
|
{isWayland && (
|
||||||
|
<span className="form-hint" style={{ color: '#ff4d4f', marginTop: '4px', display: 'block' }}>
|
||||||
|
⚠️ 注意:Wayland 环境下该配置可能无效!
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
<div className="custom-select">
|
<div className="custom-select">
|
||||||
<div
|
<div
|
||||||
className={`custom-select-trigger ${positionDropdownOpen ? 'open' : ''}`}
|
className={`custom-select-trigger ${positionDropdownOpen ? 'open' : ''}`}
|
||||||
|
|||||||
1
src/types/electron.d.ts
vendored
1
src/types/electron.d.ts
vendored
@@ -69,6 +69,7 @@ export interface ElectronAPI {
|
|||||||
ignoreUpdate: (version: string) => Promise<{ success: boolean }>
|
ignoreUpdate: (version: string) => Promise<{ success: boolean }>
|
||||||
onDownloadProgress: (callback: (progress: number) => void) => () => void
|
onDownloadProgress: (callback: (progress: number) => void) => () => void
|
||||||
onUpdateAvailable: (callback: (info: { version: string; releaseNotes: string }) => void) => () => void
|
onUpdateAvailable: (callback: (info: { version: string; releaseNotes: string }) => void) => () => void
|
||||||
|
checkWayland: () => Promise<boolean>
|
||||||
}
|
}
|
||||||
notification: {
|
notification: {
|
||||||
show: (data: { title: string; content: string; avatarUrl?: string; sessionId: string }) => Promise<{ success?: boolean; error?: string } | void>
|
show: (data: { title: string; content: string; avatarUrl?: string; sessionId: string }) => Promise<{ success?: boolean; error?: string } | void>
|
||||||
|
|||||||
Reference in New Issue
Block a user