Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,25 @@
import { URL } from "node:url";
import { getAgentByUrl } from "../../misc/fetch.js";
import { S3Client } from "@aws-sdk/client-s3";
import { NodeHttpHandler } from "@smithy/node-http-handler";
export function getS3(meta) {
const endpointPrefixed = meta.objectStorageEndpoint && (meta.objectStorageEndpoint.startsWith("http://") || meta.objectStorageEndpoint.startsWith("https://"));
const endpoint = meta.objectStorageEndpoint ? endpointPrefixed ? meta.objectStorageEndpoint : `${meta.objectStorageUseSSL ? "https://" : "http://"}${meta.objectStorageEndpoint}` : undefined;
const agentUrl = new URL(endpoint);
const agent = getAgentByUrl(agentUrl, !meta.objectStorageUseProxy);
return new S3Client({
endpoint,
region: meta.objectStorageRegion || "us-east-1",
credentials: {
accessKeyId: meta.objectStorageAccessKey,
secretAccessKey: meta.objectStorageSecretKey
},
forcePathStyle: meta.objectStorageEndpoint ? meta.objectStorageS3ForcePathStyle : false,
requestChecksumCalculation: "WHEN_REQUIRED",
responseChecksumValidation: "WHEN_REQUIRED",
requestHandler: new NodeHttpHandler({
httpAgent: agent,
httpsAgent: agent
})
});
}