How yahianshi/redpen works
RedPen is a Chrome/Brave extension for grading student PDFs directly in Google Classroom. The main workflow detects a submission and its Drive file, opens an in-page canvas, captures stylus annotations, and autosaves flattened PDF changes to Drive. The graph also includes the standalone annotator, OAuth and revision restore, settings, and popup setup capabilities described in the README. Edges follow the shown imports and calls; other unsampled interactions are omitted.
Main entry points: content_script.ts In-Page Grading · annotator.ts Standalone Annotator · background.ts Message Worker · storage.ts Local Storage
Components 16
Classroom Integration
- Submission Detector
src/content/detector.ts - In-Page Grading
src/content/content_script.ts
PDF Grading
- Standalone Annotator
src/annotator/annotator.ts - Grading Toolbar
src/ui/toolbar.ts - PDF Canvas Viewer
src/ui/canvasViewer.ts - Stylus Engine
src/engine/stylus.ts - PDF Flattener
src/services/flattener.ts
Google Services
- Local Storage
src/services/storage.ts - Message Worker
src/background/background.ts - OAuth Manager
src/services/auth.ts - Drive and Classroom API
src/services/drive.ts
Extension Setup
- Setup Popup
src/popup/popup.ts - Extension Options
src/options/options.ts
Other components
- Teacher
- Google Classroom
- Google Drive / Classroom
Connections 24
- Teacher → Google Classroom: grades in
README.md - Google Classroom → Submission Detector: hosts page
README.md - Submission Detector → In-Page Grading: reports submission
src/content/content_script.ts - Teacher → In-Page Grading: opens grading
README.md - In-Page Grading → Grading Toolbar: creates
src/content/content_script.ts - In-Page Grading → PDF Canvas Viewer: creates
src/content/content_script.ts - In-Page Grading → Stylus Engine: handles annotations
src/content/content_script.ts - In-Page Grading → PDF Flattener: flattens PDF
src/content/content_script.ts - In-Page Grading → Local Storage: caches session
src/content/content_script.ts - PDF Canvas Viewer → Stylus Engine: forwards pointer input
src/ui/canvasViewer.ts - Standalone Annotator → Grading Toolbar: creates
src/annotator/annotator.ts - Standalone Annotator → PDF Canvas Viewer: creates
src/annotator/annotator.ts - Standalone Annotator → Stylus Engine: configures
src/annotator/annotator.ts - Standalone Annotator → PDF Flattener: flattens PDF
src/annotator/annotator.ts - Standalone Annotator → Local Storage: loads and saves
src/annotator/annotator.ts - Standalone Annotator → Message Worker: requests Drive actions
src/annotator/annotator.ts - In-Page Grading → Message Worker: sends extension messages
src/content/content_script.ts - Message Worker → OAuth Manager: gets OAuth token
src/background/background.ts - Drive and Classroom API → OAuth Manager: gets valid token
src/services/drive.ts - Message Worker → Drive and Classroom API: dispatches API operations
src/background/background.ts - Drive and Classroom API → Google Drive / Classroom: calls APIs
src/services/drive.ts - Setup Popup → Local Storage: reads settings
src/popup/popup.ts - Extension Options → Local Storage: updates settings
src/options/options.ts - Setup Popup → Message Worker: auth setup