File size: 7,558 Bytes
0f74ccc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568802f
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API DASHBOARD — SWISS EDITION</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        /* Tipografi Khas Swiss Design */
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            letter-spacing: -0.02em;
        }
        .swiss-border {
            border-top: 4px solid black;
        }
    </style>
</head>
<body class="bg-[#F0F0F0] text-black antialiased p-6 md:p-12">

    <header class="max-w-7xl mx-auto mb-16 border-b-2 border-black pb-4">
        <h1 class="text-6xl md:text-8xl font-black uppercase leading-none tracking-tighter">
            System<br>Interface
        </h1>
        <div class="flex justify-between items-end mt-4">
            <p class="text-sm font-bold uppercase tracking-widest">Automated API Management</p>
            <p class="text-sm font-mono">v4.0.26</p>
        </div>
    </header>

    <main class="max-w-7xl mx-auto">
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-0 border-l border-t border-black">
            <% plugins.forEach((plugin, index) => { %>
                <div class="card bg-white p-8 border-r border-b border-black flex flex-col justify-between hover:bg-black hover:text-white transition-colors duration-300 group">
                    <div>
                        <div class="flex items-center space-x-2 mb-8">
                            <span class="bg-black text-white group-hover:bg-white group-hover:text-black px-2 py-0.5 text-[10px] font-bold uppercase tracking-tighter">
                                <%= Array.isArray(plugin.method) ? plugin.method.join('/') : plugin.method %>
                            </span>
                            <span class="text-[10px] font-mono opacity-60"><%= plugin.path %></span>
                        </div>
                        
                        <h2 class="text-3xl font-bold uppercase leading-tight mb-4 tracking-tighter">
                            <%= plugin.name.replace(/_/g, ' ') %>
                        </h2>
                        
                        <p class="text-sm leading-relaxed mb-12 opacity-80 min-h-[3rem]">
                            <%= plugin.description %>
                        </p>
                    </div>

                    <div class="space-y-4">
                        <% if (plugin.path.includes('ocr')) { %>
                            <div class="space-y-2">
                                <input type="text" id="url-<%= index %>" 
                                    class="w-full bg-transparent border-b-2 border-black group-hover:border-white py-2 px-1 text-sm focus:outline-none placeholder:text-gray-400" 
                                    placeholder="PASTE IMAGE URL">
                                <div class="text-[10px] font-bold text-center">OR</div>
                                <label class="block cursor-pointer border-2 border-dashed border-black group-hover:border-white p-4 text-center text-[10px] font-black uppercase">
                                    Upload Local File
                                    <input type="file" id="file-<%= index %>" class="hidden" accept="image/*">
                                </label>
                            </div>
                        <% } else { %>
                            <input type="text" id="input-<%= index %>" 
                                class="w-full bg-transparent border-b-2 border-black group-hover:border-white py-2 px-1 text-sm focus:outline-none placeholder:text-gray-400" 
                                placeholder="<%= plugin.path.includes('bonsai') ? 'ASK SOMETHING...' : 'ENTER PROMPT...' %>">
                        <% } %>

                        <button onclick="runTest('<%= plugin.path %>', <%= index %>)" 
                            class="w-full bg-black text-white group-hover:bg-white group-hover:text-black py-4 text-xs font-black uppercase tracking-[0.2em] transition-transform active:scale-95">
                            Execute Module
                        </button>
                    </div>

                    <div id="result-container-<%= index %>" class="hidden mt-8 pt-8 border-t border-black group-hover:border-white">
                        <div id="status-<%= index %>" class="text-[10px] font-bold uppercase mb-4 tracking-widest"></div>
                        <div id="media-<%= index %>" class="mb-4"></div>
                        <pre id="json-<%= index %>" class="text-[10px] font-mono overflow-x-auto p-4 bg-gray-100 text-black"></pre>
                    </div>
                </div>
            <% }) %>
        </div>
    </main>

    <footer class="max-w-7xl mx-auto mt-24 border-t-4 border-black pt-4 flex justify-between text-[10px] font-black uppercase tracking-widest">
        <span>RIEL AFRONIA AUGUSTUS</span>
        <span>JAKARTA / 2026</span>
    </footer>

    <script>
        async function runTest(path, id) {
            const container = document.getElementById(`result-container-${id}`);
            const status = document.getElementById(`status-${id}`);
            const jsonPre = document.getElementById(`json-${id}`);
            const media = document.getElementById(`media-${id}`);

            container.classList.remove('hidden');
            status.innerHTML = '⏳ LOADING_DATA...';
            jsonPre.innerText = '';
            media.innerHTML = '';

            try {
                let response;

                if (path.includes('ocr')) {
                    const urlVal = document.getElementById(`url-${id}`).value;
                    const fileInput = document.getElementById(`file-${id}`).files[0];

                    if (fileInput) {
                        const formData = new FormData();
                        formData.append('file', fileInput);
                        response = await fetch(path, { method: 'POST', body: formData });
                    } else if (urlVal) {
                        response = await fetch(`${path}?image=${encodeURIComponent(urlVal)}`);
                    } else {
                        throw new Error("INPUT_REQUIRED: URL_OR_FILE");
                    }
                } else {
                    const val = document.getElementById(`input-${id}`).value;
                    const param = (path.includes('bonsai') || path.includes('chat')) ? 'q' : 'prompt';
                    response = await fetch(`${path}?${param}=${encodeURIComponent(val)}`);
                }

                const data = await response.json();
                status.innerHTML = response.ok ? '✅ STATUS_OK' : '❌ STATUS_FAILED';
                jsonPre.innerText = JSON.stringify(data, null, 2);

                const imgs = data.images || (data.result && Array.isArray(data.result) ? data.result : null);
                if (imgs && Array.isArray(imgs)) {
                    imgs.forEach(url => {
                        const img = document.createElement('img');
                        img.src = url;
                        img.className = 'w-full grayscale hover:grayscale-0 transition-all duration-500 border border-black mb-2';
                        media.appendChild(img);
                    });
                }
            } catch (err) {
                status.innerHTML = '❌ SYSTEM_ERROR';
                jsonPre.innerText = err.message;
            }
        }
    </script>
</body>
</html>