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 | |
|---|---|---|---|
|
|
fa7f3ba4ec |
@@ -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'),
|
||||||
},
|
},
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
|
|||||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -23,7 +23,7 @@
|
|||||||
"koffi": "^2.9.0",
|
"koffi": "^2.9.0",
|
||||||
"lucide-react": "^1.7.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.5",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router-dom": "^7.14.0",
|
"react-router-dom": "^7.14.0",
|
||||||
"react-virtuoso": "^4.18.1",
|
"react-virtuoso": "^4.18.1",
|
||||||
@@ -8470,24 +8470,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "19.2.4",
|
"version": "19.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
|
||||||
"integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",
|
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-dom": {
|
"node_modules/react-dom": {
|
||||||
"version": "19.2.4",
|
"version": "19.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz",
|
||||||
"integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",
|
"integrity": "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"scheduler": "^0.27.0"
|
"scheduler": "^0.27.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^19.2.4"
|
"react": "^19.2.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-markdown": {
|
"node_modules/react-markdown": {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"koffi": "^2.9.0",
|
"koffi": "^2.9.0",
|
||||||
"lucide-react": "^1.7.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^19.2.3",
|
"react": "^19.2.3",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.2.5",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router-dom": "^7.14.0",
|
"react-router-dom": "^7.14.0",
|
||||||
"react-virtuoso": "^4.18.1",
|
"react-virtuoso": "^4.18.1",
|
||||||
|
|||||||
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