Files
jina-ai--reader/src/3rd-party/cloud-flare.ts
T
wehub-resource-sync f1ba9c6c36
/ test (push) Failing after 1s
/ build-and-push-to-ghcr (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:23:39 +08:00

23 lines
752 B
TypeScript

import { HTTPService } from 'civkit/http';
import _ from 'lodash';
export class CloudFlareHTTP extends HTTPService {
name = 'CloudFlare';
constructor(public accountId: string, public apiToken: string) {
super(`https://api.cloudflare.com/client/v4/accounts/${accountId}`);
this.baseHeaders['Authorization'] = `Bearer ${apiToken}`;
this.baseOptions.timeout = 1000 * 60 * 30 * 0.5;
}
fetchBrowserRenderedHTML(input: {
url: string;
rejectResourceTypes?: string[];
rejectRequestPattern?: string[];
}, opts?: typeof this['baseOptions']) {
return this.postJson<{ success: true; result: string; }>('/browser-rendering/content', input, { responseType: 'json', ...opts });
}
}