From 75db6eb2095fee4479b7c5ab73be255e724b6d0b Mon Sep 17 00:00:00 2001 From: zain94rif Date: Mon, 6 Apr 2026 12:54:16 +0700 Subject: [PATCH] fix(local): add middleware for local access only --- src/layout/LayoutMenu.jsx | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/layout/LayoutMenu.jsx b/src/layout/LayoutMenu.jsx index 9693e60..895bcc7 100644 --- a/src/layout/LayoutMenu.jsx +++ b/src/layout/LayoutMenu.jsx @@ -37,6 +37,15 @@ import { } from '@ant-design/icons'; const { Text } = Typography; +const url = new URL(import.meta.env.VITE_WHATSAPP_URL); +const host = url.hostname; + +const isLocal = + host === '127.0.0.1' || + host === 'localhost' || + host.startsWith('192.168.') || + host.startsWith('10.') || + host.startsWith('172.'); const allItems = [ { @@ -226,15 +235,19 @@ const allItems = [ ), }, - { - key: 'whatsapp-control', - icon: , - label: ( - - WhatsApp Control - - ), - }, + ...(isLocal + ? [ + { + key: 'whatsapp-control', + icon: , + label: ( + + WhatsApp Control + + ), + }, + ] + : []), // { // key: 'jadwal-shift', // icon: ,