Skip to content

Commit 0d8fb71

Browse files
authored
feat: restore OAuth actions in gateways partial (#2083)
Add "Authorize" and "Fetch Tools" buttons for OAuth-enabled gateways, matching the main admin interface layout. Use |tojson filter for gateway.name in onclick handler to prevent potential XSS from gateway names containing quotes or backslashes. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
1 parent 7aa7a35 commit 0d8fb71

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

mcpgateway/templates/gateways_partial.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,25 @@
2929
Test
3030
</button>
3131

32-
<!-- Row 2: View | Edit -->
32+
{% if gateway.authType == 'oauth' %}
33+
<!-- Row 2: OAuth Authorize | Fetch Tools -->
34+
<a href="{{ root_path }}/oauth/authorize/{{ gateway.id }}"
35+
class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-indigo-600 hover:text-indigo-900 hover:bg-indigo-50 dark:text-indigo-400 dark:hover:bg-indigo-900/20 transition-colors"
36+
x-tooltip="'🔐 Authorize Users for OAuth'">
37+
🔐 Authorize
38+
</a>
39+
<button onclick="fetchToolsForGateway({{ gateway.id|tojson }}, {{ gateway.name|tojson }})"
40+
class="flex items-center justify-center px-1 py-1 text-xs font-medium rounded-md text-green-600 hover:text-green-900 hover:bg-green-50 dark:text-green-400 dark:hover:bg-green-900/20 transition-colors"
41+
x-tooltip="'🔧 Fetch Tools from MCP Server'" id="fetch-tools-{{ gateway.id }}">
42+
🔧 Fetch Tools
43+
</button>
44+
{% endif %}
45+
46+
<!-- Row 3: View | Edit -->
3347
<button onclick="viewGateway('{{ gateway.id }}')" class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-indigo-600 hover:text-indigo-900 hover:bg-indigo-50 dark:text-indigo-400 dark:hover:bg-indigo-900/20 transition-colors">View</button>
3448
<button onclick="editGateway('{{ gateway.id }}')" class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-green-600 hover:text-green-900 hover:bg-green-50 dark:text-green-400 dark:hover:bg-green-900/20 transition-colors">Edit</button>
3549

36-
<!-- Row 3 & 4: Activate/Deactivate | Delete -->
50+
<!-- Row 4: Activate/Deactivate | Delete -->
3751
<div class="col-span-2 flex flex-col space-y-1">
3852
<form method="POST" action="{{ root_path }}/admin/gateways/{{ gateway.id }}/toggle" class="contents" onsubmit="return handleToggleSubmit(event, 'gateways')">
3953
<input type="hidden" name="activate" value="{{ 'false' if gateway.enabled else 'true' }}" />

0 commit comments

Comments
 (0)