mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-12 04:03:19 +08:00
feat: secure Telegram access and connect AI Office
This commit is contained in:
parent
e3ae772106
commit
b0606159e0
30 changed files with 2045 additions and 302 deletions
|
|
@ -4,6 +4,7 @@ import {
|
|||
DingtalkLogoGlyph,
|
||||
DiscordLogoGlyph,
|
||||
FeishuLogoGlyph,
|
||||
OfficeLogoGlyph,
|
||||
QqLogoGlyph,
|
||||
SlackLogoGlyph,
|
||||
TelegramLogoGlyph,
|
||||
|
|
@ -22,6 +23,9 @@ import { installFeishuStyles } from './channels/feishu/styles.js';
|
|||
import { QQ_RPC_CHANNEL } from './channels/qq/api.js';
|
||||
import { QqSettingsTab } from './channels/qq/index.js';
|
||||
import { installQqStyles } from './channels/qq/styles.js';
|
||||
import { OFFICE_RPC_CHANNEL } from './channels/office/api.js';
|
||||
import { OfficeSettingsTab } from './channels/office/index.js';
|
||||
import { installOfficeStyles } from './channels/office/styles.js';
|
||||
import { SLACK_RPC_CHANNEL } from './channels/slack/api.js';
|
||||
import { SlackSettingsTab } from './channels/slack/index.js';
|
||||
import { installSlackStyles } from './channels/slack/styles.js';
|
||||
|
|
@ -56,6 +60,7 @@ const CHANNELS = Object.freeze([
|
|||
{ id: 'telegram', label: 'Telegram' },
|
||||
{ id: 'discord', label: 'Discord' },
|
||||
{ id: 'whatsapp', label: 'WhatsApp' },
|
||||
{ id: 'office', label: 'AI Office' },
|
||||
]);
|
||||
|
||||
function WeixinLogo() {
|
||||
|
|
@ -101,6 +106,11 @@ function WhatsappLogo() {
|
|||
h(WhatsappLogoGlyph));
|
||||
}
|
||||
|
||||
function OfficeLogo() {
|
||||
return h('span', { className: 'dim-logo dim-logoOffice', 'aria-hidden': 'true' },
|
||||
h(OfficeLogoGlyph));
|
||||
}
|
||||
|
||||
function ChannelLogo({ channel }) {
|
||||
if (channel === 'weixin') return h(WeixinLogo);
|
||||
if (channel === 'feishu') return h(FeishuLogo);
|
||||
|
|
@ -110,7 +120,8 @@ function ChannelLogo({ channel }) {
|
|||
if (channel === 'slack') return h(SlackLogo);
|
||||
if (channel === 'telegram') return h(TelegramLogo);
|
||||
if (channel === 'discord') return h(DiscordLogo);
|
||||
return h(WhatsappLogo);
|
||||
if (channel === 'whatsapp') return h(WhatsappLogo);
|
||||
return h(OfficeLogo);
|
||||
}
|
||||
|
||||
export function IMSettingsTab({
|
||||
|
|
@ -123,6 +134,7 @@ export function IMSettingsTab({
|
|||
wecomRpcCall,
|
||||
weixinRpcCall,
|
||||
whatsappRpcCall,
|
||||
officeRpcCall,
|
||||
workspaceDirectoryPicker,
|
||||
}) {
|
||||
const [selected, setSelected] = React.useState('weixin');
|
||||
|
|
@ -195,7 +207,9 @@ export function IMSettingsTab({
|
|||
? h(TelegramSettingsTab, { rpcCall: telegramRpcCall })
|
||||
: active.id === 'discord'
|
||||
? h(DiscordSettingsTab, { rpcCall: discordRpcCall })
|
||||
: h(WhatsappSettingsTab, { rpcCall: whatsappRpcCall })),
|
||||
: active.id === 'whatsapp'
|
||||
? h(WhatsappSettingsTab, { rpcCall: whatsappRpcCall })
|
||||
: h(OfficeSettingsTab, { rpcCall: officeRpcCall })),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
|
@ -218,6 +232,7 @@ export function apply(ctx) {
|
|||
installTelegramStyles(),
|
||||
installDiscordStyles(),
|
||||
installWhatsappStyles(),
|
||||
installOfficeStyles(),
|
||||
installImStyles(),
|
||||
];
|
||||
return () => {
|
||||
|
|
@ -243,6 +258,8 @@ export function apply(ctx) {
|
|||
ctx.connection.rpc.call(WHATSAPP_RPC_CHANNEL, endpoint, payload, signal);
|
||||
const slackRpcCall = (endpoint, payload, signal) =>
|
||||
ctx.connection.rpc.call(SLACK_RPC_CHANNEL, endpoint, payload, signal);
|
||||
const officeRpcCall = (endpoint, payload, signal) =>
|
||||
ctx.connection.rpc.call(OFFICE_RPC_CHANNEL, endpoint, payload, signal);
|
||||
const workspaceDirectoryPicker = Object.freeze({
|
||||
listDirectory: (path, signal) => ctx.workspaces.listDirectory(path, signal),
|
||||
pickDirectory: () => ctx.workspaces.pickDirectory(),
|
||||
|
|
@ -264,6 +281,7 @@ export function apply(ctx) {
|
|||
wecomRpcCall,
|
||||
weixinRpcCall,
|
||||
whatsappRpcCall,
|
||||
officeRpcCall,
|
||||
workspaceDirectoryPicker,
|
||||
}),
|
||||
}, IMSettingsTab));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue