fix: open project action links in browser
Project action URLs now open in the system browser from Electron Adds a safe Electron shell bridge for external HTTP links
This commit is contained in:
@@ -1746,6 +1746,19 @@ const handleInvoke = async (browserWindow, command, args = {}) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'desktop_open_external_url': {
|
||||||
|
const target = typeof args.url === 'string' ? args.url.trim() : '';
|
||||||
|
if (!target) throw new Error('URL is required');
|
||||||
|
|
||||||
|
const parsed = new URL(target);
|
||||||
|
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
||||||
|
throw new Error('Only HTTP URLs can be opened externally');
|
||||||
|
}
|
||||||
|
|
||||||
|
await shell.openExternal(parsed.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
case 'desktop_reveal_path': {
|
case 'desktop_reveal_path': {
|
||||||
const targetPath = typeof args.path === 'string' ? args.path.trim() : '';
|
const targetPath = typeof args.path === 'string' ? args.path.trim() : '';
|
||||||
if (!targetPath) {
|
if (!targetPath) {
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ contextBridge.exposeInMainWorld('__TAURI__', {
|
|||||||
dialog: {
|
dialog: {
|
||||||
open: (options) => ipcRenderer.invoke('openchamber:dialog:open', options || {}),
|
open: (options) => ipcRenderer.invoke('openchamber:dialog:open', options || {}),
|
||||||
},
|
},
|
||||||
|
shell: {
|
||||||
|
open: (url) => ipcRenderer.invoke('openchamber:invoke', 'desktop_open_external_url', { url }),
|
||||||
|
},
|
||||||
event: {
|
event: {
|
||||||
listen: async (event, handler) => addListener(event, handler),
|
listen: async (event, handler) => addListener(event, handler),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user