Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix v2 bulljobs shit
Gergő Móriczf672e542725e
diff --git a/apps/api/src/controllers/v2/batch-scrape.ts b/apps/api/src/controllers/v2/batch-scrape.tsindex aaf18c123..98576dafe 100644--- a/apps/api/src/controllers/v2/batch-scrape.ts+++ b/apps/api/src/controllers/v2/batch-scrape.ts@@ -17,7 +17,6 @@ import {saveCrawl,StoredCrawl,} from "../../lib/crawl-redis";-import { logCrawl } from "../../services/logging/crawl_log";import { getJobPriority } from "../../lib/job-priority";import { addScrapeJobs } from "../../services/queue-jobs";import { callWebhook } from "../../services/webhook";@@ -95,11 +94,7 @@ export async function batchScrapeController(appendToId: req.body.appendToId,account: req.account,});-- if (!req.body.appendToId) {- await logCrawl(id, req.auth.team_id);- }-+const sc: StoredCrawl = req.body.appendToId? ((await getCrawl(req.body.appendToId)) as StoredCrawl): {diff --git a/apps/api/src/controllers/v2/crawl-cancel.ts b/apps/api/src/controllers/v2/crawl-cancel.tsindex 00af8b31f..a74939fb7 100644--- a/apps/api/src/controllers/v2/crawl-cancel.ts+++ b/apps/api/src/controllers/v2/crawl-cancel.ts@@ -1,5 +1,4 @@import { Response } from "express";-import { supabase_service } from "../../services/supabase";import { logger } from "../../lib/logger";import { getCrawl, saveCrawl } from "../../lib/crawl-redis";import * as Sentry from "@sentry/node";@@ -12,27 +11,14 @@ export async function crawlCancelController(res: Response,) {try {- const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === "true";-const sc = await getCrawl(req.params.jobId);if (!sc) {return res.status(404).json({ error: "Job not found" });}// check if the job belongs to the team- if (useDbAuthentication) {- const { data, error: supaError } = await supabase_service- .from("bulljobs_teams")- .select("*")- .eq("job_id", req.params.jobId)- .eq("team_id", req.auth.team_id);- if (supaError) {- return res.status(500).json({ error: supaError.message });- }-- if (data.length === 0) {- return res.status(403).json({ error: "Unauthorized" });- }+ if (sc.team_id !== req.auth.team_id) {+ return res.status(403).json({ error: "Unauthorized" });}try {diff --git a/apps/api/src/controllers/v2/crawl.ts b/apps/api/src/controllers/v2/crawl.tsindex 10b8922dc..52215fe46 100644--- a/apps/api/src/controllers/v2/crawl.ts+++ b/apps/api/src/controllers/v2/crawl.ts@@ -8,7 +8,6 @@ import {toV0CrawlerOptions,} from "./types";import { crawlToCrawler, saveCrawl, StoredCrawl } from "../../lib/crawl-redis";-import { logCrawl } from "../../services/logging/crawl_log";import { _addScrapeJobToBullMQ } from "../../services/queue-jobs";import { logger as _logger } from "../../lib/logger";import { generateCrawlerOptionsFromPrompt } from "../../scraper/scrapeURL/transformers/llmExtract";@@ -45,8 +44,6 @@ export async function crawlController(account: req.account,});- await logCrawl(id, req.auth.team_id);-let { remainingCredits } = req.account!;const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === "true";if (!useDbAuthentication) {