From 2aa18d6ffb3ccdcbf47eb466aed7e651b756769c Mon Sep 17 00:00:00 2001 From: Mason Fox Date: Fri, 23 Jan 2026 15:52:39 -0500 Subject: [PATCH] fix: Improve mousehole fallback handling and UI feedback - Show fallback status in API response when state.json not found - Add yellow warning banner when using fallback token - Display correct source file path in fallback mode - Improve status message to indicate fallback usage - Add error message display in UI --- app/api/mam-token/route.js | 6 +++- app/components/TokenManager.jsx | 64 ++++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/app/api/mam-token/route.js b/app/api/mam-token/route.js index a354eec..bf58e72 100644 --- a/app/api/mam-token/route.js +++ b/app/api/mam-token/route.js @@ -62,7 +62,11 @@ export async function GET() { token: maskToken(token), fullLength: token.length, location: MAM_TOKEN_FILE, - mouseholeInfo: { enabled: false }, + mouseholeInfo: mouseholeEnabled ? { + enabled: true, + usingFallback: true, + error: "state.json not found, using fallback token file" + } : { enabled: false }, }); } catch (error) { console.error(`Failed to read MAM token: ${error.message}`); diff --git a/app/components/TokenManager.jsx b/app/components/TokenManager.jsx index 3552269..67c4333 100644 --- a/app/components/TokenManager.jsx +++ b/app/components/TokenManager.jsx @@ -116,28 +116,53 @@ export default function TokenManager({ onTokenUpdate }) { {isMouseholeMode ? ( // Mousehole Read-Only View
-
-
-
- - - + {tokenData.mouseholeInfo?.usingFallback ? ( + // Fallback Warning Banner +
+
+
+ + + +
+
+

+ Mousehole State File Not Found +

+

+ Mousehole mode is enabled, but the state.json file couldn't be found. Using fallback token from static file. +

+

+ Verify that mousehole is running and the volume mount is correct. +

+
-
-

- Token Managed by Mousehole -

-

- Your MAM token is dynamically managed by the mousehole service. Token editing is disabled. -

+
+ ) : ( + // Normal Mousehole Banner +
+
+
+ + + +
+
+

+ Token Managed by Mousehole +

+

+ Your MAM token is dynamically managed by the mousehole service. Token editing is disabled. +

+
-
+ )}

- Status: - {tokenData.exists ? 'Token active' : 'Waiting for mousehole...'} + Status: + {tokenData.exists ? (tokenData.mouseholeInfo?.usingFallback ? 'Using fallback token' : 'Token active') : 'Waiting for mousehole...'}

{tokenData.exists && ( @@ -158,8 +183,13 @@ export default function TokenManager({ onTokenUpdate }) { )}

- Source: {tokenData.mouseholeInfo?.stateFile || tokenData.location} + Source: {tokenData.location}

+ {tokenData.mouseholeInfo?.error && ( +

+ {tokenData.mouseholeInfo.error} +

+ )}