mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 03:32:22 +08:00
verification_token -> verificationToken on req and res
This commit is contained in:
parent
91e7eaaf33
commit
1a3d8a8752
|
@ -117,7 +117,7 @@ export async function crawlController(
|
|||
crawl_id: id,
|
||||
sitemapped: true,
|
||||
webhook: req.body.webhook,
|
||||
verification_token: req.body.verification_token,
|
||||
verificationToken: req.body.verificationToken,
|
||||
v1: true,
|
||||
},
|
||||
opts: {
|
||||
|
@ -149,7 +149,7 @@ export async function crawlController(
|
|||
origin: "api",
|
||||
crawl_id: id,
|
||||
webhook: req.body.webhook,
|
||||
verification_token: req.body.verification_token,
|
||||
verificationToken: req.body.verificationToken,
|
||||
v1: true,
|
||||
},
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ export async function crawlController(
|
|||
}
|
||||
|
||||
if(req.body.webhook) {
|
||||
await callWebhook(req.auth.team_id, id, null, req.body.webhook, req.body.verification_token, true, "crawl.started");
|
||||
await callWebhook(req.auth.team_id, id, null, req.body.webhook, req.body.verificationToken, true, "crawl.started");
|
||||
}
|
||||
|
||||
const protocol = process.env.ENV === "local" ? req.protocol : "https";
|
||||
|
|
|
@ -192,7 +192,7 @@ export const crawlRequestSchema = crawlerOptions.extend({
|
|||
origin: z.string().optional().default("api"),
|
||||
scrapeOptions: scrapeOptions.omit({ timeout: true }).default({}),
|
||||
webhook: z.string().url().optional(),
|
||||
verification_token: z
|
||||
verificationToken: z
|
||||
.string()
|
||||
.optional(),
|
||||
limit: z.number().default(10000),
|
||||
|
|
|
@ -329,7 +329,7 @@ async function processJob(job: Job, token: string) {
|
|||
job.id as string,
|
||||
data,
|
||||
job.data.webhook,
|
||||
job.data.verification_token,
|
||||
job.data.verificationToken,
|
||||
job.data.v1,
|
||||
job.data.crawlerOptions !== null ? "crawl.page" : "batch_scrape.page",
|
||||
);
|
||||
|
@ -340,7 +340,7 @@ async function processJob(job: Job, token: string) {
|
|||
job.data.crawl_id,
|
||||
data,
|
||||
job.data.webhook,
|
||||
job.data.verification_token,
|
||||
job.data.verificationToken,
|
||||
job.data.v1,
|
||||
job.data.crawlerOptions !== null ? "crawl.page" : "batch_scrape.page",
|
||||
true
|
||||
|
@ -404,7 +404,7 @@ async function processJob(job: Job, token: string) {
|
|||
origin: job.data.origin,
|
||||
crawl_id: job.data.crawl_id,
|
||||
webhook: job.data.webhook,
|
||||
verification_token: job.data.verification_token,
|
||||
verificationToken: job.data.verificationToken,
|
||||
v1: job.data.v1,
|
||||
},
|
||||
{},
|
||||
|
@ -470,7 +470,7 @@ async function processJob(job: Job, token: string) {
|
|||
job.data.crawl_id,
|
||||
data,
|
||||
job.data.webhook,
|
||||
job.data.verification_token,
|
||||
job.data.verificationToken,
|
||||
job.data.v1,
|
||||
job.data.crawlerOptions !== null ? "crawl.completed" : "batch_scrape.completed"
|
||||
);
|
||||
|
@ -489,7 +489,7 @@ async function processJob(job: Job, token: string) {
|
|||
job.data.crawl_id,
|
||||
[],
|
||||
job.data.webhook,
|
||||
job.data.verification_token,
|
||||
job.data.verificationToken,
|
||||
job.data.v1,
|
||||
job.data.crawlerOptions !== null ? "crawl.completed" : "batch_scrape.completed"
|
||||
);
|
||||
|
@ -560,7 +560,7 @@ async function processJob(job: Job, token: string) {
|
|||
job.data.crawl_id ?? (job.id as string),
|
||||
data,
|
||||
job.data.webhook,
|
||||
job.data.verification_token,
|
||||
job.data.verificationToken,
|
||||
job.data.v1,
|
||||
job.data.crawlerOptions !== null ? "crawl.page" : "batch_scrape.page",
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@ export const callWebhook = async (
|
|||
id: string,
|
||||
data: any | null,
|
||||
specified?: string,
|
||||
verification_token?: string,
|
||||
verificationToken?: string,
|
||||
v1 = false,
|
||||
eventType: WebhookEventType = "crawl.page",
|
||||
awaitWebhook: boolean = false
|
||||
|
@ -24,7 +24,7 @@ export const callWebhook = async (
|
|||
);
|
||||
const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === "true";
|
||||
let webhookUrl = specified ?? selfHostedUrl;
|
||||
verification_token = verification_token ?? process.env.SELF_HOSTED_WEBHOOK_VERIFICATION_TOKEN
|
||||
verificationToken = verificationToken ?? process.env.SELF_HOSTED_WEBHOOK_VERIFICATION_TOKEN
|
||||
|
||||
// Only fetch the webhook URL from the database if the self-hosted webhook URL and specified webhook are not set
|
||||
// and the USE_DB_AUTHENTICATION environment variable is set to true
|
||||
|
@ -79,7 +79,7 @@ export const callWebhook = async (
|
|||
type: eventType,
|
||||
[v1 ? "id" : "jobId"]: id,
|
||||
data: dataToSend,
|
||||
verification_token,
|
||||
verificationToken,
|
||||
error: !v1
|
||||
? data?.error || undefined
|
||||
: eventType === "crawl.page"
|
||||
|
|
|
@ -33,7 +33,7 @@ export interface WebScraperOptions {
|
|||
crawl_id?: string;
|
||||
sitemapped?: boolean;
|
||||
webhook?: string;
|
||||
verification_token?: string,
|
||||
verificationToken?: string,
|
||||
v1?: boolean;
|
||||
is_scrape?: boolean;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ export interface CrawlParams {
|
|||
ignoreSitemap?: boolean;
|
||||
scrapeOptions?: CrawlScrapeOptions;
|
||||
webhook?: string;
|
||||
verification_token?: string;
|
||||
verificationToken?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user