Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/quiet-juejin-login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@juejin-opensource/jusage': patch
'@juejin-opensource/jusage-dashboard': patch
---

安装后打开本地用量面板时不再自动跳转掘金登录,仍可按需手动关联账号。
24 changes: 0 additions & 24 deletions packages/dashboard/src/components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@ import { JuejinAuthProvider } from '@/hooks/JuejinAuthContext';
import { ShareSnapshotProvider } from '@/hooks/ShareSnapshotContext';
import { useJuejinClientLinkFlow } from '@/hooks/useJuejinClientLinkFlow';
import {
fetchConfig,
fetchInstallGuide,
isCliBackend,
type InstallGuideResponse,
} from '@/lib/api';
import {
openJuejinLogin,
resolveClientLinkSearch,
} from '@/lib/juejin-client-link';
import { getTauriDesktopBridge } from '@/lib/tauri-desktop';
import { cn } from '@/lib/utils';

const AUTO_INSTALL_GUIDE_KEY = 'tud.installGuideAutoOpened';
const AUTO_JUEJIN_LOGIN_KEY = 'tud.autoJuejinLoginPrompted';

/** Root shell: filter chrome actions + nested route outlet. */
export function AppShell() {
Expand Down Expand Up @@ -99,24 +93,6 @@ useEffect(() => {
return () => window.removeEventListener('scroll', updateScrolledState);
}, []);

// Preserve the existing client association flow: on a fresh CLI launch,
// prompt once when no linked Juejin account exists.
useEffect(() => {
if (!cliBackend) return;
if (resolveClientLinkSearch().userId) return;
void (async () => {
try {
const config = await fetchConfig();
if (config.juejin.userId) return;
if (sessionStorage.getItem(AUTO_JUEJIN_LOGIN_KEY)) return;
sessionStorage.setItem(AUTO_JUEJIN_LOGIN_KEY, '1');
await openJuejinLogin();
} catch {
// The manual association action remains available.
}
})();
}, [cliBackend]);

// Server mode: ask the cloud whether the current user should see the
// installation guide. Only fires once authentication is ready to avoid
// a 401 when the token is still being hydrated.
Expand Down
Loading