feat: mostrar API Key en panel WebSMS

Agrega sección visible en /app/websms con el secret_key
y botón de copiar, para facilitar el uso del endpoint externo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-23 23:17:45 -05:00
co-authored by Claude Sonnet 4.6
parent 704664afe7
commit 8a9235631c
+15 -1
View File
@@ -41,6 +41,19 @@
</form>
</div>
<!-- API Key -->
<div class="bg-white rounded-xl shadow-sm border border-slate-200 p-6 mb-6">
<h2 class="text-lg font-bold text-slate-800 mb-1">API Key (envío externo)</h2>
<p class="text-sm text-slate-500 mb-4">Usa este token en <code class="bg-slate-100 px-1 rounded">Authorization: Bearer &lt;key&gt;</code> para llamar a <code class="bg-slate-100 px-1 rounded">POST /api/sms/send</code> desde sistemas externos.</p>
<div x-show="secretKey" class="flex items-center gap-2">
<code class="flex-1 text-xs bg-slate-50 p-2 rounded border border-slate-200 text-slate-700 break-all font-mono" x-text="secretKey"></code>
<button type="button" @click="copy(secretKey)" class="btn-icon text-slate-400 hover:text-slate-600 flex-shrink-0" title="Copiar">
<svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
</button>
</div>
<p x-show="!secretKey" class="text-sm text-slate-400">Guarda la configuración para generar la API Key.</p>
</div>
<!-- Probar envío -->
<div class="bg-white rounded-xl shadow-sm border border-slate-200 p-6 mb-6">
<h2 class="text-lg font-bold text-slate-800 mb-4">Probar envío</h2>
@@ -138,7 +151,7 @@
function websmsApp() {
return {
form:{ username:'', api_token:'', sender:'', notas:'' },
showToken:false,
showToken:false, secretKey:'',
logs:[],
testPara:'', testMsg:'', testResult:'', testOk:false,
saving:false, error:'', copied:'',
@@ -153,6 +166,7 @@ function websmsApp() {
const r=await axios.get('/app/websms/config');
if(r.data.data){
this.form={id:r.data.data.ID, username:r.data.data.username, api_token:r.data.data.api_token, sender:r.data.data.sender||'', notas:r.data.data.notas||''};
this.secretKey=r.data.data.secret_key||'';
}
} catch(e){}
},