aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workers/crawlerWorker.ts
diff options
context:
space:
mode:
author玄猫 <hanguofeng@gmail.com>2025-01-19 20:34:42 +0800
committerGitHub <noreply@github.com>2025-01-19 12:34:42 +0000
commitb9cce5d12baa40deb21ab4f36be19e3a41e18ad4 (patch)
treef4ec46c026c35ec2c70393b92f52b87e468746ef /apps/workers/crawlerWorker.ts
parentb323573047dee4c358f513fbb9b50174e9e98a99 (diff)
downloadkarakeep-b9cce5d12baa40deb21ab4f36be19e3a41e18ad4.tar.zst
feat(webhook): Implement webhook functionality for bookmark events (#852)
* feat(webhook): Implement webhook functionality for bookmark events - Added WebhookWorker to handle webhook requests. - Integrated webhook triggering in crawlerWorker after video processing. - Updated main worker initialization to include WebhookWorker. - Enhanced configuration to support webhook URLs, token, and timeout. - Documented webhook configuration options in the documentation. - Introduced zWebhookRequestSchema for validating webhook requests. * feat(webhook): Update webhook handling and configuration - Changed webhook operation type from "create" to "crawled" in crawlerWorker and documentation. - Enhanced webhook retry logic in WebhookWorker to support multiple attempts. - Updated Docker configuration to include new webhook environment variables. - Improved validation for webhook configuration in shared config. - Adjusted zWebhookRequestSchema to reflect the new operation type. - Updated documentation to clarify webhook configuration options and usage. * minor modifications --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
Diffstat (limited to 'apps/workers/crawlerWorker.ts')
-rw-r--r--apps/workers/crawlerWorker.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/workers/crawlerWorker.ts b/apps/workers/crawlerWorker.ts
index 16b1f4ae..9666299d 100644
--- a/apps/workers/crawlerWorker.ts
+++ b/apps/workers/crawlerWorker.ts
@@ -55,6 +55,7 @@ import {
OpenAIQueue,
triggerSearchReindex,
triggerVideoWorker,
+ triggerWebhookWorker,
zCrawlLinkRequestSchema,
} from "@hoarder/shared/queues";
import { BookmarkTypes } from "@hoarder/shared/types/bookmarks";
@@ -770,6 +771,9 @@ async function runCrawler(job: DequeuedJob<ZCrawlLinkRequest>) {
// Trigger a potential download of a video from the URL
await triggerVideoWorker(bookmarkId, url);
+ // Trigger a webhook
+ await triggerWebhookWorker(bookmarkId, "crawled");
+
// Do the archival as a separate last step as it has the potential for failure
await archivalLogic();
}