uploaded new name
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Quality Recticel Print Service - Background Script
|
||||
* Quality Label Printing Service - Background Script
|
||||
* Handles communication between web pages and Windows print service
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ let serviceStatus = {
|
||||
|
||||
// Initialize extension
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
console.log('Quality Recticel Print Service extension installed');
|
||||
console.log('Quality Label Printing Service extension installed');
|
||||
checkServiceStatus();
|
||||
|
||||
// Set up periodic service check
|
||||
@@ -160,7 +160,7 @@ async function handlePrintPDF(printData) {
|
||||
chrome.notifications.create({
|
||||
type: 'basic',
|
||||
iconUrl: 'icons/icon48.png',
|
||||
title: 'Quality Recticel Print Service',
|
||||
title: 'Quality Label Printing Service',
|
||||
message: 'PDF printed successfully'
|
||||
});
|
||||
|
||||
@@ -176,7 +176,7 @@ async function handlePrintPDF(printData) {
|
||||
chrome.notifications.create({
|
||||
type: 'basic',
|
||||
iconUrl: 'icons/icon48.png',
|
||||
title: 'Quality Recticel Print Service',
|
||||
title: 'Quality Label Printing Service',
|
||||
message: `Print failed: ${error.message}`
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Quality Recticel Print Service - Content Script
|
||||
* Quality Label Printing Service - Content Script
|
||||
* Injects print service functionality into web pages
|
||||
*/
|
||||
|
||||
// Only inject on Quality Recticel domains or localhost
|
||||
// Only inject on Quality Label Printing domains or localhost
|
||||
const allowedDomains = [
|
||||
'localhost',
|
||||
'127.0.0.1'
|
||||
@@ -11,11 +11,11 @@ const allowedDomains = [
|
||||
|
||||
const currentDomain = window.location.hostname;
|
||||
if (!allowedDomains.includes(currentDomain)) {
|
||||
console.log('Quality Recticel Print Service: Not injecting on', currentDomain);
|
||||
console.log('Quality Label Printing Service: Not injecting on', currentDomain);
|
||||
// return; // Commented out for development - remove in production
|
||||
}
|
||||
|
||||
console.log('Quality Recticel Print Service: Content script loaded');
|
||||
console.log('Quality Label Printing Service: Content script loaded');
|
||||
|
||||
// Inject print service API into the page
|
||||
const printServiceAPI = {
|
||||
@@ -87,7 +87,7 @@ const printServiceAPI = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Print labels with Quality Recticel specific formatting
|
||||
* Print labels with Quality Label Printing specific formatting
|
||||
*/
|
||||
async printLabels(orderData, quantity = 1) {
|
||||
try {
|
||||
@@ -118,10 +118,10 @@ window.QualityRecticelPrintService = printServiceAPI;
|
||||
// Inject into page context for better compatibility
|
||||
const script = document.createElement('script');
|
||||
script.textContent = `
|
||||
// Quality Recticel Print Service API
|
||||
// Quality Label Printing Service API
|
||||
window.QualityRecticelPrintService = ${JSON.stringify(printServiceAPI)};
|
||||
|
||||
// Enhanced print function for Quality Recticel
|
||||
// Enhanced print function for Quality Label Printing
|
||||
window.printQualityRecticelLabels = async function(orderData, quantity) {
|
||||
try {
|
||||
// Get the PDF blob from the server
|
||||
@@ -173,12 +173,12 @@ script.textContent = `
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Print Quality Recticel labels error:', error);
|
||||
console.error('Print Quality Label Printing labels error:', error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
};
|
||||
|
||||
console.log('Quality Recticel Print Service API injected');
|
||||
console.log('Quality Label Printing Service API injected');
|
||||
`;
|
||||
document.documentElement.appendChild(script);
|
||||
|
||||
@@ -229,4 +229,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
console.log('Quality Recticel Print Service: Content script initialized');
|
||||
console.log('Quality Label Printing Service: Content script initialized');
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Quality Recticel Print Service",
|
||||
"name": "Quality Label Printing Service",
|
||||
"version": "1.0.0",
|
||||
"description": "Silent PDF printing service for Quality Recticel application",
|
||||
"description": "Silent PDF printing service for Quality Label Printing application",
|
||||
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_title": "Quality Recticel Print Service",
|
||||
"default_title": "Quality Label Printing Service",
|
||||
"default_icon": {
|
||||
"16": "icons/icon16.png",
|
||||
"32": "icons/icon32.png",
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="logo">QR</div>
|
||||
<div class="title">Quality Recticel Print Service</div>
|
||||
<div class="title">Quality Label Printing Service</div>
|
||||
<div class="version">Version 1.0.0</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Quality Recticel Print Service - Popup Script
|
||||
* Quality Label Printing Service - Popup Script
|
||||
* Manages the extension popup interface
|
||||
*/
|
||||
|
||||
@@ -224,7 +224,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
*/
|
||||
function showHelp() {
|
||||
const helpText = `
|
||||
Quality Recticel Print Service Help
|
||||
Quality Label Printing Service Help
|
||||
==================================
|
||||
|
||||
Installation:
|
||||
@@ -244,7 +244,7 @@ Troubleshooting:
|
||||
• Verify Chrome extension permissions
|
||||
• Check service logs: print_service.log
|
||||
|
||||
For support, contact the Quality Recticel development team.
|
||||
For support, contact the Quality Label Printing development team.
|
||||
`;
|
||||
|
||||
alert(helpText.trim());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@echo off
|
||||
REM Quality Recticel Print Service - Windows Native Installation
|
||||
REM Quality Label Printing Service - Windows Native Installation
|
||||
REM This script creates a lightweight PowerShell-based print service
|
||||
|
||||
echo ================================================
|
||||
echo Quality Recticel Print Service - Native Windows
|
||||
echo Quality Label Printing Service - Native Windows
|
||||
echo ================================================
|
||||
echo.
|
||||
|
||||
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
|
||||
echo.
|
||||
|
||||
REM Service configuration
|
||||
set SERVICE_NAME=QualityRecticelPrintService
|
||||
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService
|
||||
set SERVICE_NAME=QualityLabelPrinting
|
||||
set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
|
||||
|
||||
echo Creating service directory: %SERVICE_DIR%
|
||||
if not exist "%SERVICE_DIR%" (
|
||||
@@ -71,7 +71,7 @@ echo Creating service: %SERVICE_NAME%
|
||||
echo Binary path: %SERVICE_DIR%\service_wrapper.bat
|
||||
echo.
|
||||
|
||||
sc create %SERVICE_NAME% binPath="%SERVICE_DIR%\service_wrapper.bat" start=auto DisplayName="Quality Recticel Print Service"
|
||||
sc create %SERVICE_NAME% binPath="%SERVICE_DIR%\service_wrapper.bat" start=auto DisplayName="Quality Label Printing Service"
|
||||
|
||||
REM Check if service creation succeeded
|
||||
sc query %SERVICE_NAME% >nul 2>&1
|
||||
@@ -83,7 +83,7 @@ if errorlevel 1 (
|
||||
echo ✅ Service created successfully
|
||||
|
||||
REM Set description (may fail on older Windows, that's OK)
|
||||
sc description %SERVICE_NAME% "Local HTTP service for silent PDF printing from Quality Recticel web application" >nul 2>&1
|
||||
sc description %SERVICE_NAME% "Local HTTP service for silent PDF printing from Quality Label Printing web application" >nul 2>&1
|
||||
|
||||
goto :service_created
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@echo off
|
||||
REM Quality Recticel Print Service - Simple Native Installation
|
||||
REM Quality Label Printing Service - Simple Native Installation
|
||||
REM This version uses the most basic approach to avoid command line parsing issues
|
||||
|
||||
echo ================================================
|
||||
echo Quality Recticel Print Service - Native Windows
|
||||
echo Quality Label Printing Service - Native Windows
|
||||
echo ================================================
|
||||
echo.
|
||||
|
||||
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
|
||||
echo.
|
||||
|
||||
REM Service configuration
|
||||
set SERVICE_NAME=QualityRecticelPrintService
|
||||
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService
|
||||
set SERVICE_NAME=QualityLabelPrinting
|
||||
set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
|
||||
|
||||
echo Creating service directory: %SERVICE_DIR%
|
||||
if not exist "%SERVICE_DIR%" (
|
||||
@@ -101,7 +101,7 @@ echo ✅ Service created successfully
|
||||
echo.
|
||||
echo Configuring service startup...
|
||||
sc config "%SERVICE_NAME%" start=auto
|
||||
sc config "%SERVICE_NAME%" DisplayName="Quality Recticel Print Service"
|
||||
sc config "%SERVICE_NAME%" DisplayName="Quality Label Printing Service"
|
||||
|
||||
echo.
|
||||
echo Starting the service...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Quality Recticel Print Service - PowerShell Implementation
|
||||
# Quality Label Printing Service - PowerShell Implementation
|
||||
# Native Windows solution with no external dependencies
|
||||
|
||||
param(
|
||||
[int]$Port = 8765,
|
||||
[string]$LogFile = "$env:ProgramFiles\QualityRecticel\PrintService\print_service.log"
|
||||
[string]$LogFile = "$env:ProgramFiles\QualityLabelPrinting\PrintService\print_service.log"
|
||||
)
|
||||
|
||||
# Ensure log directory exists
|
||||
@@ -109,10 +109,11 @@ function Send-HttpResponse {
|
||||
$Context.Response.StatusCode = $StatusCode
|
||||
$Context.Response.ContentType = "$ContentType; charset=utf-8"
|
||||
|
||||
# Add CORS headers
|
||||
# Add comprehensive CORS headers
|
||||
$Context.Response.Headers.Add("Access-Control-Allow-Origin", "*")
|
||||
$Context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
||||
$Context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
||||
$Context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE")
|
||||
$Context.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept, Origin, X-Requested-With")
|
||||
$Context.Response.Headers.Add("Access-Control-Max-Age", "86400")
|
||||
|
||||
if ($Body) {
|
||||
$buffer = [System.Text.Encoding]::UTF8.GetBytes($Body)
|
||||
@@ -129,7 +130,7 @@ function Send-HttpResponse {
|
||||
|
||||
# Main HTTP server function
|
||||
function Start-PrintService {
|
||||
Write-ServiceLog "Starting Quality Recticel Print Service on port $Port"
|
||||
Write-ServiceLog "Starting Quality Label Printing Service on port $Port"
|
||||
|
||||
try {
|
||||
# Create HTTP listener
|
||||
@@ -153,12 +154,19 @@ function Start-PrintService {
|
||||
|
||||
Write-ServiceLog "$method $url"
|
||||
|
||||
# Handle CORS preflight requests first
|
||||
if ($method -eq "OPTIONS") {
|
||||
Write-ServiceLog "Handling CORS preflight request for $url"
|
||||
Send-HttpResponse -Context $context -StatusCode 200
|
||||
continue
|
||||
}
|
||||
|
||||
# Handle different endpoints
|
||||
switch -Regex ($url) {
|
||||
"^/health$" {
|
||||
$healthData = @{
|
||||
status = "healthy"
|
||||
service = "Quality Recticel Print Service"
|
||||
service = "Quality Label Printing Service"
|
||||
version = "1.0"
|
||||
timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
platform = "Windows PowerShell"
|
||||
@@ -207,11 +215,6 @@ function Start-PrintService {
|
||||
}
|
||||
}
|
||||
|
||||
"^/options$" {
|
||||
# Handle CORS preflight
|
||||
Send-HttpResponse -Context $context -StatusCode 200
|
||||
}
|
||||
|
||||
default {
|
||||
$errorResponse = @{
|
||||
success = $false
|
||||
@@ -250,7 +253,7 @@ function Start-PrintService {
|
||||
}
|
||||
|
||||
# Service entry point
|
||||
Write-ServiceLog "Quality Recticel Print Service starting..."
|
||||
Write-ServiceLog "Quality Label Printing Service starting..."
|
||||
|
||||
# Handle service stop gracefully
|
||||
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -Action {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
REM Service wrapper for PowerShell print service
|
||||
cd /d "C:\Program Files\QualityRecticel\PrintService"
|
||||
cd /d "C:\Program Files\QualityLabelPrinting\PrintService"
|
||||
powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "print_service.ps1"
|
||||
79
windows_print_service/test_service.ps1
Normal file
79
windows_print_service/test_service.ps1
Normal file
@@ -0,0 +1,79 @@
|
||||
# Test Windows Print Service CORS and Endpoints
|
||||
# Run this PowerShell script to test the service
|
||||
|
||||
Write-Host "Testing Quality Label Printing Service..." -ForegroundColor Green
|
||||
Write-Host "=========================================" -ForegroundColor Green
|
||||
|
||||
# Test 1: Health check
|
||||
Write-Host "`n1. Testing Health Endpoint..." -ForegroundColor Yellow
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri "http://localhost:8765/health" -Method GET -TimeoutSec 5
|
||||
Write-Host "✅ Health check successful:" -ForegroundColor Green
|
||||
$response | ConvertTo-Json -Depth 3
|
||||
} catch {
|
||||
Write-Host "❌ Health check failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Test 2: CORS preflight (OPTIONS request)
|
||||
Write-Host "`n2. Testing CORS Preflight (OPTIONS)..." -ForegroundColor Yellow
|
||||
try {
|
||||
$headers = @{
|
||||
'Origin' = 'http://localhost:5000'
|
||||
'Access-Control-Request-Method' = 'POST'
|
||||
'Access-Control-Request-Headers' = 'Content-Type'
|
||||
}
|
||||
|
||||
$response = Invoke-WebRequest -Uri "http://localhost:8765/print/silent" -Method OPTIONS -Headers $headers -TimeoutSec 5
|
||||
Write-Host "✅ CORS preflight successful - Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
|
||||
# Check CORS headers
|
||||
$corsHeaders = @('Access-Control-Allow-Origin', 'Access-Control-Allow-Methods', 'Access-Control-Allow-Headers')
|
||||
foreach ($header in $corsHeaders) {
|
||||
if ($response.Headers[$header]) {
|
||||
Write-Host " $header: $($response.Headers[$header])" -ForegroundColor Cyan
|
||||
} else {
|
||||
Write-Host " ❌ Missing header: $header" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "❌ CORS preflight failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Test 3: Printers endpoint
|
||||
Write-Host "`n3. Testing Printers Endpoint..." -ForegroundColor Yellow
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri "http://localhost:8765/printers" -Method GET -TimeoutSec 5
|
||||
Write-Host "✅ Printers endpoint successful:" -ForegroundColor Green
|
||||
$response | ConvertTo-Json -Depth 3
|
||||
} catch {
|
||||
Write-Host "❌ Printers endpoint failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Test 4: Service status
|
||||
Write-Host "`n4. Checking Windows Service Status..." -ForegroundColor Yellow
|
||||
try {
|
||||
$service = Get-Service -Name "QualityLabelPrinting" -ErrorAction Stop
|
||||
Write-Host "✅ Service Status: $($service.Status)" -ForegroundColor Green
|
||||
Write-Host " Service Name: $($service.Name)" -ForegroundColor Cyan
|
||||
Write-Host " Display Name: $($service.DisplayName)" -ForegroundColor Cyan
|
||||
} catch {
|
||||
Write-Host "❌ Service not found or error: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Test 5: Check service logs
|
||||
Write-Host "`n5. Recent Service Logs..." -ForegroundColor Yellow
|
||||
$logPath = "C:\Program Files\QualityLabelPrinting\PrintService\print_service.log"
|
||||
if (Test-Path $logPath) {
|
||||
Write-Host "📋 Last 10 log entries:" -ForegroundColor Cyan
|
||||
Get-Content $logPath -Tail 10 | ForEach-Object { Write-Host " $_" -ForegroundColor White }
|
||||
} else {
|
||||
Write-Host "❌ Log file not found at: $logPath" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host "`n=========================================" -ForegroundColor Green
|
||||
Write-Host "Service test completed!" -ForegroundColor Green
|
||||
Write-Host "`nNext steps:" -ForegroundColor Yellow
|
||||
Write-Host "1. If any tests failed, restart the service: sc restart QualityLabelPrinting" -ForegroundColor White
|
||||
Write-Host "2. Check firewall settings if connection refused" -ForegroundColor White
|
||||
Write-Host "3. Verify no other applications using port 8765" -ForegroundColor White
|
||||
Write-Host "4. Test in browser: http://localhost:8765/health" -ForegroundColor White
|
||||
@@ -1,9 +1,9 @@
|
||||
@echo off
|
||||
REM Quality Recticel Print Service - Uninstaller
|
||||
REM Quality Label Printing Service - Uninstaller
|
||||
REM This script removes the Windows print service
|
||||
|
||||
echo ================================================
|
||||
echo Quality Recticel Print Service - Uninstaller
|
||||
echo Quality Label Printing Service - Uninstaller
|
||||
echo ================================================
|
||||
echo.
|
||||
|
||||
@@ -20,8 +20,8 @@ echo ✅ Administrator privileges confirmed
|
||||
echo.
|
||||
|
||||
REM Service configuration
|
||||
set SERVICE_NAME=QualityRecticelPrintService
|
||||
set SERVICE_DIR=C:\Program Files\QualityRecticel\PrintService
|
||||
set SERVICE_NAME=QualityLabelPrinting
|
||||
set SERVICE_DIR=C:\Program Files\QualityLabelPrinting\PrintService
|
||||
|
||||
echo Stopping the service...
|
||||
sc stop "%SERVICE_NAME%" >nul 2>&1
|
||||
@@ -60,10 +60,10 @@ echo ================================================
|
||||
echo Uninstallation Complete!
|
||||
echo ================================================
|
||||
echo.
|
||||
echo The Quality Recticel Print Service has been removed from your system.
|
||||
echo The Quality Label Printing Service has been removed from your system.
|
||||
echo.
|
||||
echo If you had any Chrome extensions installed, you may want to:
|
||||
echo 1. Remove the Quality Recticel Print extension from Chrome
|
||||
echo 1. Remove the Quality Label Printing extension from Chrome
|
||||
echo 2. Clear any remaining Chrome extension data
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user