This commit is contained in:
tamaina
2023-02-12 14:37:37 +00:00
parent f4a180907c
commit 709ca51b6c
7 changed files with 52 additions and 15 deletions

View File

@ -28,8 +28,8 @@ export async function scpaping(url, opts) {
},
typeFilter: /^(text\/html|application\/xhtml\+xml)/,
});
// テスト用
const allowPrivateIp = process.env.SUMMALY_ALLOW_PRIVATE_IP === 'true';
// SUMMALY_ALLOW_PRIVATE_IPはテスト用
const allowPrivateIp = process.env.SUMMALY_ALLOW_PRIVATE_IP === 'true' || Object.keys(agent).length > 0;
if (!allowPrivateIp && response.ip && PrivateIp(response.ip)) {
throw new StatusError(`Private IP rejected ${response.ip}`, 400, 'Private IP Rejected');
}

View File

@ -1,4 +1,5 @@
export declare class StatusError extends Error {
name: string;
statusCode: number;
statusMessage?: string;
isPermanentError: boolean;