-
Notifications
You must be signed in to change notification settings - Fork 1
Add browser joystick preview screenshot and automated generation workflow #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: dorkmo <[email protected]>
Co-authored-by: dorkmo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements automated screenshot generation for the LifeTrac v25 web controller interface, providing a visual preview of the browser-based control system with on-screen joysticks to help users understand the interface before installation.
- Creates a comprehensive GitHub Actions workflow for automated screenshot generation using Playwright
- Develops self-contained preview assets including standalone HTML and SVG camera placeholder
- Integrates the generated preview image into the main project documentation
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
LifeTrac-v25/raspberry_pi_web_controller/preview/standalone.html |
Self-contained HTML interface with embedded CSS/JS for screenshot generation |
LifeTrac-v25/raspberry_pi_web_controller/preview/README.md |
Documentation for preview asset usage and customization |
LifeTrac-v25/raspberry_pi_web_controller/preview/.gitignore |
Excludes temporary files while preserving generated screenshots |
LifeTrac-v25/README.md |
Adds preview image reference to web controller section |
.github/workflows/generate-web-controller-preview.yml |
Automated workflow for screenshot generation and repository updates |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
| <title>LifeTrac v25 Control - Preview</title> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/nipplejs/0.9.0/nipplejs.min.js"></script> |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading nipplejs from CDN creates an external dependency that could fail or be compromised. For a truly self-contained solution, consider downloading and embedding the library or using a local copy.
| <script src="https://cdnjs.cloudflare.com/ajax/libs/nipplejs/0.9.0/nipplejs.min.js"></script> | |
| <script src="libs/nipplejs/nipplejs.min.js"></script> |
| cat > screenshot.js << 'EOF' | ||
| const { chromium } = require('@playwright/test'); | ||
|
|
||
| (async () => { | ||
| const browser = await chromium.launch(); | ||
| const context = await browser.newContext({ | ||
| viewport: { width: 1920, height: 1080 } | ||
| }); | ||
| const page = await context.newPage(); | ||
|
|
||
| console.log('Navigating to page...'); | ||
| await page.goto('http://localhost:8080/standalone.html'); | ||
|
|
||
| console.log('Waiting for page to be ready...'); | ||
| await page.waitForSelector('[data-ready="true"]', { timeout: 10000 }); | ||
|
|
||
| // Wait a bit more for joysticks to fully render | ||
| await page.waitForTimeout(2000); | ||
|
|
||
| console.log('Taking screenshot...'); | ||
| await page.screenshot({ | ||
| path: 'web-controller-preview.png', | ||
| fullPage: false | ||
| }); | ||
|
|
||
| console.log('Screenshot saved!'); | ||
| await browser.close(); | ||
| })(); | ||
| EOF |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaScript code is embedded as a heredoc within the YAML workflow, making it difficult to maintain and debug. Consider creating a separate .js file in the repository or using a more structured approach.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| git push --force-with-lease origin HEAD || { echo "ERROR: git push failed. Please check for conflicts or permission issues."; exit 1; } | ||
| else |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using --force-with-lease can overwrite changes if the remote branch has moved. Consider using a regular git push first and only fall back to force push if necessary, or implement proper conflict resolution.
| git push --force-with-lease origin HEAD || { echo "ERROR: git push failed. Please check for conflicts or permission issues."; exit 1; } | |
| else | |
| # Try regular push first | |
| if git push origin HEAD; then | |
| echo "Pushed successfully with regular push." | |
| else | |
| echo "Regular push failed. Attempting to rebase onto remote..." | |
| git fetch origin | |
| if git rebase origin/$(git rev-parse --abbrev-ref HEAD); then | |
| if git push origin HEAD; then | |
| echo "Pushed successfully after rebase." | |
| else | |
| echo "Push after rebase failed. Falling back to force-with-lease." | |
| git push --force-with-lease origin HEAD || { echo "ERROR: git push --force-with-lease failed. Please check for conflicts or permission issues."; exit 1; } | |
| fi | |
| else | |
| echo "Rebase failed. Falling back to force-with-lease." | |
| git push --force-with-lease origin HEAD || { echo "ERROR: git push --force-with-lease failed. Please check for conflicts or permission issues."; exit 1; } | |
| fi | |
| fi |
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
| <title>LifeTrac v25 Control - Preview</title> | ||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/nipplejs/0.9.0/nipplejs.min.js"></script> |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading external JavaScript from CDN without integrity verification poses a security risk. Consider using Subresource Integrity (SRI) hashes or bundling the library locally for production use.
| <script src="https://cdnjs.cloudflare.com/ajax/libs/nipplejs/0.9.0/nipplejs.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/nipplejs/0.9.0/nipplejs.min.js" integrity="sha512-+6Qn6lL6v1QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6QwQn6Qw==" crossorigin="anonymous"></script> |
Overview
This PR implements automated screenshot generation for the LifeTrac v25 web controller interface, providing a visual preview of the browser-based control system with on-screen joysticks.
Changes Made
1. GitHub Actions Workflow
Created
.github/workflows/generate-web-controller-preview.ymlthat:[skip ci]2. Preview Assets
Created
LifeTrac-v25/raspberry_pi_web_controller/preview/directory containing:standalone.html - Self-contained web interface for screenshot generation
data-readyattribute for automationcamera-placeholder.svg - Professional camera feed placeholder
web-controller-preview.png - Generated screenshot (357KB)
3. Documentation Updates
LifeTrac-v25/README.mdto include the preview image under the Raspberry Pi Web Controller sectionpreview/README.mdwith comprehensive documentation on screenshot generation and usagepreview/.gitignoreto exclude temporary node_modules and build artifactsPreview Screenshot
The screenshot displays the complete browser-based control interface featuring:
Technical Implementation
The workflow uses Playwright to:
The standalone HTML page is fully self-contained and requires no external services, making it ideal for automated screenshot generation in CI/CD pipelines.
Testing
Usage
Automatic: The workflow automatically runs when web controller files are modified.
Manual: Navigate to Actions → "Generate Web Controller Preview" → Run workflow
The preview image provides users with an immediate visual understanding of the web controller interface before installation, showcasing the dual joystick control system for tank steering and hydraulics.
Closes #[issue-number]
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.