···4{{ template "components/navBar" .NavBar }}
567-<h1>API Key Management</h1>
89-<div class="card">
10- <h2 class="teal-header">Create New API Key</h2>
11- <p>API keys allow programmatic access to your Piper account data.</p>
12 <form method="POST" action="/api-keys">
13- <div style="margin-bottom: 15px;">
14- <label for="name">Key Name (for your reference):</label>
15- <input type="text" id="name" name="name" placeholder="My Application" style="width: 100%; padding: 8px; margin-top: 5px;">
16 </div>
17- <button type="submit" class="btn">Generate New API Key</button>
18 </form>
19</div>
2021{{if .NewKeyID}} <!-- Changed from .NewKey to .NewKeyID for clarity -->
22-<div class="new-key-alert">
23- <h3 class="teal-header">Your new API key (ID: {{.NewKeyID}}) has been created</h3>
24 <!-- The message below is misleading if only the ID is shown.
25 Consider changing this text or modifying the flow to show the actual key once for HTML. -->
26 <p><strong>Important:</strong> If this is an ID, ensure you have copied the actual key if it was displayed previously. For keys generated via the API, the key is returned in the API response.</p>
27</div>
28{{end}}
2930-<div class="card">
31- <h2 class="teal-header">Your API Keys</h2>
32 {{if .Keys}}
33- <table>
34 <thead>
35- <tr>
36- <th>Name</th>
37- <th>Prefix</th>
38- <th>Created</th>
39- <th>Expires</th>
40- <th>Actions</th>
41 </tr>
42 </thead>
43 <tbody>
44 {{range .Keys}}
45- <tr>
46- <td>{{.Name}}</td>
47- <td>{{.KeyPrefix}}</td> <!-- Added KeyPrefix for better identification -->
48- <td>{{formatTime .CreatedAt}}</td>
49- <td>{{formatTime .ExpiresAt}}</td>
50- <td>
51- <button class="btn btn-danger" onclick="deleteKey('{{.ID}}')">Delete</button>
52 </td>
53 </tr>
54 {{end}}
···59 {{end}}
60</div>
6162-<div class="card">
63- <h2 class="teal-header">API Usage</h2>
64- <p>To use your API key, include it in the Authorization header of your HTTP requests:</p>
65- <pre>Authorization: Bearer YOUR_API_KEY</pre>
66- <p>Or include it as a query parameter (less secure for the key itself):</p>
67- <pre>https://your-piper-instance.com/endpoint?api_key=YOUR_API_KEY</pre>
68</div>
6970<script>
···4{{ template "components/navBar" .NavBar }}
567+<h1 class="text-[#1DB954]">API Key Management</h1>
89+<div class="border border-gray-300 rounded-lg p-5 mb-5">
10+ <h2 class="text-[#1DB954] text-xl font-semibold mb-2">Create New API Key</h2>
11+ <p class="mb-3">API keys allow programmatic access to your Piper account data.</p>
12 <form method="POST" action="/api-keys">
13+ <div class="mb-4">
14+ <label class="block" for="name">Key Name (for your reference):</label>
15+ <input class="mt-1 w-full p-2 border border-gray-300 rounded" type="text" id="name" name="name" placeholder="My Application">
16 </div>
17+ <button type="submit" class="bg-[#1DB954] text-white px-4 py-2 rounded cursor-pointer hover:opacity-90">Generate New API Key</button>
18 </form>
19</div>
2021{{if .NewKeyID}} <!-- Changed from .NewKey to .NewKeyID for clarity -->
22+<div class="bg-gray-100 border-l-4 border-[#1DB954] p-4 mb-5">
23+ <h3 class="text-[#1DB954] text-lg font-semibold mb-1">Your new API key (ID: {{.NewKeyID}}) has been created</h3>
24 <!-- The message below is misleading if only the ID is shown.
25 Consider changing this text or modifying the flow to show the actual key once for HTML. -->
26 <p><strong>Important:</strong> If this is an ID, ensure you have copied the actual key if it was displayed previously. For keys generated via the API, the key is returned in the API response.</p>
27</div>
28{{end}}
2930+<div class="border border-gray-300 rounded-lg p-5 mb-5">
31+ <h2 class="text-[#1DB954] text-xl font-semibold mb-2">Your API Keys</h2>
32 {{if .Keys}}
33+ <table class="w-full border-collapse">
34 <thead>
35+ <tr class="text-left border-b border-gray-300">
36+ <th class="p-2">Name</th>
37+ <th class="p-2">Prefix</th>
38+ <th class="p-2">Created</th>
39+ <th class="p-2">Expires</th>
40+ <th class="p-2">Actions</th>
41 </tr>
42 </thead>
43 <tbody>
44 {{range .Keys}}
45+ <tr class="border-b border-gray-200">
46+ <td class="p-2">{{.Name}}</td>
47+ <td class="p-2">{{.KeyPrefix}}</td> <!-- Added KeyPrefix for better identification -->
48+ <td class="p-2">{{formatTime .CreatedAt}}</td>
49+ <td class="p-2">{{formatTime .ExpiresAt}}</td>
50+ <td class="p-2">
51+ <button class="bg-[#dc3545] text-white px-3 py-1.5 rounded cursor-pointer hover:opacity-90" onclick="deleteKey('{{.ID}}')">Delete</button>
52 </td>
53 </tr>
54 {{end}}
···59 {{end}}
60</div>
6162+<div class="border border-gray-300 rounded-lg p-5 mb-5">
63+ <h2 class="text-[#1DB954] text-xl font-semibold mb-2">API Usage</h2>
64+ <p class="mb-2">To use your API key, include it in the Authorization header of your HTTP requests:</p>
65+ <pre class="font-mono p-2 bg-gray-100 border border-gray-300 rounded">Authorization: Bearer YOUR_API_KEY</pre>
66+ <p class="mt-3 mb-2">Or include it as a query parameter (less secure for the key itself):</p>
67+ <pre class="font-mono p-2 bg-gray-100 border border-gray-300 rounded">https://your-piper-instance.com/endpoint?api_key=YOUR_API_KEY</pre>
68</div>
6970<script>