hp-copy-proofing/README.md
DJP 37fcdcb5cc Add Microsoft authentication and user tracking to HP Copy Proofing Tool
- Implemented Microsoft Azure AD authentication using MSAL
- Added login/logout functionality with protected content
- Integrated username/email capture from authenticated users
- Modified webhook to include username and timestamp with each submission
- Updated README with authentication setup and usage instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-23 14:49:33 -04:00

149 lines
No EOL
4.6 KiB
Markdown

# HP Studio Copy Proofing Tool
A web-based tool for proofing and validating copy in creative assets stored in Box.
## Overview
The HP Studio Copy Proofing Tool allows studio teams to validate the spelling, grammar, and overall correctness of copy in creative assets. The tool works by:
1. Taking a Box file URL as input
2. Extracting the file ID
3. Sending it to a webhook for processing
4. Displaying the results in a clean, organized interface
## Features
- **Microsoft Authentication**: Secure login using Microsoft Azure AD credentials
- **User Tracking**: Automatically captures and logs username/email with each submission
- **Language Detection**: Identifies the language and dialect used in the copy
- **Grammar Checking**: Highlights grammatical issues found in the text
- **Spelling Validation**: Identifies and suggests corrections for spelling errors
- **Text Evaluation**: Provides a comprehensive review of all text, marking items as approved or needing correction
- **Debug Mode**: Includes a collapsible debug section to view the raw JSON response
## Requirements
- PHP 7.0 or higher
- cURL extension enabled
- Web server (Apache, Nginx, etc.)
- Internet connection to access Box and the webhook service
## Installation
1. Clone this repository to your web server:
```
git clone https://github.com/yourorganization/hp-studio-copy-proofing-tool.git
```
2. Navigate to the installation directory:
```
cd hp-studio-copy-proofing-tool
```
3. Configure the webhook URL by editing `config.php`:
```php
$config = [
'webhook_url' => 'https://your-webhook-url.com/endpoint',
];
```
4. Configure Microsoft Authentication in `index.php` (around line 552):
- Set `clientId` to your Azure AD application ID
- Set `authority` to your tenant ID URL: `https://login.microsoftonline.com/YOUR_TENANT_ID`
- Set `redirectUri` to your application's URL
5. Ensure the web server has write permissions to the directory.
## Usage
1. Access the tool via your web browser at `http://your-server/hp-studio-copy-proofing-tool/`
2. **Sign in** with your Microsoft account credentials when prompted
3. Enter a valid Box file URL in the format `https://oliver-na.app.box.com/file/1234567890` (only image files are supported: gif, jpeg, jpg, png, webp)
4. Click "Process File" and wait for the analysis to complete
5. Review the results:
- Document Summary shows language information and issue count
- Grammar Issues highlights any grammatical errors
- Spelling Errors shows any misspelled words with context and suggested corrections
- Text Evaluation provides an assessment of all text content
6. For debugging, click "View Raw JSON Response" to see the full API response
## Webhook Data Sent
When a file is submitted, the following data is sent to the webhook:
```json
{
"url": "https://oliver-na.app.box.com/file/1697251331911",
"file_id": "1697251331911",
"username": "user@example.com",
"timestamp": "2024-01-15 14:30:45"
}
```
## Response Format
The webhook service should return a JSON response in the following format:
```json
{
"document_analysis": {
"language_detected": [
{
"language": "English",
"type": "US",
"spelling_status": "correct"
}
],
"grammar_issues": [
{
"section": "Text on the left shelf",
"error": "Missing possessive apostrophe in 'Hellmanns'.",
"suggestion": "Add an apostrophe to read 'Hellmann's'."
}
],
"spelling_errors": [
{
"word": "Hellmanns",
"context": "Hellmanns on both shelf stoppers",
"correct_spelling": "Hellmann's",
"status": "incorrect"
}
],
"text_evaluation": [
{
"text": "Make it irresistibly rich & creamy",
"status": "good"
}
]
}
}
```
## Troubleshooting
- **Invalid URL Error**: Ensure the Box URL is in the correct format with a valid file ID
- **Webhook Connection Error**: Verify the webhook URL in `config.php` is correct and accessible
- **No Results Displayed**: Check if the webhook is returning properly formatted JSON
## Security Considerations
- This tool requires Microsoft Azure AD authentication for access
- User credentials are managed through Microsoft's authentication system
- Username/email is captured and sent with each webhook request for audit tracking
- This tool is designed for internal use only
- The webhook URL should be secured and properly authenticated
- No sensitive data is stored locally on the server
- Session data is stored in browser sessionStorage and cleared on logout
## License
Copyright © 2024 HP Inc. All rights reserved.
## Credits
Developed by the HP Studio Tool Team