mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-04 07:33:18 +00:00
fix(usage): discover migrated database logins and relative paths
Match the source application’s migration and database-path rules so usage discovery does not keep reporting a stale file login after migration. Co-authored-by: Jiayang Wu <651475459@qq.com>
This commit is contained in:
co-authored by
Jiayang Wu
parent
d5f19aed37
commit
bd5671fd49
@@ -73,7 +73,7 @@ export function opencodeStorePaths(env: NodeJS.ProcessEnv, home: string): Openco
|
||||
const directory = join(dataHome, "opencode");
|
||||
return {
|
||||
file: join(directory, "auth.json"),
|
||||
database: env.OPENCODE_DB ? resolve(env.OPENCODE_DB) : join(directory, "opencode.db"),
|
||||
database: resolve(directory, env.OPENCODE_DB || "opencode.db"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -176,7 +176,9 @@ export function readOpencodeOauth(path: string, lookup: StoreLookup = {}): Openc
|
||||
}
|
||||
const rows = db
|
||||
.prepare(
|
||||
"SELECT id, value FROM credential WHERE integration_id = ? AND active = 1 ORDER BY time_updated DESC, id DESC",
|
||||
// Migrated v1 rows have no active flag. OpenCode selects the newest
|
||||
// created login until an explicit selection pins another one.
|
||||
"SELECT id, value FROM credential WHERE integration_id = ? AND (active = 1 OR active IS NULL) ORDER BY active DESC, time_created DESC, id DESC LIMIT 1",
|
||||
)
|
||||
.all("openai");
|
||||
return rows.flatMap((value) => {
|
||||
|
||||
Reference in New Issue
Block a user