Add user-bound external MCP server and OAuth access
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<!doctype html><html lang="ru"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Подключённые ИИ — Инфосмета</title><style>
|
||||
body{font:16px/1.5 system-ui,sans-serif;background:#f5f7fa;color:#202735;margin:0;padding:24px}
|
||||
main{max-width:640px;margin:6vh auto;background:white;padding:32px;border-radius:16px;box-shadow:0 4px 32px #172c451a}
|
||||
li{padding:14px 0;border-bottom:1px solid #dde4ed}button{background:#b12d37;color:white;border:0;border-radius:7px;padding:8px 12px;cursor:pointer}
|
||||
</style></head><body><main><p><a href="/">← Инфосмета</a></p><h1>Подключённые ИИ</h1><p>Здесь можно отозвать доступ. После отзыва потребуется новое подключение.</p>
|
||||
<p id="status" role="status"></p><ul id="clients"></ul></main><script>
|
||||
const token=localStorage.getItem('token');
|
||||
const status=document.getElementById('status');
|
||||
const list=document.getElementById('clients');
|
||||
if(!token){status.textContent='Войдите в Инфосмету и обновите страницу.';}
|
||||
else load();
|
||||
async function load(){
|
||||
const r=await fetch('/api/mcp/clients',{headers:{Authorization:'Bearer '+token},cache:'no-store'});
|
||||
if(!r.ok){status.textContent='Сеанс истёк. Войдите снова.';return;}
|
||||
const clients=await r.json();list.replaceChildren();
|
||||
if(!clients.length){status.textContent='Активных подключений нет.';return;}
|
||||
status.textContent='';
|
||||
for(const c of clients){
|
||||
const li=document.createElement('li');
|
||||
const title=document.createElement('strong');title.textContent=c.client_name;
|
||||
const rights=document.createElement('p');rights.textContent='Права: '+c.scopes.join(', ');
|
||||
const button=document.createElement('button');button.textContent='Отозвать доступ';
|
||||
button.onclick=async()=>{
|
||||
if(!confirm('Отозвать доступ для '+c.client_name+'?'))return;
|
||||
button.disabled=true;
|
||||
const gone=await fetch('/api/mcp/clients/'+encodeURIComponent(c.client_id),{method:'DELETE',headers:{Authorization:'Bearer '+token}});
|
||||
if(gone.ok)load();else{button.disabled=false;status.textContent='Не удалось отозвать доступ.';}
|
||||
};
|
||||
li.append(title,rights,button);list.append(li);
|
||||
}
|
||||
}
|
||||
</script></body></html>
|
||||
Reference in New Issue
Block a user