mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-15 15:20:45 +08:00
Internalize all IM channel implementations
This commit is contained in:
parent
8996476693
commit
bd469f58f8
95 changed files with 25012 additions and 100 deletions
32
plugin-src/host/channels/weixin/index.mjs
Normal file
32
plugin-src/host/channels/weixin/index.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { createProductionController } from './production.mjs';
|
||||
import { installWeixinRpc } from './rpc.mjs';
|
||||
|
||||
export const name = 'dsh-weixin-host';
|
||||
export const inject = ['connection', 'credentials', 'webServer'];
|
||||
|
||||
export async function apply(ctx, config = {}) {
|
||||
if (config?.controller) return installWeixinRpc(ctx, config.controller, config.rpcOptions);
|
||||
|
||||
const production = await createProductionController(ctx, config, config.internals);
|
||||
const disposeRpc = installWeixinRpc(ctx, production.controller, config.rpcOptions);
|
||||
ctx.effect(() => async () => {
|
||||
await production.close();
|
||||
}, 'dsh-weixin: close account connections');
|
||||
return disposeRpc;
|
||||
}
|
||||
|
||||
export function createWeixinHostPlugin(config) {
|
||||
return Object.freeze({ name, inject, apply: (ctx) => apply(ctx, config) });
|
||||
}
|
||||
|
||||
export { createConnectionSupervisor, ConnectionSupervisor } from './connection-supervisor.mjs';
|
||||
export { createProductionController } from './production.mjs';
|
||||
export {
|
||||
WEIXIN_ENDPOINTS,
|
||||
WEIXIN_RPC_CHANNEL,
|
||||
WEIXIN_RPC_ENDPOINTS,
|
||||
createWeixinRpcHandler,
|
||||
installWeixinRpc,
|
||||
} from './rpc.mjs';
|
||||
export { WeixinController } from '../../../../src/channels/weixin/weixin-controller.mjs';
|
||||
export { WeixinRuntime } from '../../../../src/channels/weixin/weixin-runtime.mjs';
|
||||
Loading…
Add table
Add a link
Reference in a new issue