mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix issues (#136)
* fix: prevent delete button click when card is not swiped open * refactor: improve CreateRepoInput type safety * security: require AUTH_SECRET and use secure random generation * fix: SSH key path validation, async passphrase stripping, and port handling * fix: use correct console methods for logger levels * Add error handling to DB update functions and improve migration logging * Add error handling for session lookup in auth middleware * Add structured git error handling with user-friendly messages - Parse git errors with specific error codes (AUTH_FAILED, REPO_NOT_FOUND, PUSH_REJECTED, MERGE_CONFLICT, etc.) and appropriate HTTP status codes - Return structured error responses with summary and detail from backend - Add GitErrorBanner component for better error display in UI - Add optional onError callback to useGit hook for external error handling * Make IPC server initialization/disposal async and fix SSH host key handler * add try-catch error handling in frontend lib utilities * remove unresolved promise handlers in speech synthesizer callbacks * Extract error types to shared package * Import GitErrorCode from shared package * Refactor API layer to use shared FetchError and fetchWrapper * Update prompt parser and source control components * Extract MCP server list to separate component with improved badge menu UX * merge useSettingsDialogUrl into useSettingsDialog and extract getRepoDisplayName utility * add separate loading state for passkey sign in * refactor hooks: use fetchWrapper, improve error handling, add proper types * replace browser confirm() with DeleteDialog component in settings * fix: add missing variables parameter in React Query onError callbacks * Refactor message parts to use separate Zustand store * Update QuestionPrompt styling for light/dark mode
This commit is contained in:
1 parent
7f7d106c28
commit
5de419ee28
75 files changed
+1990
-1367
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import path from 'path'
|
||||
import os from 'os'
|
||||
import { randomBytes } from 'crypto'
|
||||
import { DEFAULTS } from './defaults'
|
||||
|
||||
try {
|
||||
@@ -38,12 +39,7 @@ const resolveWorkspacePath = (): string => {
|
||||
const workspaceBasePath = resolveWorkspacePath()
|
||||
|
||||
const generateDefaultSecret = (): string => {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
let result = ''
|
||||
for (let i = 0; i < 32; i++) {
|
||||
result += chars.charAt(Math.floor(Math.random() * chars.length))
|
||||
}
|
||||
return result
|
||||
return randomBytes(32).toString('base64').slice(0, 32)
|
||||
}
|
||||
|
||||
export const ENV = {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
export type GitErrorCode =
|
||||
| 'AUTH_FAILED'
|
||||
| 'REPO_NOT_FOUND'
|
||||
| 'PERMISSION_DENIED'
|
||||
| 'PUSH_REJECTED'
|
||||
| 'MERGE_CONFLICT'
|
||||
| 'NO_UPSTREAM'
|
||||
| 'TIMEOUT'
|
||||
| 'NOT_A_REPO'
|
||||
| 'LOCK_FAILED'
|
||||
| 'DETACHED_HEAD'
|
||||
| 'BRANCH_EXISTS'
|
||||
| 'BRANCH_NOT_FOUND'
|
||||
| 'UNCOMMITTED_CHANGES'
|
||||
| 'UNKNOWN'
|
||||
|
||||
export type ApiErrorCode = GitErrorCode | 'INVALID_JSON' | 'TIMEOUT'
|
||||
|
||||
export interface ApiErrorResponse {
|
||||
error: string
|
||||
code?: string
|
||||
detail?: string
|
||||
details?: unknown
|
||||
}
|
||||
|
||||
export class FetchError extends Error {
|
||||
statusCode?: number
|
||||
code?: string
|
||||
detail?: string
|
||||
|
||||
constructor(message: string, statusCode?: number, code?: string, detail?: string) {
|
||||
super(message)
|
||||
this.name = 'FetchError'
|
||||
this.statusCode = statusCode
|
||||
this.code = code
|
||||
this.detail = detail
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,8 @@ export type PushSubscriptionRequest = z.infer<typeof PushSubscriptionRequestSche
|
||||
export type PushSubscriptionRecord = z.infer<typeof PushSubscriptionRecordSchema>
|
||||
export type PushNotificationPayload = z.infer<typeof PushNotificationPayloadSchema>
|
||||
|
||||
export interface ErrorResponse {
|
||||
error: string
|
||||
details?: unknown
|
||||
}
|
||||
export { FetchError } from './errors'
|
||||
export type { ApiErrorResponse, ApiErrorCode, GitErrorCode } from './errors'
|
||||
|
||||
export interface SuccessResponse {
|
||||
success: boolean
|
||||
|
||||
Reference in new issue
Block a user