UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 943 B
import{o as resolveGlobalSingleton}from"./global-singleton-DolL9xGt.mjs"; //!src/plugins/http-legacy-listener.ts const forwardedRequests=resolveGlobalSingleton(Symbol.for(`openclaw.pluginHttpLegacyListenerRequests`),()=>/* @__PURE__ */ new WeakMap);function markPluginHttpLegacyListener(e,t){forwardedRequests.set(e,Object.freeze({port:t.port,...t.host!==void 0?{host:t.host}:{}}))}function getWebhookLegacyListener(e){return forwardedRequests.get(e)}function hasEndpoint(e,t){return e?.some(e=>e.port===t.port&&e.host===t.host)===true}function isLegacyPluginRouteHandoff(e,t){const n=getWebhookLegacyListener(e);return n!==void 0&&hasEndpoint(t.legacyListenerHandoffs,n)}function permitsLegacyPluginRoute(e,t){const n=getWebhookLegacyListener(e);return!n||t.auth===`plugin`&&hasEndpoint(t.legacyListeners,n)}export{permitsLegacyPluginRoute as i,isLegacyPluginRouteHandoff as n,markPluginHttpLegacyListener as r,getWebhookLegacyListener as t};