<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>STRK Webhook Spammer</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #1e1e2f;
            color: #fff;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .container {
            background-color: #2a2a40;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            text-align: center;
            width: 400px;
        }
        .container h1 {
            font-size: 1.5em;
            margin-bottom: 20px;
        }
        .input-group {
            margin-bottom: 15px;
        }
        .input-group label {
            display: block;
            margin-bottom: 5px;
            font-size: 0.9em;
        }
        .input-group input, .input-group textarea {
            width: calc(100% - 20px);
            padding: 10px;
            border: none;
            border-radius: 5px;
            font-size: 1em;
        }
        .input-group textarea {
            resize: none;
            height: 80px;
        }
        button {
            padding: 10px 20px;
            font-size: 1em;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin: 5px;
        }
        button#send {
            background-color: #4CAF50;
            color: white;
        }
        button#stop {
            background-color: #f44336;
            color: white;
        }
        button:disabled {
            background-color: #777;
            cursor: not-allowed;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>STRK Webhook Spammer</h1>
        <div class="input-group">
            <label for="webhook">Webhook URL</label>
            <input type="url" id="webhook" placeholder="webhook URL">
        </div>
        <div class="input-group">
            <label for="message">Message</label>
            <textarea id="message" placeholder="message"></textarea>
        </div>
        <div class="input-group">
            <label for="count">送信回数</label>
            <input type="number" id="count" min="1" max="100" value="1">
        </div>
        <button id="send">SEND</button>
        <button id="stop" disabled>STOP</button>
    </div>

    <script>
        const sendButton = document.getElementById('send');
        const stopButton = document.getElementById('stop');
        let isSending = false;

        sendButton.addEventListener('click', async () => {
            const webhookURL = document.getElementById('webhook').value;
            const message = document.getElementById('message').value;
            const count = parseInt(document.getElementById('count').value, 10);

            if (!webhookURL || !message || count <= 0) {
                alert('Please fill out all fields correctly.');
                return;
            }

            isSending = true;
            sendButton.disabled = true;
            stopButton.disabled = false;

            for (let i = 0; i < count; i++) {
                if (!isSending) break;
                try {
                    await fetch(webhookURL, {
                        method: 'POST',
                        headers: { 'Content-Type': 'application/json' },
                        body: JSON.stringify({ content: message })
                    });
                } catch (error) {
                    console.error('Error sending message:', error);
                }
            }

            isSending = false;
            sendButton.disabled = false;
            stopButton.disabled = true;
        });

        stopButton.addEventListener('click', () => {
            isSending = false;
            stopButton.disabled = true;
            sendButton.disabled = false;
        });
    </script>
</body>
</html>