mktcms 0.1.29 → 0.1.30

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mktcms",
3
3
  "configKey": "mktcms",
4
- "version": "0.1.29",
4
+ "version": "0.1.30",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -98,7 +98,7 @@ onMounted(() => {
98
98
  ref="fileInput"
99
99
  class="hidden"
100
100
  type="file"
101
- accept=".pdf,.jpg,.jpeg,.png,.gif,.svg,.webp,.md,.docx,.txt"
101
+ accept=".pdf,.jpg,.jpeg,.png,.gif,.svg,.webp,.md,.docx,.txt,.csv,.json"
102
102
  @change="async (e) => {
103
103
  await uploadFiles(e);
104
104
  }"
@@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => {
11
11
  const { mktcms: { s3Prefix } } = useRuntimeConfig();
12
12
  const fullPath = s3Prefix + ":" + decodedPath;
13
13
  const storage = useStorage("content");
14
- const file = await storage.getItemRaw(fullPath);
14
+ const file = await storage.getItem(fullPath);
15
15
  if (!file) {
16
16
  throw createError({
17
17
  statusCode: 404,
@@ -11,12 +11,12 @@ export default defineEventHandler(async (event) => {
11
11
  const { mktcms: { s3Prefix } } = useRuntimeConfig();
12
12
  const fullPath = s3Prefix + ":" + decodedPath;
13
13
  const storage = useStorage("content");
14
- const file = await storage.getItemRaw(fullPath);
14
+ const file = await storage.getItem(fullPath);
15
15
  if (!file) {
16
16
  throw createError({
17
17
  statusCode: 404,
18
18
  statusMessage: "File not found"
19
19
  });
20
20
  }
21
- return parseFrontmatter(file.toString("utf-8"));
21
+ return parseFrontmatter(file);
22
22
  });
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string>>;
2
2
  export default _default;
@@ -10,12 +10,12 @@ export default defineEventHandler(async (event) => {
10
10
  const { mktcms: { s3Prefix } } = useRuntimeConfig();
11
11
  const fullPath = s3Prefix + ":" + decodedPath;
12
12
  const storage = useStorage("content");
13
- const file = await storage.getItemRaw(fullPath);
13
+ const file = await storage.getItem(fullPath);
14
14
  if (!file) {
15
15
  throw createError({
16
16
  statusCode: 404,
17
17
  statusMessage: "File not found"
18
18
  });
19
19
  }
20
- return file.toString("utf-8");
20
+ return file;
21
21
  });
@@ -31,12 +31,12 @@ export default defineEventHandler(async (event) => {
31
31
  statusMessage: "Invalid file upload"
32
32
  });
33
33
  }
34
- const allowedExtensions = [".pdf", ".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".md", ".docx", ".txt"];
34
+ const allowedExtensions = [".pdf", ".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".md", ".docx", ".txt", ".csv", ".json"];
35
35
  const fileExtension = file.filename.toLowerCase().slice(file.filename.lastIndexOf("."));
36
36
  if (!allowedExtensions.includes(fileExtension)) {
37
37
  throw createError({
38
38
  statusCode: 400,
39
- statusMessage: "Invalid file type. Only PDF, JPG, JPEG, and PNG files are allowed."
39
+ statusMessage: "Invalid file type. Only PDF, JPG, JPEG, PNG, GIF, SVG, WEBP, MD, DOCX, TXT, CSV, and JSON files are allowed."
40
40
  });
41
41
  }
42
42
  const filePath = [s3Prefix, sanePath, sanitizeFilename(file.filename)].filter(Boolean).join(":");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mktcms",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "Simple CMS module for Nuxt",
5
5
  "repository": "mktcode/mktcms",
6
6
  "license": "MIT",