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 +1 -1
- package/dist/runtime/app/components/content/upload.vue +1 -1
- package/dist/runtime/server/api/admin/csv.js +1 -1
- package/dist/runtime/server/api/admin/md.js +2 -2
- package/dist/runtime/server/api/admin/txt.d.ts +1 -1
- package/dist/runtime/server/api/admin/txt.js +2 -2
- package/dist/runtime/server/api/admin/upload.js +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
|
21
|
+
return parseFrontmatter(file);
|
|
22
22
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
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.
|
|
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
|
|
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
|
|
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(":");
|