mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
chore(lint): replace ESLint with Oxlint and clear anti-slop findings
This commit is contained in:
1 parent
c6c13335e5
commit
b625acfc0c
1083 files changed
+67089
-80136
No files matched your search
@@ -79,7 +79,6 @@ export class OpenCodeServerPairingError extends OpenCodeServerError {
|
||||
}
|
||||
}
|
||||
|
||||
/** Raised when a server address change would reuse stored credentials on a different origin. */
|
||||
export class OpenCodeServerCredentialsRequiredError extends OpenCodeServerError {
|
||||
constructor() {
|
||||
super('Changing the server address requires re-entering the password or pairing again', 400)
|
||||
@@ -95,6 +94,8 @@ function reusesStoredPasswordOnNewOrigin(server: OpenCodeServer, request: Update
|
||||
return !haveSameUrlOrigin(server.baseUrl, request.baseUrl)
|
||||
}
|
||||
|
||||
const serverVersionBodySchema = z.object({ version: z.string().optional() })
|
||||
|
||||
export class OpenCodeServerRegistry {
|
||||
private readonly clients = new Map<string, OpenCodeClient>()
|
||||
private readonly listeners = new Set<OpenCodeServerChangeListener>()
|
||||
@@ -194,9 +195,9 @@ export class OpenCodeServerRegistry {
|
||||
|
||||
async test(input: TestServerSource): Promise<OpenCodeServerTestResult> {
|
||||
const target = this.resolveTestTarget(input)
|
||||
const headers: Record<string, string> = { Accept: 'application/json' }
|
||||
const headers = new Headers({ Accept: 'application/json' })
|
||||
if (target.password !== null) {
|
||||
headers.Authorization = buildOpenCodeBasicAuth(target.password, target.username)
|
||||
headers.set('Authorization', buildOpenCodeBasicAuth(target.password, target.username))
|
||||
}
|
||||
|
||||
let response: Response
|
||||
@@ -279,8 +280,10 @@ export class OpenCodeServerRegistry {
|
||||
|
||||
private async readServerVersion(response: Response): Promise<string | null> {
|
||||
try {
|
||||
const body = (await response.json()) as { version?: unknown }
|
||||
return typeof body.version === 'string' && body.version.length > 0 ? body.version : null
|
||||
const body = serverVersionBodySchema.safeParse(await response.json())
|
||||
if (!body.success) return null
|
||||
const version = body.data.version
|
||||
return version !== undefined && version.length > 0 ? version : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user