diff --git a/navigation/index.js b/navigation/index.js
index d0d0468..589d097 100644
--- a/navigation/index.js
+++ b/navigation/index.js
@@ -1,82 +1,84 @@
export default [
{
- header: "Utama",
- description: "",
- child: [
+ "header": "Utama",
+ "description": "",
+ "child": [
{
- title: "Dashboard",
- path: "/dashboard",
- icon: "ic:outline-dashboard",
- child: [],
- meta: {},
- },
+ "title": "Dashboard",
+ "path": "/dashboard",
+ "icon": "ic:outline-dashboard",
+ "child": [],
+ "meta": {}
+ }
],
- meta: {},
+ "meta": {}
},
{
- header: "Pentadbiran",
- description: "Urus aplikasi anda",
- child: [
+ "header": "Pentadbiran",
+ "description": "Urus aplikasi anda",
+ "child": [
{
- title: "Konfigurasi",
- icon: "ic:outline-settings",
- child: [
+ "title": "Konfigurasi",
+ "icon": "ic:outline-settings",
+ "child": [
{
- title: "Persekitaran",
- path: "/devtool/config/environment",
- },
- ],
+ "title": "Persekitaran",
+ "path": "/devtool/config/environment"
+ }
+ ]
},
{
- title: "Penyunting Menu",
- icon: "ci:menu-alt-03",
- path: "/devtool/menu-editor",
- child: [],
+ "title": "Penyunting Menu",
+ "icon": "ci:menu-alt-03",
+ "path": "/devtool/menu-editor",
+ "child": []
},
{
- title: "Urus Pengguna",
- path: "/devtool/user-management",
- icon: "ph:user-circle-gear",
- child: [
+ "title": "Urus Pengguna",
+ "path": "/devtool/user-management",
+ "icon": "ph:user-circle-gear",
+ "child": [
{
- title: "Senarai Pengguna",
- path: "/devtool/user-management/user",
- icon: "",
- child: [],
+ "title": "Senarai Pengguna",
+ "path": "/devtool/user-management/user",
+ "icon": "",
+ "child": []
},
{
- title: "Senarai Peranan",
- path: "/devtool/user-management/role",
- icon: "",
- child: [],
- },
- ],
+ "title": "Senarai Peranan",
+ "path": "/devtool/user-management/role",
+ "icon": "",
+ "child": []
+ }
+ ]
},
{
- title: "Kandungan",
- icon: "mdi:pencil-ruler",
- child: [
+ "title": "Kandungan",
+ "icon": "mdi:pencil-ruler",
+ "child": [
{
- title: "Penyunting",
- path: "/devtool/content-editor",
+ "title": "Penyunting",
+ "path": "/devtool/content-editor"
},
{
- title: "Templat",
- path: "/devtool/content-editor/template",
- },
- ],
+ "title": "Templat",
+ "path": "/devtool/content-editor/template"
+ }
+ ]
},
{
- title: "Penyunting API",
- path: "/devtool/api-editor",
- icon: "material-symbols:api-rounded",
- child: [],
- },
+ "title": "Penyunting API",
+ "path": "/devtool/api-editor",
+ "icon": "material-symbols:api-rounded",
+ "child": []
+ }
],
- meta: {
- auth: {
- role: ["Developer"],
- },
- },
- },
-];
+ "meta": {
+ "auth": {
+ "role": [
+ "Developer"
+ ]
+ }
+ }
+ }
+];
\ No newline at end of file
diff --git a/pages/devtool/api-editor/index.vue b/pages/devtool/api-editor/index.vue
index e632c55..de8d722 100644
--- a/pages/devtool/api-editor/index.vue
+++ b/pages/devtool/api-editor/index.vue
@@ -324,4 +324,4 @@ const deleteAPI = async (apiURL) => {
-
+
\ No newline at end of file
diff --git a/pages/devtool/menu-editor/index.vue b/pages/devtool/menu-editor/index.vue
index 9666eee..b27d732 100644
--- a/pages/devtool/menu-editor/index.vue
+++ b/pages/devtool/menu-editor/index.vue
@@ -126,6 +126,16 @@ const openModalEdit = (menu) => {
};
const saveEditMenu = async () => {
+ // Check title regex to ensure no weird symbol only letters, numbers, spaces, underscores and dashes
+ if (!/^[a-zA-Z0-9\s_-]+$/.test(showModalEditForm.value.title)) {
+ nuxtApp.$swal.fire({
+ title: "Error",
+ text: "Title contains invalid characters. Only letters, numbers, spaces, underscores and dashes are allowed.",
+ icon: "error",
+ });
+ return;
+ }
+
// Clean the name and title ensure not spacing at the beginning or end
showModalEditForm.value.title = showModalEditForm.value.title.trim();
showModalEditForm.value.name = showModalEditForm.value.name.trim();
@@ -170,6 +180,16 @@ const openModalAdd = () => {
};
const saveAddMenu = async () => {
+ // Check title regex to ensure no weird symbol only letters, numbers, spaces, underscores and dashes
+ if (!/^[a-zA-Z0-9\s_-]+$/.test(showModalAddForm.value.title)) {
+ nuxtApp.$swal.fire({
+ title: "Error",
+ text: "Title contains invalid characters. Only letters, numbers, spaces, underscores and dashes are allowed.",
+ icon: "error",
+ });
+ return;
+ }
+
// Clean the name and title ensure not spacing at the beginning or end
showModalAddForm.value.title = showModalAddForm.value.title.trim();
showModalAddForm.value.name = showModalAddForm.value.name.trim();
@@ -642,11 +662,9 @@ watch(
@@ -695,11 +713,9 @@ watch(
@@ -742,4 +758,4 @@ watch(
-
+
\ No newline at end of file
diff --git a/server/api/devtool/content/code/linter.js b/server/api/devtool/content/code/linter.js
index 60399ad..85554c0 100644
--- a/server/api/devtool/content/code/linter.js
+++ b/server/api/devtool/content/code/linter.js
@@ -43,6 +43,8 @@ export default defineEventHandler(async (event) => {
"textarea",
"submit",
"button",
+ "mask",
+ "form",
];
// Find all FormKit components
@@ -259,6 +261,28 @@ export default defineEventHandler(async (event) => {
// Validate template structure
const validateTemplateStructure = (code) => {
+ // Add new validation for script tags inside template
+ const templateContent1 = code.match(
+ /([\s\S]*)<\/template>/
+ )?.[1];
+ if (templateContent1) {
+ const scriptInTemplate = templateContent1.match(/