discord_peak_bot/web/public/index.html

79 lines
2.5 KiB
HTML
Raw Normal View History

2024-08-03 11:18:28 +00:00
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Discord Bot デバッグモード</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.container {
text-align: center;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
button {
margin: 10px;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.enable {
background-color: #4caf50;
color: white;
}
.disable {
background-color: #f44336;
color: white;
}
</style>
</head>
<body>
<div class="container">
<h1>Discord Bot デバッグモード</h1>
<button class="enable" onclick="toggleDebug(true)">デバッグモードを有効にする</button>
<button class="disable" onclick="toggleDebug(false)">デバッグモードを無効にする</button>
<p id="status"></p>
</div>
<script>
function toggleDebug(enable) {
fetch('/debug', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ enable })
})
.then(response => response.json())
.then(data => {
const status = document.getElementById('status');
if (data.success) {
status.textContent = `デバッグモードが${enable ? '有効' : '無効'}になりました。`;
status.style.color = enable ? 'green' : 'red';
} else {
status.textContent = `デバッグモードの切り替えに失敗しました。`;
status.style.color = 'red';
}
})
.catch(error => {
const status = document.getElementById('status');
status.textContent = `エラー: ${error}`;
status.style.color = 'red';
});
}
</script>
</body>
</html>