Skip to content

Mattermost

Mattermost 是一款可自托管的团队协作平台。Protocol Launcher 允许你按照官方 mattermost:// 格式生成 Mattermost 深度链接。

使用方式

有两种使用此库的方式:

  • 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
  • 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。

生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

注意事项

Mattermost 官方文档列出了用于团队、频道、频道消息或讨论串、私信的 mattermost:// 深度链接。serverUrl 对应官方格式中的 <your-Mattermost-server-URL> 片段。请使用你的 Mattermost 工作区中实际存在的团队名称、频道名称、帖子 ID 和用户名。

打开团队

On-Demand
ts
import { openTeam } from 'protocol-launcher/mattermost'

const url = openTeam({
  serverUrl: 'your-Mattermost-server-URL',
  teamName: 'team-name',
})

打开频道

On-Demand
ts
import { openChannel } from 'protocol-launcher/mattermost'

const url = openChannel({
  serverUrl: 'your-Mattermost-server-URL',
  teamName: 'team-name',
  channelName: 'channel-name',
})

打开频道消息或讨论串

On-Demand
ts
import { openPost } from 'protocol-launcher/mattermost'

const url = openPost({
  serverUrl: 'your-Mattermost-server-URL',
  teamName: 'team-name',
  postId: 'post-id',
})

打开私信

On-Demand
ts
import { openDirectMessage } from 'protocol-launcher/mattermost'

const url = openDirectMessage({
  serverUrl: 'your-Mattermost-server-URL',
  teamName: 'team-name',
  userName: 'user-name',
})

官方文档