Delete templates/tokens.html
Browse files- templates/tokens.html +0 -82
templates/tokens.html
DELETED
|
@@ -1,82 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="zh-CN">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
| 6 |
-
<title>Tokens 管理</title>
|
| 7 |
-
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
<script>
|
| 9 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 10 |
-
const apiPrefix = "{{ api_prefix }}";
|
| 11 |
-
const uploadForm = document.getElementById('uploadForm');
|
| 12 |
-
const clearForm = document.getElementById('clearForm');
|
| 13 |
-
const errorButton = document.getElementById('errorButton');
|
| 14 |
-
|
| 15 |
-
if (apiPrefix === "None") {
|
| 16 |
-
uploadForm.action = "/tokens/upload";
|
| 17 |
-
clearForm.action = "/tokens/clear";
|
| 18 |
-
errorButton.dataset.api = "/tokens/error";
|
| 19 |
-
} else {
|
| 20 |
-
uploadForm.action = `/${apiPrefix}/tokens/upload`;
|
| 21 |
-
clearForm.action = `/${apiPrefix}/tokens/clear`;
|
| 22 |
-
errorButton.dataset.api = `/${apiPrefix}/tokens/error`;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
errorButton.addEventListener('click', async () => {
|
| 26 |
-
const response = await fetch(errorButton.dataset.api, {
|
| 27 |
-
method: 'POST',
|
| 28 |
-
});
|
| 29 |
-
const result = await response.json();
|
| 30 |
-
const errorTokens = result.error_tokens;
|
| 31 |
-
|
| 32 |
-
const errorModal = document.getElementById('errorModal');
|
| 33 |
-
const errorModalContent = document.getElementById('errorModalContent');
|
| 34 |
-
|
| 35 |
-
errorModalContent.innerHTML = errorTokens.map(token => `<p>${token}</p>`).join('');
|
| 36 |
-
errorModal.classList.remove('hidden');
|
| 37 |
-
});
|
| 38 |
-
|
| 39 |
-
document.getElementById('errorModalClose').addEventListener('click', () => {
|
| 40 |
-
document.getElementById('errorModal').classList.add('hidden');
|
| 41 |
-
});
|
| 42 |
-
|
| 43 |
-
document.getElementById('errorModalCopy').addEventListener('click', () => {
|
| 44 |
-
const errorModalContent = document.getElementById('errorModalContent');
|
| 45 |
-
const textToCopy = errorModalContent.innerText.replace(/\n\n/g, '\n');
|
| 46 |
-
navigator.clipboard.writeText(textToCopy).then(() => {
|
| 47 |
-
alert('错误 Tokens 已复制到剪贴板');
|
| 48 |
-
}).catch(err => {
|
| 49 |
-
alert('复制失败,请手动复制');
|
| 50 |
-
});
|
| 51 |
-
});
|
| 52 |
-
});
|
| 53 |
-
</script>
|
| 54 |
-
</head>
|
| 55 |
-
<body class="bg-gradient-to-r from-blue-200 via-purple-200 to-pink-200 flex justify-center items-center min-h-screen">
|
| 56 |
-
<div class="bg-white p-10 rounded-lg shadow-2xl w-128 text-center">
|
| 57 |
-
<h1 class="text-4xl font-extrabold text-gray-900 mb-6">Tokens 管理</h1>
|
| 58 |
-
<p class="text-gray-600 mb-4">当前可用 Tokens 数量:<span class="text-blue-600">{{ tokens_count }}</span></p>
|
| 59 |
-
<form class="mb-2" id="uploadForm" method="post">
|
| 60 |
-
<textarea class="w-full p-4 mb-4 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none" name="text" placeholder="一行一个Token,可以是 AccessToken 或 RefreshToken" rows="10"></textarea>
|
| 61 |
-
<p class="text-gray-600 mb-2">注:使用docker时如果挂载了data文件夹则重启后不需要再次上传</p>
|
| 62 |
-
<button class="w-full bg-blue-600 text-white py-3 rounded-md hover:bg-blue-700 transition duration-300 mb-2" type="submit">上传</button>
|
| 63 |
-
</form>
|
| 64 |
-
<button id="errorButton" class="w-full bg-yellow-600 text-white py-3 rounded-md hover:bg-yellow-700 transition duration-200 mt-2">查看错误Tokens</button>
|
| 65 |
-
<p class="text-gray-600 mt-2">点击清空,将会清空上传和错误的 Tokens</p>
|
| 66 |
-
<form id="clearForm" method="post">
|
| 67 |
-
<button class="w-full bg-red-600 text-white py-3 rounded-md hover:bg-red-700 transition duration-300" type="submit">清空Tokens</button>
|
| 68 |
-
</form>
|
| 69 |
-
</div>
|
| 70 |
-
|
| 71 |
-
<div id="errorModal" class="fixed inset-0 bg-gray-800 bg-opacity-75 flex justify-center items-center hidden">
|
| 72 |
-
<div class="bg-white p-6 rounded-lg shadow-lg w-150">
|
| 73 |
-
<h2 class="text-2xl font-bold mb-4">错误 Tokens</h2>
|
| 74 |
-
<div id="errorModalContent" class="list-disc list-inside text-left mb-4"></div>
|
| 75 |
-
<div class="flex justify-end space-x-4">
|
| 76 |
-
<button id="errorModalCopy" class="bg-green-600 text-white py-2 px-4 rounded-md hover:bg-green-700 transition duration-300">复制</button>
|
| 77 |
-
<button id="errorModalClose" class="bg-red-600 text-white py-2 px-4 rounded-md hover:bg-red-700 transition duration-300">关闭</button>
|
| 78 |
-
</div>
|
| 79 |
-
</div>
|
| 80 |
-
</div>
|
| 81 |
-
</body>
|
| 82 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|