90 lines
2.5 KiB
HTML
90 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>BizyAir - Set API Key</title>
|
|
<style>
|
|
body {
|
|
background-color: #121212;
|
|
color: #ffffff;
|
|
font-family: Arial, sans-serif;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
}
|
|
|
|
.container {
|
|
text-align: center;
|
|
}
|
|
|
|
input[type="password"] {
|
|
padding: 10px;
|
|
margin: 10px;
|
|
border: 2px solid rgb(130, 88, 245);
|
|
border-radius: 5px;
|
|
background-color: #1e1e1e;
|
|
color: #ffffff;
|
|
width: 200px;
|
|
}
|
|
|
|
button {
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
background-color: rgb(130, 88, 245);
|
|
color: #ffffff;
|
|
cursor: pointer;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
</style>
|
|
<script>
|
|
async function setApiKey () {
|
|
const apiKey = document.getElementById('apiKey').value;
|
|
let endpoint = location.href;
|
|
if (endpoint.includes('/bizyair/set-api-key'))
|
|
endpoint = endpoint.replace('/bizyair/set-api-key', '/bizyair/set_api_key');
|
|
else
|
|
endpoint = `${endpoint}/bizyair/set_api_key`;
|
|
const response = await fetch(endpoint, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
body: `api_key=${encodeURIComponent(apiKey)}`
|
|
});
|
|
if (response.ok) {
|
|
alert('API Key set successfully!');
|
|
if (window.opener) {
|
|
window.opener.location.reload();
|
|
window.close();
|
|
}
|
|
} else {
|
|
alert('Failed to set API Key: ' + await response.text());
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<h1>Set API Key</h1>
|
|
<input type="password" id="apiKey" placeholder="Enter API Key">
|
|
<button onclick="setApiKey()">Set API Key</button>
|
|
<p>To get your key, visit <a href="https://cloud.siliconflow.cn"
|
|
target="_blank">https://cloud.siliconflow.cn</a></p>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|