Change to use dpdm for circular import scanning (#5788)

Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
James Brunton
2026-02-24 23:05:23 +00:00
committed by GitHub
co-authored by Anthony Stirling
parent 1b3bfaec20
commit eab84a13d0
17 changed files with 200 additions and 2230 deletions
@@ -0,0 +1,27 @@
import { invoke } from '@tauri-apps/api/core';
const TOKEN_KEY = 'stirling_jwt';
/**
* Read auth token from any available source (Tauri store or localStorage).
* Kept separate to avoid circular dependencies between auth and backend services.
*/
export async function getAuthTokenFromAnySource(): Promise<string | null> {
// Try Tauri store first
try {
const token = await invoke<string | null>('get_auth_token');
if (token) {
return token;
}
} catch (error) {
console.error('[Desktop AuthTokenStore] Failed to read from Tauri store:', error);
}
// Fallback to localStorage
try {
return localStorage.getItem(TOKEN_KEY);
} catch (error) {
console.error('[Desktop AuthTokenStore] Failed to read from localStorage:', error);
return null;
}
}
@@ -1,6 +1,7 @@
import { invoke } from '@tauri-apps/api/core';
import { fetch } from '@tauri-apps/plugin-http';
import { connectionModeService } from '@app/services/connectionModeService';
import { getAuthTokenFromAnySource } from '@app/services/authTokenStore';
export type BackendStatus = 'stopped' | 'starting' | 'healthy' | 'unhealthy';
@@ -122,8 +123,7 @@ export class TauriBackendService {
*/
private async getAuthToken(): Promise<string | null> {
try {
const { authService } = await import('./authService');
return await authService.getAuthToken();
return await getAuthTokenFromAnySource();
} catch (error) {
console.debug('[TauriBackendService] Failed to get auth token:', error);
return null;