Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
180 lines
6.2 KiB
HTML
180 lines
6.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Test Task API</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
.section {
|
|
margin-bottom: 30px;
|
|
}
|
|
h2 {
|
|
color: #333;
|
|
border-bottom: 2px solid #e0e0e0;
|
|
padding-bottom: 10px;
|
|
}
|
|
button {
|
|
background-color: #4CAF50;
|
|
color: white;
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
margin-right: 10px;
|
|
}
|
|
button:hover {
|
|
background-color: #45a049;
|
|
}
|
|
.result {
|
|
background-color: #f0f0f0;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
margin-top: 10px;
|
|
white-space: pre-wrap;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
}
|
|
.error {
|
|
background-color: #ffebee;
|
|
color: #c62828;
|
|
}
|
|
.success {
|
|
background-color: #e8f5e9;
|
|
color: #2e7d32;
|
|
}
|
|
.login-form {
|
|
margin-bottom: 20px;
|
|
}
|
|
.login-form input {
|
|
padding: 8px;
|
|
margin-right: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Task API Test</h1>
|
|
|
|
<div class="section">
|
|
<h2>Login</h2>
|
|
<div class="login-form">
|
|
<input type="text" id="username" placeholder="Username" value="admin">
|
|
<input type="password" id="password" placeholder="Password" value="111111">
|
|
<button onclick="login()">Login</button>
|
|
</div>
|
|
<div id="loginResult" class="result"></div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Group Task API Tests</h2>
|
|
<button onclick="testGroupTaskList()">Test Group Task List</button>
|
|
<button onclick="testScriptTaskList()">Test Script Task List</button>
|
|
<button onclick="testPullMemberTaskList()">Test Pull Member Task List</button>
|
|
<div id="taskResult" class="result"></div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Proxy Platform API Test</h2>
|
|
<button onclick="testProxyPlatformList()">Test Proxy Platform List</button>
|
|
<div id="proxyResult" class="result"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let token = localStorage.getItem('token') || '';
|
|
const baseUrl = 'http://localhost:8890';
|
|
|
|
async function makeRequest(url, method = 'GET', data = null) {
|
|
const options = {
|
|
method: method,
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': token
|
|
}
|
|
};
|
|
|
|
if (data && method !== 'GET') {
|
|
options.body = JSON.stringify(data);
|
|
}
|
|
|
|
try {
|
|
const response = await fetch(baseUrl + url, options);
|
|
const result = await response.json();
|
|
return { success: response.ok, data: result, status: response.status };
|
|
} catch (error) {
|
|
return { success: false, error: error.message };
|
|
}
|
|
}
|
|
|
|
async function login() {
|
|
const username = document.getElementById('username').value;
|
|
const password = document.getElementById('password').value;
|
|
|
|
const result = await makeRequest('/api/login', 'POST', { username, password });
|
|
const resultDiv = document.getElementById('loginResult');
|
|
|
|
if (result.success && result.data.success) {
|
|
token = result.data.token;
|
|
localStorage.setItem('token', token);
|
|
resultDiv.className = 'result success';
|
|
resultDiv.textContent = 'Login successful!\nToken: ' + token;
|
|
} else {
|
|
resultDiv.className = 'result error';
|
|
resultDiv.textContent = 'Login failed: ' + JSON.stringify(result.data, null, 2);
|
|
}
|
|
}
|
|
|
|
async function testGroupTaskList() {
|
|
const result = await makeRequest('/groupTask/list', 'POST', {});
|
|
displayResult('taskResult', result, 'Group Task List');
|
|
}
|
|
|
|
async function testScriptTaskList() {
|
|
const result = await makeRequest('/scriptTask/list', 'POST', {});
|
|
displayResult('taskResult', result, 'Script Task List');
|
|
}
|
|
|
|
async function testPullMemberTaskList() {
|
|
const result = await makeRequest('/pullMemberTask/list', 'POST', {});
|
|
displayResult('taskResult', result, 'Pull Member Task List');
|
|
}
|
|
|
|
async function testProxyPlatformList() {
|
|
const result = await makeRequest('/proxyPlatform/list', 'POST', {});
|
|
displayResult('proxyResult', result, 'Proxy Platform List');
|
|
}
|
|
|
|
function displayResult(elementId, result, title) {
|
|
const resultDiv = document.getElementById(elementId);
|
|
if (result.success) {
|
|
resultDiv.className = 'result success';
|
|
resultDiv.textContent = `${title} - Success:\n${JSON.stringify(result.data, null, 2)}`;
|
|
} else {
|
|
resultDiv.className = 'result error';
|
|
resultDiv.textContent = `${title} - Error (Status: ${result.status}):\n${JSON.stringify(result.data || result.error, null, 2)}`;
|
|
}
|
|
}
|
|
|
|
// Auto-login if token exists
|
|
if (token) {
|
|
document.getElementById('loginResult').className = 'result success';
|
|
document.getElementById('loginResult').textContent = 'Using existing token from localStorage';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |