mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:28:26 +00:00
chore: remove verified dead code paths
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
|
||||
export type LineHttpRequestHandler = (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
) => Promise<void> | void;
|
||||
|
||||
type RegisterLineHttpHandlerArgs = {
|
||||
path?: string | null;
|
||||
handler: LineHttpRequestHandler;
|
||||
log?: (message: string) => void;
|
||||
accountId?: string;
|
||||
};
|
||||
|
||||
const lineHttpRoutes = new Map<string, LineHttpRequestHandler>();
|
||||
|
||||
export function normalizeLineWebhookPath(path?: string | null): string {
|
||||
const trimmed = path?.trim();
|
||||
if (!trimmed) {
|
||||
return "/line/webhook";
|
||||
}
|
||||
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
||||
}
|
||||
|
||||
export function registerLineHttpHandler(params: RegisterLineHttpHandlerArgs): () => void {
|
||||
const normalizedPath = normalizeLineWebhookPath(params.path);
|
||||
if (lineHttpRoutes.has(normalizedPath)) {
|
||||
const suffix = params.accountId ? ` for account "${params.accountId}"` : "";
|
||||
params.log?.(`line: webhook path ${normalizedPath} already registered${suffix}`);
|
||||
return () => {};
|
||||
}
|
||||
lineHttpRoutes.set(normalizedPath, params.handler);
|
||||
return () => {
|
||||
lineHttpRoutes.delete(normalizedPath);
|
||||
};
|
||||
}
|
||||
|
||||
export async function handleLineHttpRequest(
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
): Promise<boolean> {
|
||||
const url = new URL(req.url ?? "/", "http://localhost");
|
||||
const handler = lineHttpRoutes.get(url.pathname);
|
||||
if (!handler) {
|
||||
return false;
|
||||
}
|
||||
await handler(req, res);
|
||||
return true;
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
export {
|
||||
createLineBot,
|
||||
createLineWebhookCallback,
|
||||
type LineBot,
|
||||
type LineBotOptions,
|
||||
} from "./bot.js";
|
||||
export {
|
||||
monitorLineProvider,
|
||||
getLineRuntimeState,
|
||||
type MonitorLineProviderOptions,
|
||||
type LineProviderMonitor,
|
||||
} from "./monitor.js";
|
||||
export {
|
||||
sendMessageLine,
|
||||
pushMessageLine,
|
||||
pushMessagesLine,
|
||||
replyMessageLine,
|
||||
createImageMessage,
|
||||
createLocationMessage,
|
||||
createFlexMessage,
|
||||
createQuickReplyItems,
|
||||
createTextMessageWithQuickReplies,
|
||||
showLoadingAnimation,
|
||||
getUserProfile,
|
||||
getUserDisplayName,
|
||||
pushImageMessage,
|
||||
pushLocationMessage,
|
||||
pushFlexMessage,
|
||||
pushTemplateMessage,
|
||||
pushTextMessageWithQuickReplies,
|
||||
} from "./send.js";
|
||||
export {
|
||||
startLineWebhook,
|
||||
createLineWebhookMiddleware,
|
||||
type LineWebhookOptions,
|
||||
type StartLineWebhookOptions,
|
||||
} from "./webhook.js";
|
||||
export {
|
||||
handleLineHttpRequest,
|
||||
registerLineHttpHandler,
|
||||
normalizeLineWebhookPath,
|
||||
} from "./http-registry.js";
|
||||
export {
|
||||
resolveLineAccount,
|
||||
listLineAccountIds,
|
||||
resolveDefaultLineAccountId,
|
||||
normalizeAccountId,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
} from "./accounts.js";
|
||||
export { probeLineBot } from "./probe.js";
|
||||
export { downloadLineMedia } from "./download.js";
|
||||
export { LineConfigSchema, type LineConfigSchemaType } from "./config-schema.js";
|
||||
export { buildLineMessageContext } from "./bot-message-context.js";
|
||||
export { handleLineWebhookEvents, type LineHandlerContext } from "./bot-handlers.js";
|
||||
|
||||
// Flex Message templates
|
||||
export {
|
||||
createInfoCard,
|
||||
createListCard,
|
||||
createImageCard,
|
||||
createActionCard,
|
||||
createCarousel,
|
||||
createNotificationBubble,
|
||||
createReceiptCard,
|
||||
createEventCard,
|
||||
createMediaPlayerCard,
|
||||
createAppleTvRemoteCard,
|
||||
createDeviceControlCard,
|
||||
toFlexMessage,
|
||||
type ListItem,
|
||||
type CardAction,
|
||||
type FlexContainer,
|
||||
type FlexBubble,
|
||||
type FlexCarousel,
|
||||
} from "./flex-templates.js";
|
||||
|
||||
// Markdown to LINE conversion
|
||||
export {
|
||||
processLineMessage,
|
||||
hasMarkdownToConvert,
|
||||
stripMarkdown,
|
||||
extractMarkdownTables,
|
||||
extractCodeBlocks,
|
||||
extractLinks,
|
||||
convertTableToFlexBubble,
|
||||
convertCodeBlockToFlexBubble,
|
||||
convertLinksToFlexBubble,
|
||||
type ProcessedLineMessage,
|
||||
type MarkdownTable,
|
||||
type CodeBlock,
|
||||
type MarkdownLink,
|
||||
} from "./markdown-to-line.js";
|
||||
|
||||
// Rich Menu operations
|
||||
export {
|
||||
createRichMenu,
|
||||
uploadRichMenuImage,
|
||||
setDefaultRichMenu,
|
||||
cancelDefaultRichMenu,
|
||||
getDefaultRichMenuId,
|
||||
linkRichMenuToUser,
|
||||
linkRichMenuToUsers,
|
||||
unlinkRichMenuFromUser,
|
||||
unlinkRichMenuFromUsers,
|
||||
getRichMenuIdOfUser,
|
||||
getRichMenuList,
|
||||
getRichMenu,
|
||||
deleteRichMenu,
|
||||
createRichMenuAlias,
|
||||
deleteRichMenuAlias,
|
||||
createGridLayout,
|
||||
messageAction,
|
||||
uriAction,
|
||||
postbackAction,
|
||||
datetimePickerAction,
|
||||
createDefaultMenuConfig,
|
||||
type CreateRichMenuParams,
|
||||
type RichMenuSize,
|
||||
type RichMenuAreaRequest,
|
||||
} from "./rich-menu.js";
|
||||
|
||||
// Template messages (Button, Confirm, Carousel)
|
||||
export {
|
||||
createConfirmTemplate,
|
||||
createButtonTemplate,
|
||||
createTemplateCarousel,
|
||||
createCarouselColumn,
|
||||
createImageCarousel,
|
||||
createImageCarouselColumn,
|
||||
createYesNoConfirm,
|
||||
createButtonMenu,
|
||||
createLinkMenu,
|
||||
createProductCarousel,
|
||||
messageAction as templateMessageAction,
|
||||
uriAction as templateUriAction,
|
||||
postbackAction as templatePostbackAction,
|
||||
datetimePickerAction as templateDatetimePickerAction,
|
||||
type TemplateMessage,
|
||||
type ConfirmTemplate,
|
||||
type ButtonsTemplate,
|
||||
type CarouselTemplate,
|
||||
type CarouselColumn,
|
||||
} from "./template-messages.js";
|
||||
|
||||
export type {
|
||||
LineConfig,
|
||||
LineAccountConfig,
|
||||
LineGroupConfig,
|
||||
ResolvedLineAccount,
|
||||
LineTokenSource,
|
||||
LineMessageType,
|
||||
LineWebhookContext,
|
||||
LineSendResult,
|
||||
LineProbeResult,
|
||||
} from "./types.js";
|
||||
Reference in New Issue
Block a user