api4 / public /index.html
ngoctuanai's picture
Update public/index.html
0c73a71
raw
history blame
1.72 kB
<!-- public/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OPENAI Reverse Proxy</title>
<style>
/* CSS styles for the container, headings, and lead paragraph */
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 5px;
}
.text-center {
text-align: center;
}
.lead {
font-size: 18px;
color: #555;
}
.url {
color: #007bff;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center">Welcome to OPENAI Reverse Proxy</h1>
<p class="lead">This is your OpenAI Reverse Proxy URL:</p>
<p class="url" id="reverseProxyUrl"></p>
</div>
<!-- JavaScript code -->
<script>
// Function to generate the Reverse Proxy URL
function getExternalUrl(spaceId) {
try {
const [username, spacename] = spaceId.split("/");
return `https://${username}-${spacename.replace(/_/g, "-")}.hf.space/api/v1`;
} catch (e) {
return "";
}
}
// Get the Reverse Proxy URL and update the HTML element with id="reverseProxyUrl"
const spaceId = "ngoctuanai/openaiproxy";
const reverseProxyUrl = getExternalUrl(spaceId);
document.getElementById("reverseProxyUrl").textContent = reverseProxyUrl;
</script>
</body>
</html>