CiEL7 commited on
Commit
0f74ccc
·
verified ·
1 Parent(s): ecfb732

Update plugins/index.ejs

Browse files
Files changed (1) hide show
  1. plugins/index.ejs +144 -227
plugins/index.ejs CHANGED
@@ -1,228 +1,145 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>API Plugins Dashboard</title>
7
- <style>
8
- :root {
9
- --bg: #0d1117;
10
- --card-bg: #161b22;
11
- --text: #c9d1d9;
12
- --accent: #58a6ff;
13
- --success: #238636;
14
- --border: #30363d;
15
- --code-bg: #010409;
16
- }
17
-
18
- body {
19
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
20
- background: var(--bg);
21
- color: var(--text);
22
- padding: 40px;
23
- margin: 0;
24
- }
25
-
26
- h1 {
27
- margin-bottom: 30px;
28
- text-align: center;
29
- color: var(--accent);
30
- }
31
-
32
- .grid {
33
- display: grid;
34
- grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
35
- gap: 25px;
36
- max-width: 1200px;
37
- margin: 0 auto;
38
- }
39
-
40
- .card {
41
- background: var(--card-bg);
42
- padding: 24px;
43
- border-radius: 12px;
44
- border: 1px solid var(--border);
45
- transition: transform 0.2s, border-color 0.2s;
46
- display: flex;
47
- flex-direction: column;
48
- }
49
-
50
- .card:hover {
51
- border-color: var(--accent);
52
- transform: translateY(-5px);
53
- }
54
-
55
- .method-badge {
56
- font-weight: bold;
57
- color: var(--success);
58
- background: rgba(35, 134, 54, 0.1);
59
- padding: 2px 8px;
60
- border-radius: 6px;
61
- font-size: 12px;
62
- margin-right: 8px;
63
- }
64
-
65
- .path {
66
- color: var(--accent);
67
- font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
68
- font-size: 14px;
69
- }
70
-
71
- h3 { margin: 15px 0 10px 0; font-size: 1.2rem; }
72
-
73
- small { color: #8b949e; margin-bottom: 20px; display: block; min-height: 40px; }
74
-
75
- .test-input {
76
- width: 100%;
77
- background: var(--code-bg);
78
- border: 1px solid var(--border);
79
- color: white;
80
- padding: 12px;
81
- border-radius: 6px;
82
- margin-bottom: 12px;
83
- box-sizing: border-box;
84
- }
85
-
86
- .btn-run {
87
- background: var(--success);
88
- color: white;
89
- border: none;
90
- padding: 12px;
91
- border-radius: 6px;
92
- cursor: pointer;
93
- font-weight: bold;
94
- width: 100%;
95
- transition: opacity 0.2s;
96
- }
97
-
98
- .btn-run:hover { opacity: 0.9; }
99
-
100
- .result-box {
101
- margin-top: 20px;
102
- background: var(--code-bg);
103
- border-radius: 8px;
104
- padding: 15px;
105
- display: none;
106
- max-height: 400px;
107
- overflow-y: auto;
108
- border: 1px solid var(--border);
109
- }
110
-
111
- .status { font-size: 13px; margin-bottom: 10px; font-style: italic; }
112
-
113
- pre {
114
- font-size: 12px;
115
- white-space: pre-wrap;
116
- word-break: break-all;
117
- color: #d1d5da;
118
- margin: 0;
119
- }
120
-
121
- .preview-img {
122
- margin-top: 15px;
123
- width: 100%;
124
- border-radius: 8px;
125
- border: 1px solid var(--border);
126
- }
127
- </style>
128
- </head>
129
- <body>
130
- <h1>API Plugins Dashboard</h1>
131
-
132
- <div class="grid">
133
- <% plugins.forEach((plugin, index) => { %>
134
- <div class="card">
135
- <div>
136
- <span class="method-badge"><%= Array.isArray(plugin.method) ? plugin.method.join('/') : plugin.method %></span>
137
- <span class="path"><%= plugin.path %></span>
138
- </div>
139
-
140
- <h3><%= plugin.name.toUpperCase().replace(/_/g, ' ') %></h3>
141
- <small><%= plugin.description %></small>
142
-
143
- <div class="form-container">
144
- <% if (plugin.path.includes('ocr')) { %>
145
- <input type="text" id="url-<%= index %>" class="test-input" placeholder="Paste image URL...">
146
- <div style="text-align: center; margin: 5px 0; font-size: 11px; color: #8b949e;">OR</div>
147
- <input type="file" id="file-<%= index %>" class="test-input" accept="image/*">
148
- <% } else { %>
149
- <input type="text" id="input-<%= index %>" class="test-input"
150
- placeholder="<%= plugin.path.includes('bonsai') ? 'Tanya sesuatu...' : 'Masukkan prompt gambar...' %>">
151
- <% } %>
152
-
153
- <button class="btn-run" onclick="runTest('<%= plugin.path %>', <%= index %>)">Run Plugin</button>
154
- </div>
155
-
156
- <div class="result-box" id="result-container-<%= index %>">
157
- <div id="status-<%= index %>" class="status"></div>
158
- <pre id="json-<%= index %>"></pre>
159
- <div id="media-<%= index %>"></div>
160
- </div>
161
- </div>
162
- <% }) %>
163
- </div>
164
-
165
- <script>
166
- async function runTest(path, id) {
167
- const container = document.getElementById(`result-container-${id}`);
168
- const status = document.getElementById(`status-${id}`);
169
- const jsonPre = document.getElementById(`json-${id}`);
170
- const media = document.getElementById(`media-${id}`);
171
-
172
- // Reset UI
173
- container.style.display = 'block';
174
- status.innerHTML = '⏳ Processing...';
175
- jsonPre.innerText = '';
176
- media.innerHTML = '';
177
-
178
- try {
179
- let response;
180
-
181
- // Logika khusus OCR (DeepSeek)
182
- if (path.includes('ocr')) {
183
- const urlVal = document.getElementById(`url-${id}`).value;
184
- const fileInput = document.getElementById(`file-${id}`).files[0];
185
-
186
- if (fileInput) {
187
- // POST: Kirim file lokal
188
- const formData = new FormData();
189
- formData.append('file', fileInput);
190
- response = await fetch(path, { method: 'POST', body: formData });
191
- } else if (urlVal) {
192
- // GET: Kirim URL gambar
193
- response = await fetch(`${path}?image=${encodeURIComponent(urlVal)}`);
194
- } else {
195
- throw new Error("Pilih file atau masukkan URL gambar!");
196
- }
197
- }
198
- // Logika untuk plugin lainnya
199
- else {
200
- const val = document.getElementById(`input-${id}`).value;
201
- // Pilih param 'q' untuk bonsai/chat, 'prompt' untuk gen image
202
- const param = (path.includes('bonsai') || path.includes('chat')) ? 'q' : 'prompt';
203
- response = await fetch(`${path}?${param}=${encodeURIComponent(val)}`);
204
- }
205
-
206
- const data = await response.json();
207
- status.innerHTML = response.ok ? '✅ Success' : '❌ Failed';
208
- jsonPre.innerText = JSON.stringify(data, null, 2);
209
-
210
- // Preview Gambar jika ada (Illustrious/NSFW)
211
- const imgs = data.images || (data.result && Array.isArray(data.result) ? data.result : null);
212
- if (imgs && Array.isArray(imgs)) {
213
- imgs.forEach(url => {
214
- const img = document.createElement('img');
215
- img.src = url;
216
- img.className = 'preview-img';
217
- media.appendChild(img);
218
- });
219
- }
220
-
221
- } catch (err) {
222
- status.innerHTML = '❌ Error';
223
- jsonPre.innerText = err.message;
224
- }
225
- }
226
- </script>
227
- </body>
228
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>API DASHBOARD — SWISS EDITION</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ /* Tipografi Khas Swiss Design */
10
+ body {
11
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
12
+ letter-spacing: -0.02em;
13
+ }
14
+ .swiss-border {
15
+ border-top: 4px solid black;
16
+ }
17
+ </style>
18
+ </head>
19
+ <body class="bg-[#F0F0F0] text-black antialiased p-6 md:p-12">
20
+
21
+ <header class="max-w-7xl mx-auto mb-16 border-b-2 border-black pb-4">
22
+ <h1 class="text-6xl md:text-8xl font-black uppercase leading-none tracking-tighter">
23
+ System<br>Interface
24
+ </h1>
25
+ <div class="flex justify-between items-end mt-4">
26
+ <p class="text-sm font-bold uppercase tracking-widest">Automated API Management</p>
27
+ <p class="text-sm font-mono">v4.0.26</p>
28
+ </div>
29
+ </header>
30
+
31
+ <main class="max-w-7xl mx-auto">
32
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-0 border-l border-t border-black">
33
+ <% plugins.forEach((plugin, index) => { %>
34
+ <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">
35
+ <div>
36
+ <div class="flex items-center space-x-2 mb-8">
37
+ <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">
38
+ <%= Array.isArray(plugin.method) ? plugin.method.join('/') : plugin.method %>
39
+ </span>
40
+ <span class="text-[10px] font-mono opacity-60"><%= plugin.path %></span>
41
+ </div>
42
+
43
+ <h2 class="text-3xl font-bold uppercase leading-tight mb-4 tracking-tighter">
44
+ <%= plugin.name.replace(/_/g, ' ') %>
45
+ </h2>
46
+
47
+ <p class="text-sm leading-relaxed mb-12 opacity-80 min-h-[3rem]">
48
+ <%= plugin.description %>
49
+ </p>
50
+ </div>
51
+
52
+ <div class="space-y-4">
53
+ <% if (plugin.path.includes('ocr')) { %>
54
+ <div class="space-y-2">
55
+ <input type="text" id="url-<%= index %>"
56
+ 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"
57
+ placeholder="PASTE IMAGE URL">
58
+ <div class="text-[10px] font-bold text-center">OR</div>
59
+ <label class="block cursor-pointer border-2 border-dashed border-black group-hover:border-white p-4 text-center text-[10px] font-black uppercase">
60
+ Upload Local File
61
+ <input type="file" id="file-<%= index %>" class="hidden" accept="image/*">
62
+ </label>
63
+ </div>
64
+ <% } else { %>
65
+ <input type="text" id="input-<%= index %>"
66
+ 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"
67
+ placeholder="<%= plugin.path.includes('bonsai') ? 'ASK SOMETHING...' : 'ENTER PROMPT...' %>">
68
+ <% } %>
69
+
70
+ <button onclick="runTest('<%= plugin.path %>', <%= index %>)"
71
+ 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">
72
+ Execute Module
73
+ </button>
74
+ </div>
75
+
76
+ <div id="result-container-<%= index %>" class="hidden mt-8 pt-8 border-t border-black group-hover:border-white">
77
+ <div id="status-<%= index %>" class="text-[10px] font-bold uppercase mb-4 tracking-widest"></div>
78
+ <div id="media-<%= index %>" class="mb-4"></div>
79
+ <pre id="json-<%= index %>" class="text-[10px] font-mono overflow-x-auto p-4 bg-gray-100 text-black"></pre>
80
+ </div>
81
+ </div>
82
+ <% }) %>
83
+ </div>
84
+ </main>
85
+
86
+ <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">
87
+ <span>RIEL AFRONIA AUGUSTUS</span>
88
+ <span>JAKARTA / 2026</span>
89
+ </footer>
90
+
91
+ <script>
92
+ async function runTest(path, id) {
93
+ const container = document.getElementById(`result-container-${id}`);
94
+ const status = document.getElementById(`status-${id}`);
95
+ const jsonPre = document.getElementById(`json-${id}`);
96
+ const media = document.getElementById(`media-${id}`);
97
+
98
+ container.classList.remove('hidden');
99
+ status.innerHTML = '⏳ LOADING_DATA...';
100
+ jsonPre.innerText = '';
101
+ media.innerHTML = '';
102
+
103
+ try {
104
+ let response;
105
+
106
+ if (path.includes('ocr')) {
107
+ const urlVal = document.getElementById(`url-${id}`).value;
108
+ const fileInput = document.getElementById(`file-${id}`).files[0];
109
+
110
+ if (fileInput) {
111
+ const formData = new FormData();
112
+ formData.append('file', fileInput);
113
+ response = await fetch(path, { method: 'POST', body: formData });
114
+ } else if (urlVal) {
115
+ response = await fetch(`${path}?image=${encodeURIComponent(urlVal)}`);
116
+ } else {
117
+ throw new Error("INPUT_REQUIRED: URL_OR_FILE");
118
+ }
119
+ } else {
120
+ const val = document.getElementById(`input-${id}`).value;
121
+ const param = (path.includes('bonsai') || path.includes('chat')) ? 'q' : 'prompt';
122
+ response = await fetch(`${path}?${param}=${encodeURIComponent(val)}`);
123
+ }
124
+
125
+ const data = await response.json();
126
+ status.innerHTML = response.ok ? '✅ STATUS_OK' : '❌ STATUS_FAILED';
127
+ jsonPre.innerText = JSON.stringify(data, null, 2);
128
+
129
+ const imgs = data.images || (data.result && Array.isArray(data.result) ? data.result : null);
130
+ if (imgs && Array.isArray(imgs)) {
131
+ imgs.forEach(url => {
132
+ const img = document.createElement('img');
133
+ img.src = url;
134
+ img.className = 'w-full grayscale hover:grayscale-0 transition-all duration-500 border border-black mb-2';
135
+ media.appendChild(img);
136
+ });
137
+ }
138
+ } catch (err) {
139
+ status.innerHTML = '❌ SYSTEM_ERROR';
140
+ jsonPre.innerText = err.message;
141
+ }
142
+ }
143
+ </script>
144
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  </html>