mirror of
https://github.com/eddyem/onionserver.git
synced 2026-02-01 04:45:05 +03:00
fixed bug with websockets list; added <form autocomplete="on"> to pass/login
This commit is contained in:
parent
6a8837f345
commit
366c1cd936
@ -98,17 +98,18 @@ void register_WS(onion_websocket *ws){
|
||||
void send_all_WS(char *data){
|
||||
if(strlen(data) == 0) return; // zero length
|
||||
WSlist *l = wslist;
|
||||
if(!l) return;
|
||||
int cnt = 0;
|
||||
unregister_WS(); // check for dead ws
|
||||
while(l){
|
||||
DBG("try to send");
|
||||
//DBG("try to send");
|
||||
if(onion_websocket_printf(l->ws, "%s", data) <= 0){ // dead websocket? remove it from list
|
||||
DBG("Error printing - check for dead");
|
||||
unregister_WS();
|
||||
}else ++cnt;
|
||||
l = l->next;
|
||||
}
|
||||
DBG("Send message %s to %d clients", data, cnt);
|
||||
//DBG("Send message %s to %d clients", data, cnt);
|
||||
}
|
||||
|
||||
void unregister_WS(){
|
||||
@ -128,6 +129,7 @@ void unregister_WS(){
|
||||
wslist->last = l->prev; // we should delete last element
|
||||
}
|
||||
WSlist *nxt = l->next;
|
||||
if(l == wslist) wslist = nxt; // delete the first element
|
||||
FREE(l);
|
||||
l = nxt;
|
||||
continue;
|
||||
|
||||
@ -43,7 +43,9 @@ auth = function(){
|
||||
s.type = 'text/css';
|
||||
s.innerHTML = '.shadow{position:absolute;text-align:center;vertical-align:center;top:0;display:none;left:0;width:100%;height:100%;background-color:lightGrey;opacity:0.9;}';
|
||||
document.body.appendChild(s);
|
||||
d.innerHTML = "<div>Login:</div><div><input type=text id='login'></div><div>Password:</div><div><input type=password id='passwd'></div><button onclick='auth.send();'>OK</button>";
|
||||
d.innerHTML = "<form autocomplete='on'><div>Login:</div><div><input type='text' id='login' name='username'>" +
|
||||
"</div><div>Password:</div><div><input type='password' id='passwd' name='password'>" +
|
||||
"</div><button onclick='auth.send();'>OK</button></form>";
|
||||
d.className = "shadow";
|
||||
document.body.appendChild(d);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user