@adminforth/storage-adapter-local 1.0.2 → 1.0.3
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 +3 -0
- package/index.ts +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,9 @@ import { Level } from 'level';
|
|
|
15
15
|
class AdminForthStorageAdapterLocalFilesystem {
|
|
16
16
|
constructor(options) {
|
|
17
17
|
this.options = options;
|
|
18
|
+
if (!this.options.mode) {
|
|
19
|
+
this.options.mode = "private";
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
presignUrl(urlPath, expiresIn, payload = {}) {
|
|
20
23
|
const expires = Math.floor(Date.now() / 1000) + expiresIn;
|
package/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare global {
|
|
|
12
12
|
|
|
13
13
|
interface StorageLocalFilesystemOptions {
|
|
14
14
|
fileSystemFolder: string; // folder where files will be stored
|
|
15
|
-
mode
|
|
15
|
+
mode?: "public" | "private"; // public if all files should be accessible from the web, private only if could be accessed by temporary presigned links
|
|
16
16
|
signingSecret: string; // secret used to generate presigned URLs
|
|
17
17
|
adminServeBaseUrl?: string; // base URL for serving files e.g. static/uploads. If not defined will be generated automatically
|
|
18
18
|
// please note that is adminforth base URL is set, files will be available on `${adminforth.config.baseUrl}/${adminServeBaseUrl}/{key}`
|
|
@@ -30,6 +30,9 @@ export default class AdminForthStorageAdapterLocalFilesystem implements StorageA
|
|
|
30
30
|
|
|
31
31
|
constructor(options: StorageLocalFilesystemOptions) {
|
|
32
32
|
this.options = options;
|
|
33
|
+
if (!this.options.mode) {
|
|
34
|
+
this.options.mode = "private";
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
presignUrl(urlPath: string, expiresIn: number, payload: Record<string, string> = {}): string {
|