@muhgholy/next-drive 4.17.1 → 4.18.0
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/README.md +23 -8
- package/dist/{chunk-QUBHH4G4.js → chunk-FWX344WM.js} +9 -8
- package/dist/chunk-FWX344WM.js.map +1 -0
- package/dist/{chunk-ZYDFFRK3.cjs → chunk-TBBX3C6E.cjs} +9 -8
- package/dist/chunk-TBBX3C6E.cjs.map +1 -0
- package/dist/server/config.d.ts +2 -3
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/controllers/drive.d.ts.map +1 -1
- package/dist/server/express.cjs +11 -11
- package/dist/server/express.js +2 -2
- package/dist/server/index.cjs +13 -13
- package/dist/server/index.js +1 -1
- package/dist/types/server/config.d.ts +9 -2
- package/dist/types/server/config.d.ts.map +1 -1
- package/dist/types/server/express.d.ts +1 -1
- package/dist/types/server/express.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-QUBHH4G4.js.map +0 -1
- package/dist/chunk-ZYDFFRK3.cjs.map +0 -1
|
@@ -321,19 +321,19 @@ var getDriveConfig = () => {
|
|
|
321
321
|
if (!g.config) throw new Error("Drive configuration not initialized");
|
|
322
322
|
return g.config;
|
|
323
323
|
};
|
|
324
|
-
var getDriveInformation = async (
|
|
324
|
+
var getDriveInformation = async (input) => {
|
|
325
325
|
const config = getDriveConfig();
|
|
326
326
|
if (config.mode === "ROOT") {
|
|
327
327
|
if (!config.information) {
|
|
328
328
|
return {
|
|
329
|
-
key: null,
|
|
329
|
+
key: input.method === "KEY" ? input.key : null,
|
|
330
330
|
storage: { quotaInBytes: Number.MAX_SAFE_INTEGER }
|
|
331
331
|
// Unlimited quota in ROOT mode
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
return config.information(
|
|
334
|
+
return config.information(input);
|
|
335
335
|
}
|
|
336
|
-
return config.information(
|
|
336
|
+
return config.information(input);
|
|
337
337
|
};
|
|
338
338
|
var StorageAccountSchema = new mongoose.Schema(
|
|
339
339
|
{
|
|
@@ -1620,7 +1620,8 @@ var driveUpload = async (source, key, options) => {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
const isRootMode = config.mode === "ROOT";
|
|
1622
1622
|
if (!options.enforce && !isRootMode) {
|
|
1623
|
-
const
|
|
1623
|
+
const information = await getDriveInformation({ method: "KEY", key });
|
|
1624
|
+
const quota = await provider.getQuota(key, accountId, information.storage.quotaInBytes);
|
|
1624
1625
|
if (quota.usedInBytes + fileSize > quota.quotaInBytes) {
|
|
1625
1626
|
throw new Error("Storage quota exceeded");
|
|
1626
1627
|
}
|
|
@@ -1894,7 +1895,7 @@ var driveAPIHandler = async (req, res) => {
|
|
|
1894
1895
|
}
|
|
1895
1896
|
try {
|
|
1896
1897
|
const mode = config.mode || "NORMAL";
|
|
1897
|
-
const information = await getDriveInformation(req);
|
|
1898
|
+
const information = await getDriveInformation({ method: "REQUEST", req });
|
|
1898
1899
|
const { key: owner } = information;
|
|
1899
1900
|
const STORAGE_PATH = config.storage.path;
|
|
1900
1901
|
const isRootMode = mode === "ROOT";
|
|
@@ -2425,5 +2426,5 @@ exports.driveReadFile = driveReadFile;
|
|
|
2425
2426
|
exports.driveUpload = driveUpload;
|
|
2426
2427
|
exports.getDriveConfig = getDriveConfig;
|
|
2427
2428
|
exports.getDriveInformation = getDriveInformation;
|
|
2428
|
-
//# sourceMappingURL=chunk-
|
|
2429
|
-
//# sourceMappingURL=chunk-
|
|
2429
|
+
//# sourceMappingURL=chunk-TBBX3C6E.cjs.map
|
|
2430
|
+
//# sourceMappingURL=chunk-TBBX3C6E.cjs.map
|