mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-14 07:20:46 +08:00
Add WeCom QR bot channel
This commit is contained in:
parent
601271a7f8
commit
4874d3e354
33 changed files with 5200 additions and 440 deletions
29
plugin-src/host/channels/wecom/index.mjs
Normal file
29
plugin-src/host/channels/wecom/index.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { createProductionController } from './production.mjs';
|
||||
import { installWecomRpc } from './rpc.mjs';
|
||||
|
||||
export const name = 'dsh-im-wecom-host';
|
||||
export const inject = ['connection', 'credentials', 'webServer'];
|
||||
|
||||
export async function apply(ctx, config = {}) {
|
||||
if (config?.controller) return installWecomRpc(ctx, config.controller, config.rpcOptions);
|
||||
const production = await createProductionController(ctx, config, config.internals);
|
||||
const disposeRpc = installWecomRpc(ctx, production.controller, config.rpcOptions);
|
||||
ctx.effect(() => async () => production.close(), 'dsh-im: close Enterprise WeChat bot connections');
|
||||
return disposeRpc;
|
||||
}
|
||||
|
||||
export function createWecomHostPlugin(config) {
|
||||
return Object.freeze({ name, inject, apply: (ctx) => apply(ctx, config) });
|
||||
}
|
||||
|
||||
export { createConnectionSupervisor, ConnectionSupervisor } from './connection-supervisor.mjs';
|
||||
export { createProductionController } from './production.mjs';
|
||||
export {
|
||||
WECOM_ENDPOINTS,
|
||||
WECOM_RPC_CHANNEL,
|
||||
WECOM_RPC_ENDPOINTS,
|
||||
createWecomRpcHandler,
|
||||
installWecomRpc,
|
||||
} from './rpc.mjs';
|
||||
export { WecomController } from '../../../../src/channels/wecom/wecom-controller.mjs';
|
||||
export { WecomRuntime } from '../../../../src/channels/wecom/wecom-runtime.mjs';
|
||||
Loading…
Add table
Add a link
Reference in a new issue