dbug: handle new eyre identities, fancier logout

Include and render identities associated with requests, channels, and
login sessions. Provide the ability to kick identities and their
sessions, logging them out.
This commit is contained in:
fang 2023-05-05 23:46:30 +02:00
parent 744dea2267
commit f1c839717e
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
3 changed files with 36 additions and 9 deletions

View File

@ -368,7 +368,8 @@
(gth expiry-time.a expiry-time.b)
|= [cookie=@uv session:eyre]
%- pairs
:~ 'cookie'^s+(end [3 4] (rsh [3 2] (scot %x (shax cookie))))
:~ 'cookie'^s+(scot %uv cookie)
'identity'^(render-identity:v-eyre identity)
'expiry'^(time expiry-time)
'channels'^(numb ~(wyt in channels))
==
@ -383,6 +384,7 @@
|= [key=@t channel:eyre]
%- pairs
:~ 'session'^s+key
'identity'^(render-identity:v-eyre identity)
'connected'^b+!-.state
'expiry'^?-(-.state %& (time date.p.state), %| ~)
'next-id'^(numb next-id)
@ -992,6 +994,15 @@
++ channel-state
(scry ^channel-state %e %channel-state ~)
::
++ render-identity
|= =identity
^- json
%- ship:enjs:format
?- -.identity
%ours our.bowl
%fake who.identity
==
::
++ render-action
|= =action
^- json

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,10 @@ export class Eyre extends Component {
const summary = (<>
{c.session}
<table style={{borderBottom: '1px solid black'}}><tbody>
<tr>
<td class="inter">identity</td>
<td>{c['identity']}</td>
</tr>
<tr>
<td class="inter">connected?</td>
<td>{c.connected
@ -152,9 +156,18 @@ export class Eyre extends Component {
});
const sessionItems = props.authentication.map(s => {
return (<div>
{`${s.cookie} expires ${msToDa(s.expiry)}, uses ${s.channels} channel(s)`}
</div>);
return ({key: s.identity, jsx: (<tr>
<td>{s.cookie.slice(0,6)}</td>
<td>{s.identity}</td>
<td>{msToDa(s.expiry)}</td>
<td>{s.channels} channel(s)</td>
<td>
<form method="post" action="/~/logout?redirect=/~debug/eyre">
<input type="hidden" name="sid" value={s.cookie} />
<button type="submit" name="all">kick</button>
</form>
</td>
</tr>)});
});
return (<>
@ -174,14 +187,17 @@ export class Eyre extends Component {
</SearchableList>
<h4>Cookies</h4>
<button onClick={this.loadAuthenticationState}>refresh</button>
<form method="post" action="/~/logout">
<button type="submit">logout</button>
<button type="submit">logout self</button>
</form>
<form method="post" action="/~/logout">
<button type="submit" name="all">logout all</button>
<button type="submit" name="all">logout all selves</button>
</form>
{sessionItems}
<table><tbody>
<SearchableList placeholder="identity" items={sessionItems}>
<button onClick={this.loadAuthenticationState}>refresh</button>
</SearchableList>
</tbody></table>
</>);
}
}