feat: add result preview feature with watermark and rate limiting#45
Open
szj2ys wants to merge 27 commits intoBIT-DataLab:mainfrom
Open
feat: add result preview feature with watermark and rate limiting#45szj2ys wants to merge 27 commits intoBIT-DataLab:mainfrom
szj2ys wants to merge 27 commits intoBIT-DataLab:mainfrom
Conversation
Bare `except:` catches BaseException including KeyboardInterrupt and SystemExit. Replaced 4 instances with `except Exception:`.
Adds complete Next.js 16 frontend for EditBanana: - Landing page with Hero, Upload, Features, Examples sections - File upload component with drag-and-drop - Real-time conversion progress via WebSocket - Result download functionality - Responsive design with Tailwind CSS v4 - Framer Motion animations - Vercel Analytics integration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update metadata with optimized title, description, keywords - Add Open Graph tags for social sharing - Add Twitter Card tags - Add JSON-LD structured data for SoftwareApplication - Add canonical URL configuration - Create sitemap.ts with main pages - Create robots.ts with crawl rules - Fix static export for robots.txt and sitemap.xml - Add missing tsconfig.json, next.config.ts, globals.css Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace placeholder images in example-showcase with actual demo images showing before/after conversion results: - Flowchart: original_1.jpg → recon_1.png - Architecture: original_2.png → recon_2.png - Network: original_3.jpg → recon_3.png Images copied from static/demo/ to public/examples/ for static export compatibility.
- Add CI workflow for web app (Node.js 20, lint, build) - Add CI workflow for API (Python 3.11, pytest) - Add PR template for consistent PR descriptions
Add complete Next.js 16 + React 19 frontend for EditBanana: - Landing page with Hero, Upload, Features, and Example Showcase sections - File upload with drag-and-drop support - Real-time conversion progress tracking via WebSocket - Conversion history persistence using localStorage - Track pending/completed/failed/cancelled conversions - Download previous results without re-uploading - Remove individual items or clear all history - Max 50 items with automatic FIFO eviction - Responsive design with Tailwind CSS and Framer Motion animations - Vercel Analytics integration Technical details: - React Context for history state management - Custom useConversionHistory hook with localStorage persistence - HistorySection component with status icons and download links - API integration for file upload, job status, and result download
…system Add viral growth features including social sharing and referral system to increase organic user acquisition. Changes: - Add share types (ShareOptions, ShareChannel, ReferralInfo) - Add useShare hook with 6 sharing channels (Twitter, LinkedIn, Facebook, WeChat, Copy, Email) - Add useReferral hook with localStorage persistence - Add ShareModal component with animated UI - Add ReferralBanner component to homepage - Integrate share button in upload success state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… and deployment automation - Add GitHub Actions workflow with 7 jobs: security-scan, lint, test, build, deploy-staging, deploy-production, and notify - Integrate Bandit and Safety for security vulnerability scanning - Configure Black, isort, Flake8, and mypy for code quality - Set up multi-version Python testing (3.10, 3.11, 3.12) with pytest coverage - Add deployment automation for staging (develop branch) and production (main) - Include Slack notifications for pipeline failures - Create pyproject.toml with tool configurations (Black, isort, mypy, pytest, coverage) - Add .flake8 configuration for consistent linting rules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged example images feature from PR BIT-DataLab#35 with history persistence from PR BIT-DataLab#36. Features combined: - Real example images in showcase (/examples/*.jpg, *.png) - History persistence with localStorage - History navigation link in navbar - Conversion history tracking in upload section
…, and arrow connector Implements comprehensive error handling infrastructure: Backend Changes: - Exception hierarchy with specific error types (SegmentationError, OCRParsingError, etc.) - @Retry decorator with exponential backoff and configurable strategies - PartialResultsHandler for saving/recovering conversion state on failure - Arrow processor module for automatic arrow-shape association - 60 comprehensive unit tests for exceptions, retry, and partial results CI/CD: - GitHub Actions workflows for backend, frontend, and deployment Frontend: Clean merge keeping history persistence and share features Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add share functionality and referral system: - ShareModal component for sharing conversion results - Referral banner with tracking - useShare and useReferral hooks - Share types definition Resolved: Conflicts with existing HistorySection and ReferralBanner integration from PR BIT-DataLab#35 by accepting HEAD versions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixed 3 react-hooks/set-state-in-effect lint errors: - use-conversion-history.ts: Changed isLoaded state to useRef pattern - use-referral.ts: Removed isLoaded state, use ref + setTimeout deferral - api.ts: Removed unnecessary eslint-disable comment, proper type assertion Build passes, TypeScript compilation clean.
Simplified Card component implementation for cleaner codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix vercel.json outputDirectory from .next to dist - Add Dockerfile for FastAPI backend containerization - Add fly.toml for Fly.io deployment configuration - Update GitHub Actions deploy.yml with full CI/CD pipeline: * Docker image build and push to GHCR * Frontend deployment to Vercel * Backend deployment to Fly.io * Health checks and deployment notifications Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add modules/retry.py with @Retry decorator - Implements exponential backoff with jitter - Respects EditBananaException.retry_allowed flag - Supports configurable max_retries, base_delay, max_delay - Add comprehensive test suite (21 tests, all passing) - Provides retry_with_editbanana_defaults() convenience decorator - Includes is_retryable() helper for introspection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all runtime print() statements with logger.info/warning/error to follow Python logging best practices. This enables: - Structured log output with timestamps and levels - Configurable log levels for different environments - Better debugging and monitoring capabilities The remaining print statements in docstrings are documentation examples showing API usage, which is appropriate to keep. Files changed: - modules/base.py: _log method uses logger.info - modules/text/restorer.py: debug image warning uses logger - modules/text/ocr/pix2text.py: device and result logging - modules/text/processors/*.py: various info logging - modules/text/coord_processor.py: test logging - modules/text/xml_generator.py: file save logging - modules/arrow_processor.py: skimage warning - modules/icon_picture_processor.py: model loading logging - modules/sam3_info_extractor.py: model loading logging
…overy Add robust error recovery infrastructure: - Retry decorators with exponential backoff for transient failures - CheckpointManager for pipeline state persistence - Exception handling imports and ProcessingContext dataclass - Retry wrappers applied to text_restorer.process and sam3_extractor methods - Pipeline stage result tracking for recovery
Add preview generation service with watermark and blur effects
- Create PreviewGenerator class using PIL for image processing
- Add IP-based rate limiting (3 previews/hour)
- Implement 5-minute auto-expiration for preview files
Add FastAPI routes for preview management
- POST /api/v1/jobs/{job_id}/preview to create previews
- GET /api/v1/previews/{preview_id} to retrieve preview images
- DELETE endpoint for cleanup
Add frontend PreviewModal component
- View-only display with disabled right-click and drag
- Countdown timer showing expiration
- Blur overlay on bottom 30% with CTA
- Watermark notice and view-only indicators
Update upload-section.tsx to integrate preview button
Update api.ts with preview API functions
Add rate limiting middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Preview MVP feature allowing users to preview converted diagrams before downloading.
Features
Backend Changes
PreviewGeneratorclass for image processing (watermark, blur, resize)PreviewStorefor TTL-based in-memory storage with IP tracking/api/v1/jobs/{job_id}/previewPreviewRateLimitMiddlewarefor IP-based rate limitingFrontend Changes
PreviewModalcomponent with countdown timerTest Plan
npm run build)