secure-upload-fastify-sdk 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -7
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +2 -7
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +2 -7
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/routes/multipart.d.ts.map +1 -1
- package/dist/server/types.d.ts +2 -0
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -965,10 +965,6 @@ async function resolveSession(req, isPublic, validate) {
|
|
|
965
965
|
const sessionKey = session ?? "anonymous";
|
|
966
966
|
return { userId: userId ?? null, sessionKey };
|
|
967
967
|
}
|
|
968
|
-
function resolveSessionKey(req) {
|
|
969
|
-
const sr = req.secureRequest;
|
|
970
|
-
return sr?.session ?? req.headers["x-secure-session"] ?? "anonymous";
|
|
971
|
-
}
|
|
972
968
|
async function resolveUserId(req, isPublic, validate) {
|
|
973
969
|
const sr = req.secureRequest;
|
|
974
970
|
const session = sr?.session ?? req.headers["x-secure-session"];
|
|
@@ -1310,8 +1306,7 @@ async function registerMultipartRoutes(app, rt) {
|
|
|
1310
1306
|
);
|
|
1311
1307
|
}
|
|
1312
1308
|
const { uploadId, partNumber, partHash } = resolvePartBiz(req);
|
|
1313
|
-
const
|
|
1314
|
-
const rlKey = `rl:mp:part:${sessionKey.slice(0, 64)}`;
|
|
1309
|
+
const rlKey = `rl:mp:part:${uploadId}`;
|
|
1315
1310
|
const rl = await rateLimit(rt, rlKey, 6e4, rt.config.partRateLimit);
|
|
1316
1311
|
if (!rl.ok) {
|
|
1317
1312
|
throw new SecureError(
|
|
@@ -1976,7 +1971,7 @@ async function secureUploadPluginImpl(app, options) {
|
|
|
1976
1971
|
initRateLimit: options.rateLimit?.initPerMin ?? DEFAULTS.initRateLimit,
|
|
1977
1972
|
partRateLimit: options.rateLimit?.partPerMin ?? DEFAULTS.partRateLimit,
|
|
1978
1973
|
smartMaxFiles: options.rateLimit?.smartMaxFilesPerInit ?? DEFAULTS.smartMaxFiles,
|
|
1979
|
-
smartInitRateLimit: DEFAULTS.smartInitRateLimit,
|
|
1974
|
+
smartInitRateLimit: options.rateLimit?.smartInitRateLimit ?? DEFAULTS.smartInitRateLimit,
|
|
1980
1975
|
multipartPath: options.pathPrefix?.multipart ?? DEFAULTS.multipartPath,
|
|
1981
1976
|
smartPath: options.pathPrefix?.smart ?? DEFAULTS.smartPath,
|
|
1982
1977
|
fileUrlPrefix: options.fileUrlPrefix ?? DEFAULTS.fileUrlPrefix,
|