fix: enhance logging in openExternalUrl for better debugging
This commit is contained in:
@@ -3,18 +3,25 @@
|
||||
* @param url The URL to open
|
||||
*/
|
||||
export const openExternalUrl = async (url: string): Promise<void> => {
|
||||
console.log('[openExternalUrl] called with:', url);
|
||||
console.log('[openExternalUrl] __TAURI__ exists:', !!(window as any).__TAURI__);
|
||||
|
||||
// Only run this in Tauri builds
|
||||
if (typeof window !== 'undefined' && (window as any).__TAURI__) {
|
||||
try {
|
||||
console.log('[openExternalUrl] importing opener plugin...');
|
||||
const { openUrl } = await import('@tauri-apps/plugin-opener');
|
||||
console.log('[openExternalUrl] calling openUrl...');
|
||||
await openUrl(url);
|
||||
console.log('[openExternalUrl] openUrl succeeded');
|
||||
return;
|
||||
} catch (err) {
|
||||
console.error('Tauri opener.openUrl failed:', err);
|
||||
console.error('[openExternalUrl] Tauri opener.openUrl failed:', err);
|
||||
// Don't fall back to window.open in Tauri - it won't work with localhost plugin
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log('[openExternalUrl] falling back to window.open');
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user