File size: 1,724 Bytes
4e53ff3
 
 
 
 
0c73a71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dff33a0
 
 
0c73a71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4e53ff3
 
0c73a71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!-- 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>