admin管理员组文章数量:1279207
I'm developing a Tauri v2 application (using Svelte and Tabulator) where I need to open a Slack deep link using the custom protocol (e.g., slack://user?team=TEAM_IDid=USER_ID). My goal is to launch the native Slack app on macOS using this URL. However, I’m running into several issues and have tried multiple approaches without success.
What I’ve Tried
- Using the Opener Plugin I attempted to use the Opener plugin:
js
import { openPath } from '@tauri-apps/plugin-opener';
// Attempting to open a Slack URL using openPath:
await openPath('slack://user?team=EDUA2R4KG&id=WR9RY8KMF');
This fails because openPath is intended for file paths rather than URLs.
- Using the Shell Plugin’s open Command I then tried the shell plugin’s open command on macOS:
js import { Command } from '@tauri-apps/plugin-shell';
const openUrlMacos = async (url) => {
const cmd = await Command.create('open', [url]);
await cmd.execute();
};
await openUrlMacos('slack://user?team=EDUA2R4KG&id=WR9RY8KMF');
Even after updating my capabilities configuration, I get the error:
Unhandled Promise Rejection: program not allowed on the configured shell scope: open My capabilities file (src-tauri/capabilities/default.json) is configured as follows:
json
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"core:default",
"dialog:default",
"fs:default",
"shell:default",
{
"identifier": "shell:allow-open",
"allow": [
{
"name": "open",
"cmd": "open",
"args": ["*"]
}
]
}
]
}
This still doesn’t allow opening the custom slack:// URL.
My Questions Is there a known workaround or fix to allow opening slack:// URLs on macOS with Tauri v2? Should I consider switching to an HTTPS-based Slack URL (if available) as a workaround, or is there a way to enable custom protocols via Tauri’s capabilities? Any help or suggestions on how to reliably launch a custom protocol URL in Tauri on macOS would be greatly appreciated!
本文标签: Tauri v2 on macOS How to Open Custom slack URLsStack Overflow
版权声明:本文标题:Tauri v2 on macOS: How to Open Custom slack: URLs? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741297443a2370898.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论