"use client"; import { useEffect, useState } from "react"; import PropTypes from "prop-types"; import Card from "./Card"; import Select from "./Select"; import Badge from "./Badge"; const NONE_PROXY_POOL_VALUE = "__none__"; export default function NoAuthProxyCard({ providerId }) { const [proxyPools, setProxyPools] = useState([]); const [proxyPoolId, setProxyPoolId] = useState(NONE_PROXY_POOL_VALUE); const [saving, setSaving] = useState(false); const [savedFlash, setSavedFlash] = useState(false); useEffect(() => { let cancelled = false; Promise.all([ fetch("/api/proxy-pools?isActive=true", { cache: "no-store" }).then((r) => r.ok ? r.json() : { proxyPools: [] }), fetch("/api/settings", { cache: "no-store" }).then((r) => r.ok ? r.json() : {}), ]).then(([poolData, settingsData]) => { if (cancelled) return; setProxyPools(poolData.proxyPools || []); const override = (settingsData.providerStrategies || {})[providerId] || {}; setProxyPoolId(override.proxyPoolId || NONE_PROXY_POOL_VALUE); }).catch(() => {}); return () => { cancelled = true; }; }, [providerId]); const handleChange = async (newValue) => { setProxyPoolId(newValue); setSaving(true); try { const res = await fetch("/api/settings", { cache: "no-store" }); const data = res.ok ? await res.json() : {}; const current = data.providerStrategies || {}; const override = { ...(current[providerId] || {}) }; if (newValue === NONE_PROXY_POOL_VALUE) delete override.proxyPoolId; else override.proxyPoolId = newValue; const updated = { ...current }; if (Object.keys(override).length === 0) delete updated[providerId]; else updated[providerId] = override; await fetch("/api/settings", { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ providerStrategies: updated }), }); setSavedFlash(true); setTimeout(() => setSavedFlash(false), 1500); } catch (e) { console.log("Save proxyPoolId error:", e); } finally { setSaving(false); } }; return (
lock_open

No authentication required

This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits.

{savedFlash && Saved}