This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-editor.git

commit d5f8930a0ca5fdd84d85c940f54b99996b9e03f2
Author: Yang Luo <[email protected]>
AuthorDate: Sun Oct 4 22:13:17 2026 +0800

    fix: ignore stale door.casdoor.com endpoint saved in localStorage
---
 app/components/editor/common/EndpointSelector.tsx | 4 ++--
 app/components/hooks/useRemoteEnforcer.ts         | 9 ++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/app/components/editor/common/EndpointSelector.tsx 
b/app/components/editor/common/EndpointSelector.tsx
index 5d270f3..cae0b8f 100644
--- a/app/components/editor/common/EndpointSelector.tsx
+++ b/app/components/editor/common/EndpointSelector.tsx
@@ -1,7 +1,7 @@
 import React from 'react';
 import { clsx } from 'clsx';
 import { Link } from 'lucide-react';
-import { DEFAULT_ENDPOINT } from '@/app/components/hooks/useRemoteEnforcer';
+import { DEFAULT_ENDPOINT, getEndpoint } from 
'@/app/components/hooks/useRemoteEnforcer';
 import { useLang } from '@/app/context/LangContext';
 import { useAutoCarousel } from '@/app/context/AutoCarouselContext';
 import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from 
'@/app/components/ui/tooltip';
@@ -12,7 +12,7 @@ export const EndpointSelector: React.FC = () => {
   const { t } = useLang();
   const { disableAutoCarousel } = useAutoCarousel();
   const [isOpen, setIsOpen] = React.useState(false);
-  const storedEndpoint = window.localStorage.getItem('casbinEndpoint') || 
DEFAULT_ENDPOINT;
+  const storedEndpoint = getEndpoint();
   const [selectedEndpoint, setSelectedEndpoint] = 
React.useState(storedEndpoint);
   const [customEndpoint, setCustomEndpoint] = 
React.useState(ENDPOINTS.includes(storedEndpoint) ? '' : storedEndpoint);
   const dropdownRef = React.useRef<HTMLDivElement>(null);
diff --git a/app/components/hooks/useRemoteEnforcer.ts 
b/app/components/hooks/useRemoteEnforcer.ts
index b0b866c..f63c062 100644
--- a/app/components/hooks/useRemoteEnforcer.ts
+++ b/app/components/hooks/useRemoteEnforcer.ts
@@ -29,9 +29,16 @@ export interface VersionInfo {
 // Host of the casbin-editor-backend service 
(github.com/casbin/casbin-editor-backend).
 export const DEFAULT_ENDPOINT = 'cli.casnode.com';
 
+// Endpoints saved by older versions; they no longer serve the editor.
+const LEGACY_ENDPOINTS = ['door.casdoor.com', 'demo.casdoor.com'];
+
 export const getEndpoint = () => {
   try {
-    return window?.localStorage?.getItem('casbinEndpoint') || DEFAULT_ENDPOINT;
+    const endpoint = window?.localStorage?.getItem('casbinEndpoint');
+    if (!endpoint || LEGACY_ENDPOINTS.includes(endpoint)) {
+      return DEFAULT_ENDPOINT;
+    }
+    return endpoint;
   } catch {
     return DEFAULT_ENDPOINT;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to