mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(servers): test edited server URLs with the stored password
Test always checks the draft URL. When the password is left blank, the stored password is reused only if the draft URL has the same origin as the saved server.
This commit is contained in:
1 parent
e707e80b91
commit
1659664d53
6 files changed
+131
-22
No files matched your search
@@ -249,7 +249,7 @@ export class OpenCodeServerRegistry {
|
||||
}
|
||||
|
||||
private resolveTestTarget(input: TestServerSource): TestTarget {
|
||||
if ('serverId' in input) {
|
||||
if (!('baseUrl' in input)) {
|
||||
const server = this.requireServer(input.serverId)
|
||||
return {
|
||||
baseUrl: server.baseUrl,
|
||||
@@ -258,10 +258,22 @@ export class OpenCodeServerRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
const baseUrl = trimUrlTrailingSlashes(input.baseUrl)
|
||||
if (input.password !== undefined || input.serverId === undefined) {
|
||||
return {
|
||||
baseUrl,
|
||||
username: input.username,
|
||||
password: input.password ?? null,
|
||||
}
|
||||
}
|
||||
|
||||
const server = this.requireServer(input.serverId)
|
||||
return {
|
||||
baseUrl: trimUrlTrailingSlashes(input.baseUrl),
|
||||
baseUrl,
|
||||
username: input.username,
|
||||
password: input.password ?? null,
|
||||
password: haveSameUrlOrigin(server.baseUrl, baseUrl)
|
||||
? readOpenCodeServerPassword(this.db, input.serverId)
|
||||
: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user