mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
refactor(cli): auth/workspace cleanup — record-backed token store (#37219)
Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai>
This commit is contained in:
1 parent
62ee1fff62
commit
a650ffc00a
45 files changed
+795
-620
No files matched your search
@@ -2,7 +2,7 @@ import type { ActiveContext } from '@/auth/hosts'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { Command } from '@/framework/command'
|
||||
import type { HttpClient } from '@/http/types'
|
||||
import type { Store } from '@/store/store'
|
||||
import type { TokenStore } from '@/store/token-store'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { META_PROBE_TIMEOUT_MS, MetaClient } from '@/api/meta'
|
||||
import { notLoggedInError, Registry } from '@/auth/hosts'
|
||||
@@ -11,7 +11,7 @@ import { loadNudgeStore } from '@/cache/nudge-store'
|
||||
import { getEnv } from '@/env/registry'
|
||||
import { formatErrorForCli } from '@/errors/format'
|
||||
import { createHttpClient } from '@/http/client'
|
||||
import { getTokenStore, tokenKey } from '@/store/manager'
|
||||
import { getTokenStore } from '@/store/manager'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { hostWithScheme, openAPIBase } from '@/util/host'
|
||||
import { versionInfo } from '@/version/info'
|
||||
@@ -21,7 +21,7 @@ import { resolveRetryAttempts } from './global-flags.js'
|
||||
export type AuthedContext = {
|
||||
readonly reg: Registry
|
||||
readonly active: ActiveContext
|
||||
readonly store: Store
|
||||
readonly store: TokenStore
|
||||
readonly http: HttpClient
|
||||
readonly host: string
|
||||
readonly io: IOStreams
|
||||
@@ -44,8 +44,8 @@ export async function buildAuthedContext(
|
||||
if (active === undefined)
|
||||
fail(cmd, opts, io)
|
||||
|
||||
const { store } = getTokenStore()
|
||||
const bearer = store.get(tokenKey(active.host, active.email))
|
||||
const store = getTokenStore(reg.token_storage)
|
||||
const bearer = store.read(active.host, active.email)
|
||||
if (bearer === '')
|
||||
fail(cmd, opts, io)
|
||||
|
||||
|
||||
Reference in new issue
Block a user