mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(proxy): ignore null Proxifly API entries
This commit is contained in:
@@ -97,7 +97,7 @@ export class ProxiflyProvider implements FreeProxyProvider {
|
||||
requested += proxies.length;
|
||||
|
||||
for (const p of proxies) {
|
||||
if (!p.ip || !p.port) continue;
|
||||
if (!p || !p.ip || !p.port) continue;
|
||||
if (isPrivateHost(p.ip)) {
|
||||
errors.push(`Proxifly: skipped private/loopback host ${p.ip}`);
|
||||
continue;
|
||||
|
||||
@@ -181,6 +181,9 @@ test("ProxiflyProvider.sync fetches proxies in API-sized batches", async () => {
|
||||
score: 50 + index,
|
||||
geolocation: { country: "US" },
|
||||
}));
|
||||
if (batchIndex === 0) {
|
||||
body[0] = null as unknown as (typeof body)[number];
|
||||
}
|
||||
|
||||
return new Response(JSON.stringify(body), {
|
||||
status: 200,
|
||||
@@ -193,13 +196,13 @@ test("ProxiflyProvider.sync fetches proxies in API-sized batches", async () => {
|
||||
const result = await p.sync();
|
||||
|
||||
assert.deepEqual(requestedQuantities, ["20", "5"]);
|
||||
assert.equal(result.fetched, 25);
|
||||
assert.equal(result.added, 25);
|
||||
assert.equal(result.fetched, 24);
|
||||
assert.equal(result.added, 24);
|
||||
assert.equal(result.updated, 0);
|
||||
assert.deepEqual(result.errors, []);
|
||||
|
||||
const items = await p.list({ limit: 30 });
|
||||
assert.equal(items.length, 25);
|
||||
assert.equal(items.length, 24);
|
||||
assert.ok(items.every((item) => item.source === "proxifly"));
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
|
||||
Reference in New Issue
Block a user