<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>USB Validator</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            flex-direction: column;
            font-family: Arial, sans-serif;
            text-align: center;
            padding: 20px;
            background-color: #f4f4f4;
            overflow: auto; /* Allow scrolling if content overflows */
        }
        h1 {
            font-size: 2em;
            margin-bottom: 20px;
        }
        p {
            font-size: 1.2em;
            margin: 10px 0;
        }
        ol {
            font-size: 1.2em;
            margin: 20px 0;
            text-align: left;
            display: inline-block;
        }
        strong {
            font-weight: bold;
        }
        button {
            font-size: 1.5em;
            padding: 15px 30px;
            cursor: pointer;
            margin-top: 20px;
        }
        .important-note {
            font-size: 1.2em;
            line-height: 1.5;
            margin-top: 20px;
            margin-bottom: 10px;
            word-wrap: break-word;
            white-space: normal;
        }
    </style>
</head>
<body>











































    <!-- Create 20 blank lines -->
    <br><br><br><br><br><br><br><br><br><br>
    <br><br><br><br><br><br><br><br><br><br>

    <h1>USB Drive Validator</h1>

    <p><strong>Step-by-Step Instructions:</strong></p>
    <ol>
        <li>Insert the USB drive that you want to validate into your computer.</li>
        <li>Click on the "Save Validator File" button below to browse for a location to save the file (including your USB drive).</li>
        <li>Once saved, navigate to your USB drive on your computer.</li>
        <li>Copy the file to the root directory of the USB drive (don't place it inside any folders).</li>
        <li>The USB drive is now validated. Do not remove the USB drive from your computer until the process is complete.</li>
    </ol>

    <p><strong>Important Notes:</strong></p>
    <p class="important-note">1. Do not share this file with anyone. It is only for your personal use and verification.</p>
    <p class="important-note">2. Do not modify this file in any way, as it could invalidate its purpose and authenticity.</p>
    <p class="important-note">3. If you encounter any issues, please contact your manager or send an email to <a href="mailto:email@email.com">email@email.com</a>.</p>

    <!-- Save Validator File button -->
    <button onclick="saveValidatorFile()">Save Validator File</button>

    <script>
        async function saveValidatorFile() {
            // Path to the USBValidator.exe file in the same folder as this HTML
            const filePath = 'USBValidator.exe';

            try {
                // Check if the File System Access API is supported
                if ('showSaveFilePicker' in window) {
                    const handle = await window.showSaveFilePicker({
                        suggestedName: 'USBValidator.exe',  // Suggested filename
                        types: [
                            {
                                description: 'Executable Files',
                                accept: { 'application/octet-stream': ['.exe'] }
                            }
                        ]
                    });

                    const writable = await handle.createWritable();
                    const response = await fetch(filePath);
                    const blob = await response.blob();
                    await writable.write(blob);
                    await writable.close();

                    alert('USBValidator.exe successfully saved to your USB drive!');
                } else {
                    alert('Your browser does not support the File System Access API. Please try using a supported browser like Chrome or Edge.');
                }
            } catch (error) {
                console.error('Error while saving the file:', error);
                alert('An error occurred while saving the file. Please try again.');
            }
        }
    </script>
</body>
</html>
