diff --git a/backend/cmd/api/main.go b/backend/cmd/api/main.go index af833943..91c7fe42 100644 --- a/backend/cmd/api/main.go +++ b/backend/cmd/api/main.go @@ -14,6 +14,7 @@ import ( "github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/models" "github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/server" "github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/version" + "github.com/gin-gonic/gin" "gopkg.in/natefinch/lumberjack.v2" ) @@ -38,6 +39,7 @@ func main() { // Log to both stdout and file mw := io.MultiWriter(os.Stdout, rotator) log.SetOutput(mw) + gin.DefaultWriter = mw // Handle CLI commands if len(os.Args) > 1 && os.Args[1] == "reset-password" { diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh old mode 100644 new mode 100755 index 2839bcec..07477d02 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -30,7 +30,7 @@ echo "Starting CPM+ management application..." if [ "$CPMP_DEBUG" = "1" ]; then DEBUG_PORT=${CPMP_DEBUG_PORT:-2345} echo "Running CPM+ under Delve (port $DEBUG_PORT)" - /usr/local/bin/dlv exec /app/cpmp --headless --listen=":$DEBUG_PORT" --api-version=2 --accept-multiclient --log -- & + /usr/local/bin/dlv exec /app/cpmp --headless --listen=":$DEBUG_PORT" --api-version=2 --accept-multiclient --continue --log -- & else /app/cpmp & fi diff --git a/frontend/src/api/import.ts b/frontend/src/api/import.ts index ae21c326..54a46186 100644 --- a/frontend/src/api/import.ts +++ b/frontend/src/api/import.ts @@ -27,8 +27,8 @@ export const getImportPreview = async (): Promise => { return data; }; -export const commitImport = async (resolutions: Record): Promise => { - await client.post('/import/commit', { resolutions }); +export const commitImport = async (sessionUUID: string, resolutions: Record): Promise => { + await client.post('/import/commit', { session_uuid: sessionUUID, resolutions }); }; export const cancelImport = async (): Promise => { diff --git a/frontend/src/components/__tests__/NotificationCenter.test.tsx b/frontend/src/components/__tests__/NotificationCenter.test.tsx index 6311ad7e..c343e91a 100644 --- a/frontend/src/components/__tests__/NotificationCenter.test.tsx +++ b/frontend/src/components/__tests__/NotificationCenter.test.tsx @@ -63,6 +63,11 @@ const mockNotifications: api.Notification[] = [ describe('NotificationCenter', () => { beforeEach(() => { vi.clearAllMocks() + vi.mocked(api.checkUpdates).mockResolvedValue({ + available: false, + latest_version: '0.0.0', + changelog_url: '', + }) }) afterEach(() => { diff --git a/frontend/src/hooks/__tests__/useImport.test.tsx b/frontend/src/hooks/__tests__/useImport.test.tsx index 55663f17..46ac930c 100644 --- a/frontend/src/hooks/__tests__/useImport.test.tsx +++ b/frontend/src/hooks/__tests__/useImport.test.tsx @@ -143,7 +143,7 @@ describe('useImport', () => { await result.current.commit({ 'test.com': 'skip' }) }) - expect(api.commitImport).toHaveBeenCalledWith({ 'test.com': 'skip' }) + expect(api.commitImport).toHaveBeenCalledWith('session-2', { 'test.com': 'skip' }) await waitFor(() => { expect(result.current.session).toBeNull() diff --git a/frontend/src/hooks/useImport.ts b/frontend/src/hooks/useImport.ts index d2a16f7b..9772ec7e 100644 --- a/frontend/src/hooks/useImport.ts +++ b/frontend/src/hooks/useImport.ts @@ -43,7 +43,11 @@ export function useImport() { }); const commitMutation = useMutation({ - mutationFn: (resolutions: Record) => commitImport(resolutions), + mutationFn: (resolutions: Record) => { + const sessionId = statusQuery.data?.session?.id; + if (!sessionId) throw new Error("No active session"); + return commitImport(sessionId, resolutions); + }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: QUERY_KEY }); queryClient.invalidateQueries({ queryKey: ['import-preview'] });