@@ -269,54 +269,6 @@ const healthAction = computed(() => {
269269 return props .server .health ?.action || ' '
270270})
271271
272- const needsOAuth = computed (() => {
273- // Don't show Login button if server is disabled
274- if (! props .server .enabled ) return false
275-
276- // Don't show Login button while connecting (let the connection attempt finish)
277- if (props .server .connecting ) return false
278-
279- if (! isHttpProtocol .value ) return false
280-
281- // Don't show Login if already connected
282- if (props .server .connected ) return false
283-
284- // HTTP servers always support OAuth via autodiscovery, even without explicit oauth config
285- // oauth: null (new server) and oauth: {} (explicit empty config) should both allow Login
286- // Only require explicit oauth config for non-HTTP protocols (though they don't reach here)
287- const hasOAuthSupport = isHttpProtocol .value || (props .server .oauth !== null && props .server .oauth !== undefined )
288- if (! hasOAuthSupport ) return false
289-
290- // Show Login if user explicitly logged out
291- if (props .server .user_logged_out ) {
292- return true
293- }
294-
295- // Use oauth_status for more accurate token state detection
296- // Show Login if: no token, expired token, or error state
297- const oauthStatus = props .server .oauth_status
298- if (oauthStatus === ' expired' || oauthStatus === ' error' || oauthStatus === ' none' ) {
299- return true
300- }
301-
302- // Fallback: if oauth_status not available, use authenticated flag
303- // Show Login if not authenticated (no stored token)
304- if (! props .server .authenticated ) {
305- return true
306- }
307-
308- // Check for OAuth-related errors that indicate re-authentication is needed
309- const hasOAuthError = props .server .last_error && (
310- props .server .last_error .includes (' authorization' ) ||
311- props .server .last_error .includes (' OAuth' ) ||
312- props .server .last_error .includes (' 401' ) ||
313- props .server .last_error .includes (' invalid_token' ) ||
314- props .server .last_error .includes (' Missing or invalid access token' )
315- )
316-
317- return hasOAuthError
318- })
319-
320272const canLogout = computed (() => {
321273 // Don't show Logout button if server is disabled
322274 if (! props .server .enabled ) return false
0 commit comments